diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 6e57a452..9ec21d9e 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -312,8 +312,7 @@ func sendConnectPacket(s *Session) error { } enc := pkt.body - var err error - enc, err = amf.EncodeString(enc, avConnect) + enc, err := amf.EncodeString(enc, avConnect) if err != nil { return err } @@ -348,7 +347,6 @@ func sendConnectPacket(s *Session) error { return err } } - if s.link.tcUrl != "" { enc, err = amf.EncodeNamedString(enc, avTcUrl, s.link.tcUrl) if err != nil { @@ -378,7 +376,6 @@ func sendConnectPacket(s *Session) error { return err } if s.link.pageUrl != "" { - var err error enc, err = amf.EncodeNamedString(enc, avPageUrl, s.link.pageUrl) if err != nil { return err @@ -386,17 +383,13 @@ func sendConnectPacket(s *Session) error { } } - if s.encoding != 0.0 || s.sendEncoding { - enc, err = amf.EncodeNamedNumber(enc, avObjectEncoding, s.encoding) - if err != nil { - return err - } + // terminate the AMF object + enc, err = amf.EncodeInt24(enc, amf.TypeObjectEnd) + if err != nil { + return err } - copy(enc, []byte{0, 0, amf.TypeObjectEnd}) - enc = enc[3:] - - // add auth string + // add auth string, if any if s.link.auth != "" { enc, err = amf.EncodeBoolean(enc, s.link.flags&linkAuth != 0) if err != nil { diff --git a/rtmp/session.go b/rtmp/session.go index cbe27c8f..c00018cd 100644 --- a/rtmp/session.go +++ b/rtmp/session.go @@ -54,7 +54,6 @@ type Session struct { clientBW int32 clientBW2 uint8 isPlaying bool - sendEncoding bool numInvokes int32 methodCalls []method channelsAllocatedIn int32 @@ -64,7 +63,6 @@ type Session struct { channelTimestamp []int32 audioCodecs float64 videoCodecs float64 - encoding float64 deferred []byte link link log Log