diff --git a/rtmp/packet.go b/rtmp/packet.go index 70ead13a..8c0fc0f3 100644 --- a/rtmp/packet.go +++ b/rtmp/packet.go @@ -183,9 +183,8 @@ func (pkt *packet) read(s *Session) error { if size > 6 { pkt.packetType = header[6] - if size == 11 { - pkt.info = decodeInt32LE(header[7:11]) + pkt.info = int32(amf.DecodeInt32LE(header[7:11])) } } } @@ -232,10 +231,6 @@ func (pkt *packet) read(s *Session) error { s.channelsIn[pkt.channel].timestamp = 0xffffff } - if pkt.bytesRead != pkt.bodySize { - panic("readPacket: bytesRead != bodySize") - } - if !pkt.hasAbsTimestamp { // timestamps seem to always be relative pkt.timestamp += uint32(s.channelTimestamp[pkt.channel]) @@ -494,12 +489,3 @@ func (pkt *packet) write(s *Session, queue bool) error { return nil } - -func decodeInt32LE(data []byte) int32 { - return int32(data[3])<<24 | int32(data[2])<<16 | int32(data[1])<<8 | int32(data[0]) -} - -func encodeInt32LE(dst []byte, v int32) int32 { - binary.LittleEndian.PutUint32(dst, uint32(v)) - return 4 -}