Fix RTP H264 with two SEI in packet
This commit is contained in:
+18
-18
@@ -36,26 +36,26 @@ func RTPDepay(track *streamer.Track) streamer.WrapperFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(buf) == 0 {
|
if len(buf) == 0 {
|
||||||
// Amcrest IP4M-1051: 9, 7, 8, 6, 28...
|
for {
|
||||||
// Amcrest IP4M-1051: 9, 6, 1
|
// Amcrest IP4M-1051: 9, 7, 8, 6, 28...
|
||||||
switch NALUType(payload) {
|
// Amcrest IP4M-1051: 9, 6, 1
|
||||||
case NALUTypeIFrame:
|
switch NALUType(payload) {
|
||||||
// fix IFrame without SPS,PPS
|
case NALUTypeIFrame:
|
||||||
buf = append(buf, ps...)
|
// fix IFrame without SPS,PPS
|
||||||
case NALUTypeSEI, NALUTypeAUD:
|
|
||||||
// fix ffmpeg with transcoding first frame
|
|
||||||
i := int(4 + binary.BigEndian.Uint32(payload))
|
|
||||||
|
|
||||||
// check if only one NAL (fix ffmpeg transcoding for Reolink RLC-510A)
|
|
||||||
if i == len(payload) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
payload = payload[i:]
|
|
||||||
|
|
||||||
if NALUType(payload) == NALUTypeIFrame {
|
|
||||||
buf = append(buf, ps...)
|
buf = append(buf, ps...)
|
||||||
|
case NALUTypeSEI, NALUTypeAUD:
|
||||||
|
// fix ffmpeg with transcoding first frame
|
||||||
|
i := int(4 + binary.BigEndian.Uint32(payload))
|
||||||
|
|
||||||
|
// check if only one NAL (fix ffmpeg transcoding for Reolink RLC-510A)
|
||||||
|
if i == len(payload) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
payload = payload[i:]
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user