mirror of
https://github.com/aler9/gortsplib
synced 2025-10-20 05:54:47 +08:00
fix panic when checking pts = dts on H265 (bluenviron/mediamtx#3754) (#617)
This commit is contained in:
@@ -140,13 +140,13 @@ func (f *H265) PTSEqualsDTS(pkt *rtp.Packet) bool {
|
||||
return true
|
||||
|
||||
case h265.NALUType_AggregationUnit:
|
||||
if len(pkt.Payload) < 4 {
|
||||
return false
|
||||
}
|
||||
|
||||
payload := pkt.Payload[2:]
|
||||
|
||||
for {
|
||||
if len(payload) < 2 {
|
||||
return false
|
||||
}
|
||||
|
||||
size := uint16(payload[0])<<8 | uint16(payload[1])
|
||||
payload = payload[2:]
|
||||
|
||||
@@ -167,6 +167,10 @@ func (f *H265) PTSEqualsDTS(pkt *rtp.Packet) bool {
|
||||
if len(payload) == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
if len(payload) < 2 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
case h265.NALUType_FragmentationUnit:
|
||||
|
Reference in New Issue
Block a user