mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +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{
|
return &TrackAAC{
|
||||||
payloadType: payloadType,
|
payloadType: payloadType,
|
||||||
sampleRate: sampleRate,
|
typ: typ,
|
||||||
channelCount: channelCount,
|
sampleRate: sampleRate,
|
||||||
mpegConf: mpegConf,
|
channelCount: channelCount,
|
||||||
|
aotSpecificConfig: aotSpecificConfig,
|
||||||
|
mpegConf: mpegConf,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,8 +8,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestTrackAACNew(t *testing.T) {
|
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.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) {
|
func TestTrackAACNewFromMediaDescription(t *testing.T) {
|
||||||
@@ -39,6 +43,7 @@ func TestTrackAACNewFromMediaDescription(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&TrackAAC{
|
&TrackAAC{
|
||||||
payloadType: 96,
|
payloadType: 96,
|
||||||
|
typ: 2,
|
||||||
sampleRate: 48000,
|
sampleRate: 48000,
|
||||||
channelCount: 2,
|
channelCount: 2,
|
||||||
mpegConf: []byte{0x11, 0x90},
|
mpegConf: []byte{0x11, 0x90},
|
||||||
@@ -65,6 +70,7 @@ func TestTrackAACNewFromMediaDescription(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&TrackAAC{
|
&TrackAAC{
|
||||||
payloadType: 96,
|
payloadType: 96,
|
||||||
|
typ: 2,
|
||||||
sampleRate: 48000,
|
sampleRate: 48000,
|
||||||
channelCount: 2,
|
channelCount: 2,
|
||||||
mpegConf: []byte{0x11, 0x90},
|
mpegConf: []byte{0x11, 0x90},
|
||||||
|
@@ -165,19 +165,12 @@ func TestTrackH264GetSPSPPSErrors(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTrackH264New(t *testing.T) {
|
func TestTrackH264New(t *testing.T) {
|
||||||
_, err := NewTrackH264(96,
|
track, err := NewTrackH264(96,
|
||||||
[]byte{
|
[]byte{0x01, 0x02}, []byte{0x03, 0x04}, []byte{0x05, 0x06})
|
||||||
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,
|
|
||||||
})
|
|
||||||
require.NoError(t, err)
|
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) {
|
func TestTrackH264NewFromMediaDescription(t *testing.T) {
|
||||||
|
@@ -8,8 +8,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestTrackOpusNew(t *testing.T) {
|
func TestTrackOpusNew(t *testing.T) {
|
||||||
_, err := NewTrackOpus(96, 48000, 2)
|
track, err := NewTrackOpus(96, 48000, 2)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, 48000, track.sampleRate)
|
||||||
|
require.Equal(t, 2, track.channelCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTrackOpusNewFromMediaDescription(t *testing.T) {
|
func TestTrackOpusNewFromMediaDescription(t *testing.T) {
|
||||||
|
@@ -51,6 +51,7 @@ func TestTrackNewFromMediaDescription(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&TrackAAC{
|
&TrackAAC{
|
||||||
payloadType: 96,
|
payloadType: 96,
|
||||||
|
typ: 2,
|
||||||
sampleRate: 48000,
|
sampleRate: 48000,
|
||||||
channelCount: 2,
|
channelCount: 2,
|
||||||
mpegConf: []byte{0x11, 0x90},
|
mpegConf: []byte{0x11, 0x90},
|
||||||
@@ -77,6 +78,7 @@ func TestTrackNewFromMediaDescription(t *testing.T) {
|
|||||||
},
|
},
|
||||||
&TrackAAC{
|
&TrackAAC{
|
||||||
payloadType: 96,
|
payloadType: 96,
|
||||||
|
typ: 2,
|
||||||
sampleRate: 48000,
|
sampleRate: 48000,
|
||||||
channelCount: 2,
|
channelCount: 2,
|
||||||
mpegConf: []byte{0x11, 0x90},
|
mpegConf: []byte{0x11, 0x90},
|
||||||
|
Reference in New Issue
Block a user