mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 23:26:54 +08:00
fix tests
This commit is contained in:
10
track_aac.go
10
track_aac.go
@@ -37,10 +37,12 @@ func NewTrackAAC(payloadType uint8, typ int, sampleRate int,
|
||||
}
|
||||
|
||||
return &TrackAAC{
|
||||
payloadType: payloadType,
|
||||
sampleRate: sampleRate,
|
||||
channelCount: channelCount,
|
||||
mpegConf: mpegConf,
|
||||
payloadType: payloadType,
|
||||
typ: typ,
|
||||
sampleRate: sampleRate,
|
||||
channelCount: channelCount,
|
||||
aotSpecificConfig: aotSpecificConfig,
|
||||
mpegConf: mpegConf,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@@ -8,8 +8,12 @@ import (
|
||||
)
|
||||
|
||||
func TestTrackAACNew(t *testing.T) {
|
||||
_, err := NewTrackAAC(96, 2, 48000, 2, nil)
|
||||
track, err := NewTrackAAC(96, 2, 48000, 4, []byte{0x01, 0x02})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, track.typ)
|
||||
require.Equal(t, 48000, track.sampleRate)
|
||||
require.Equal(t, 4, track.channelCount)
|
||||
require.Equal(t, []byte{0x01, 0x02}, track.aotSpecificConfig)
|
||||
}
|
||||
|
||||
func TestTrackAACNewFromMediaDescription(t *testing.T) {
|
||||
@@ -39,6 +43,7 @@ func TestTrackAACNewFromMediaDescription(t *testing.T) {
|
||||
},
|
||||
&TrackAAC{
|
||||
payloadType: 96,
|
||||
typ: 2,
|
||||
sampleRate: 48000,
|
||||
channelCount: 2,
|
||||
mpegConf: []byte{0x11, 0x90},
|
||||
@@ -65,6 +70,7 @@ func TestTrackAACNewFromMediaDescription(t *testing.T) {
|
||||
},
|
||||
&TrackAAC{
|
||||
payloadType: 96,
|
||||
typ: 2,
|
||||
sampleRate: 48000,
|
||||
channelCount: 2,
|
||||
mpegConf: []byte{0x11, 0x90},
|
||||
|
@@ -165,19 +165,12 @@ func TestTrackH264GetSPSPPSErrors(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTrackH264New(t *testing.T) {
|
||||
_, err := NewTrackH264(96,
|
||||
[]byte{
|
||||
0x67, 0x64, 0x00, 0x0c, 0xac, 0x3b, 0x50, 0xb0,
|
||||
0x4b, 0x42, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00,
|
||||
0x00, 0x03, 0x00, 0x3d, 0x08,
|
||||
},
|
||||
[]byte{
|
||||
0x68, 0xee, 0x3c, 0x80,
|
||||
},
|
||||
[]byte{
|
||||
0x01, 0x02,
|
||||
})
|
||||
track, err := NewTrackH264(96,
|
||||
[]byte{0x01, 0x02}, []byte{0x03, 0x04}, []byte{0x05, 0x06})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []byte{0x01, 0x02}, track.sps)
|
||||
require.Equal(t, []byte{0x03, 0x04}, track.pps)
|
||||
require.Equal(t, []byte{0x05, 0x06}, track.extradata)
|
||||
}
|
||||
|
||||
func TestTrackH264NewFromMediaDescription(t *testing.T) {
|
||||
|
@@ -8,8 +8,10 @@ import (
|
||||
)
|
||||
|
||||
func TestTrackOpusNew(t *testing.T) {
|
||||
_, err := NewTrackOpus(96, 48000, 2)
|
||||
track, err := NewTrackOpus(96, 48000, 2)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 48000, track.sampleRate)
|
||||
require.Equal(t, 2, track.channelCount)
|
||||
}
|
||||
|
||||
func TestTrackOpusNewFromMediaDescription(t *testing.T) {
|
||||
|
@@ -51,6 +51,7 @@ func TestTrackNewFromMediaDescription(t *testing.T) {
|
||||
},
|
||||
&TrackAAC{
|
||||
payloadType: 96,
|
||||
typ: 2,
|
||||
sampleRate: 48000,
|
||||
channelCount: 2,
|
||||
mpegConf: []byte{0x11, 0x90},
|
||||
@@ -77,6 +78,7 @@ func TestTrackNewFromMediaDescription(t *testing.T) {
|
||||
},
|
||||
&TrackAAC{
|
||||
payloadType: 96,
|
||||
typ: 2,
|
||||
sampleRate: 48000,
|
||||
channelCount: 2,
|
||||
mpegConf: []byte{0x11, 0x90},
|
||||
|
Reference in New Issue
Block a user