This commit is contained in:
aler9
2022-02-01 19:09:56 +01:00
parent 5cf71f59d8
commit 0c9bd7a575
5 changed files with 35 additions and 5 deletions

View File

@@ -128,8 +128,10 @@ func (t *TrackAAC) clone() Track {
return &TrackAAC{
control: t.control,
payloadType: t.payloadType,
typ: t.typ,
sampleRate: t.sampleRate,
channelCount: t.channelCount,
aotSpecificConfig: t.aotSpecificConfig,
mpegConf: t.mpegConf,
}
}

View File

@@ -200,6 +200,15 @@ func TestTrackAACNewFromMediaDescriptionErrors(t *testing.T) {
}
}
func TestTrackAACClone(t *testing.T) {
track, err := NewTrackAAC(96, 2, 48000, 2, []byte{0x01, 0x02})
require.NoError(t, err)
copy := track.clone()
require.NotSame(t, track, copy)
require.Equal(t, track, copy)
}
func TestTrackAACMediaDescription(t *testing.T) {
track, err := NewTrackAAC(96, 2, 48000, 2, nil)
require.NoError(t, err)

View File

@@ -106,6 +106,7 @@ func (t *TrackH264) clone() Track {
payloadType: t.payloadType,
sps: t.sps,
pps: t.pps,
extradata: t.extradata,
}
}

View File

@@ -286,6 +286,15 @@ func TestTrackH264NewFromMediaDescription(t *testing.T) {
}
}
func TestTrackH264Clone(t *testing.T) {
track, err := NewTrackH264(96, []byte{0x01, 0x02}, []byte{0x03, 0x04}, []byte{0x05, 0x06})
require.NoError(t, err)
copy := track.clone()
require.NotSame(t, track, copy)
require.Equal(t, track, copy)
}
func TestTrackH264MediaDescription(t *testing.T) {
track, err := NewTrackH264(96,
[]byte{

View File

@@ -97,6 +97,15 @@ func TestTrackOpusNewFromMediaDescriptionErrors(t *testing.T) {
}
}
func TestTracOpusClone(t *testing.T) {
track, err := NewTrackOpus(96, 96000, 4)
require.NoError(t, err)
copy := track.clone()
require.NotSame(t, track, copy)
require.Equal(t, track, copy)
}
func TestTrackOpusMediaDescription(t *testing.T) {
track, err := NewTrackOpus(96, 48000, 2)
require.NoError(t, err)