mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 23:26:54 +08:00
improve NALU size limit errors (#741)
This commit is contained in:
@@ -143,11 +143,12 @@ func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, error) {
|
||||
l := len(obus)
|
||||
|
||||
if (d.frameBufferLen + l) > av1.MaxOBUsPerTemporalUnit {
|
||||
errCount := d.frameBufferLen + l
|
||||
d.frameBuffer = nil
|
||||
d.frameBufferLen = 0
|
||||
d.frameBufferSize = 0
|
||||
return nil, fmt.Errorf("OBU count exceeds maximum allowed (%d)",
|
||||
av1.MaxOBUsPerTemporalUnit)
|
||||
return nil, fmt.Errorf("OBU count (%d) exceeds maximum allowed (%d)",
|
||||
errCount, av1.MaxOBUsPerTemporalUnit)
|
||||
}
|
||||
|
||||
addSize := 0
|
||||
|
@@ -52,7 +52,7 @@ func TestDecoderErrorLimit(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
require.EqualError(t, err, "OBU count exceeds maximum allowed (10)")
|
||||
require.EqualError(t, err, "OBU count (11) exceeds maximum allowed (10)")
|
||||
}
|
||||
|
||||
func TestDecodeErrorMissingPacket(t *testing.T) {
|
||||
|
@@ -215,11 +215,12 @@ func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, error) {
|
||||
l := len(nalus)
|
||||
|
||||
if (d.frameBufferLen + l) > h264.MaxNALUsPerAccessUnit {
|
||||
errCount := d.frameBufferLen + l
|
||||
d.frameBuffer = nil
|
||||
d.frameBufferLen = 0
|
||||
d.frameBufferSize = 0
|
||||
return nil, fmt.Errorf("NALU count exceeds maximum allowed (%d)",
|
||||
h264.MaxNALUsPerAccessUnit)
|
||||
return nil, fmt.Errorf("NALU count (%d) exceeds maximum allowed (%d)",
|
||||
errCount, h264.MaxNALUsPerAccessUnit)
|
||||
}
|
||||
|
||||
addSize := 0
|
||||
|
@@ -241,7 +241,7 @@ func TestDecoderErrorLimit(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
require.EqualError(t, err, "NALU count exceeds maximum allowed (25)")
|
||||
require.EqualError(t, err, "NALU count (26) exceeds maximum allowed (25)")
|
||||
}
|
||||
|
||||
func TestDecodeErrorMissingPacket(t *testing.T) {
|
||||
|
@@ -174,11 +174,12 @@ func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, error) {
|
||||
l := len(nalus)
|
||||
|
||||
if (d.frameBufferLen + l) > h265.MaxNALUsPerAccessUnit {
|
||||
errCount := d.frameBufferLen + l
|
||||
d.frameBuffer = nil
|
||||
d.frameBufferLen = 0
|
||||
d.frameBufferSize = 0
|
||||
return nil, fmt.Errorf("NALU count exceeds maximum allowed (%d)",
|
||||
h265.MaxNALUsPerAccessUnit)
|
||||
return nil, fmt.Errorf("NALU count (%d) exceeds maximum allowed (%d)",
|
||||
errCount, h265.MaxNALUsPerAccessUnit)
|
||||
}
|
||||
|
||||
addSize := 0
|
||||
|
@@ -58,7 +58,7 @@ func TestDecoderErrorLimit(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
require.EqualError(t, err, "NALU count exceeds maximum allowed (21)")
|
||||
require.EqualError(t, err, "NALU count (22) exceeds maximum allowed (21)")
|
||||
}
|
||||
|
||||
func TestDecodeErrorMissingPacket(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user