mirror of https://bitbucket.org/ausocean/av.git
sendConnectPacket() now encodes required link info in one go using amf.Encode().
This commit is contained in:
parent
adfb87dcf9
commit
42be87d98a
22
rtmp/rtmp.go
22
rtmp/rtmp.go
|
@ -276,26 +276,18 @@ func sendConnectPacket(c *Conn) error {
|
|||
return err
|
||||
}
|
||||
|
||||
enc[0] = amf.TypeObject
|
||||
enc = enc[1:]
|
||||
enc, err = amf.EncodeNamedString(enc, avApp, c.link.app)
|
||||
if err != nil {
|
||||
return err
|
||||
// required link info
|
||||
info := amf.Object{Properties: []amf.Property{
|
||||
amf.Property{Type: amf.TypeString, Name: avApp, String: c.link.app},
|
||||
amf.Property{Type: amf.TypeString, Name: avType, String: avNonprivate},
|
||||
amf.Property{Type: amf.TypeString, Name: avTcUrl, String: c.link.url}},
|
||||
}
|
||||
enc, err = amf.EncodeNamedString(enc, avType, avNonprivate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
enc, err = amf.EncodeNamedString(enc, avTcUrl, c.link.url)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
enc, err = amf.EncodeInt24(enc, amf.TypeObjectEnd)
|
||||
enc, err = amf.Encode(&info, enc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// add auth string, if any
|
||||
// optional link auth info
|
||||
if c.link.auth != "" {
|
||||
enc, err = amf.EncodeBoolean(enc, c.link.flags&linkAuth != 0)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue