mirror of
https://github.com/aler9/gortsplib
synced 2025-10-07 08:01:14 +08:00
rtph264: support streams that encode NALUs into Annex-B
(https://github.com/aler9/rtsp-simple-server/issues/1029)
This commit is contained in:
@@ -418,6 +418,35 @@ func TestDecodeSTAPAWithPadding(t *testing.T) {
|
||||
}, nalus)
|
||||
}
|
||||
|
||||
func TestDecodeAnnexB(t *testing.T) {
|
||||
d := &Decoder{}
|
||||
d.Init()
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
nalus, _, err := d.Decode(&rtp.Packet{
|
||||
Header: rtp.Header{
|
||||
Version: 2,
|
||||
Marker: true,
|
||||
PayloadType: 96,
|
||||
SequenceNumber: 17647,
|
||||
Timestamp: 2289531307,
|
||||
SSRC: 0x9dbb7812,
|
||||
},
|
||||
Payload: mergeBytes(
|
||||
[]byte{0x00, 0x00, 0x00, 0x01},
|
||||
[]byte{0x01, 0x02, 0x03, 0x04},
|
||||
[]byte{0x00, 0x00, 0x00, 0x01},
|
||||
[]byte{0x01, 0x02, 0x03, 0x04},
|
||||
),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, [][]byte{
|
||||
{0x01, 0x02, 0x03, 0x04},
|
||||
{0x01, 0x02, 0x03, 0x04},
|
||||
}, nalus)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeErrors(t *testing.T) {
|
||||
for _, ca := range []struct {
|
||||
name string
|
||||
|
Reference in New Issue
Block a user