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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
enc[0] = amf.TypeObject
|
// required link info
|
||||||
enc = enc[1:]
|
info := amf.Object{Properties: []amf.Property{
|
||||||
enc, err = amf.EncodeNamedString(enc, avApp, c.link.app)
|
amf.Property{Type: amf.TypeString, Name: avApp, String: c.link.app},
|
||||||
if err != nil {
|
amf.Property{Type: amf.TypeString, Name: avType, String: avNonprivate},
|
||||||
return err
|
amf.Property{Type: amf.TypeString, Name: avTcUrl, String: c.link.url}},
|
||||||
}
|
}
|
||||||
enc, err = amf.EncodeNamedString(enc, avType, avNonprivate)
|
enc, err = amf.Encode(&info, enc)
|
||||||
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)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// add auth string, if any
|
// optional link auth info
|
||||||
if c.link.auth != "" {
|
if c.link.auth != "" {
|
||||||
enc, err = amf.EncodeBoolean(enc, c.link.flags&linkAuth != 0)
|
enc, err = amf.EncodeBoolean(enc, c.link.flags&linkAuth != 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue