mirror of https://bitbucket.org/ausocean/av.git
Use amf.DecodeInt32LE() instead of decodeInt32LE().
This commit is contained in:
parent
e8002582da
commit
9ff10dbbac
|
@ -183,9 +183,8 @@ func (pkt *packet) read(s *Session) error {
|
||||||
|
|
||||||
if size > 6 {
|
if size > 6 {
|
||||||
pkt.packetType = header[6]
|
pkt.packetType = header[6]
|
||||||
|
|
||||||
if size == 11 {
|
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
|
s.channelsIn[pkt.channel].timestamp = 0xffffff
|
||||||
}
|
}
|
||||||
|
|
||||||
if pkt.bytesRead != pkt.bodySize {
|
|
||||||
panic("readPacket: bytesRead != bodySize")
|
|
||||||
}
|
|
||||||
|
|
||||||
if !pkt.hasAbsTimestamp {
|
if !pkt.hasAbsTimestamp {
|
||||||
// timestamps seem to always be relative
|
// timestamps seem to always be relative
|
||||||
pkt.timestamp += uint32(s.channelTimestamp[pkt.channel])
|
pkt.timestamp += uint32(s.channelTimestamp[pkt.channel])
|
||||||
|
@ -494,12 +489,3 @@ func (pkt *packet) write(s *Session, queue bool) error {
|
||||||
|
|
||||||
return nil
|
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
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue