diff --git a/track_aac.go b/track_aac.go index 75e3d240..a371ae00 100644 --- a/track_aac.go +++ b/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 } diff --git a/track_aac_test.go b/track_aac_test.go index 2cd0a8a3..6d97342b 100644 --- a/track_aac_test.go +++ b/track_aac_test.go @@ -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}, diff --git a/track_h264_test.go b/track_h264_test.go index d16274ff..8a5d1628 100644 --- a/track_h264_test.go +++ b/track_h264_test.go @@ -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) { diff --git a/track_opus_test.go b/track_opus_test.go index 653cc4f2..f3932615 100644 --- a/track_opus_test.go +++ b/track_opus_test.go @@ -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) { diff --git a/track_test.go b/track_test.go index aa34e42c..6d07945f 100644 --- a/track_test.go +++ b/track_test.go @@ -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},