fix: rtp fu-a format check

This commit is contained in:
langhuihui
2025-09-10 14:53:13 +08:00
parent 46ababe7a9
commit 7b38bd0500
2 changed files with 13 additions and 9 deletions

View File

@@ -106,10 +106,10 @@ rtsp:
# pull:
# live/test: rtsp://admin:1qaz2wsx3EDC@58.212.158.30/Streaming/Channels/101
# live/test: rtsp://admin:1qaz2wsx3EDC@localhost:8554/live/test
webrtc:
publish:
pubaudio: false
port: udp:9000-9100
# webrtc:
# publish:
# pubaudio: false
# port: udp:9000-9100
snap:
enable: false
onpub:

View File

@@ -404,10 +404,10 @@ func (r *VideoFrame) Demux() (err error) {
naluType.Parse(b1)
nalu.PushOne([]byte{naluType.Or(b0 & 0x60)})
}
if nalu.Size > 0 {
if nalu != nil && nalu.Size > 0 {
nalu.PushOne(packet.Payload[offset:])
if util.Bit1(b1, 1) {
// 结束位
nalu = nil
}
} else {
continue
@@ -455,9 +455,13 @@ func (r *VideoFrame) Demux() (err error) {
nalu = nalus.GetNextPointer()
nalu.PushOne([]byte{first3[0]&0b10000001 | (naluType << 1), first3[1]})
}
nalu.PushOne(buffer)
if util.Bit1(fuHeader, 1) {
// 结束标志
if nalu != nil && nalu.Size > 0 {
nalu.PushOne(buffer)
if util.Bit1(fuHeader, 1) {
nalu = nil
}
} else {
continue
}
default:
return fmt.Errorf("unsupported nalu type %d", t)