mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
fix track.clone() (https://github.com/aler9/rtsp-simple-server/issues/808)
This commit is contained in:
12
track_aac.go
12
track_aac.go
@@ -126,11 +126,13 @@ func (t *TrackAAC) AOTSpecificConfig() []byte {
|
||||
|
||||
func (t *TrackAAC) clone() Track {
|
||||
return &TrackAAC{
|
||||
control: t.control,
|
||||
payloadType: t.payloadType,
|
||||
sampleRate: t.sampleRate,
|
||||
channelCount: t.channelCount,
|
||||
mpegConf: t.mpegConf,
|
||||
control: t.control,
|
||||
payloadType: t.payloadType,
|
||||
typ: t.typ,
|
||||
sampleRate: t.sampleRate,
|
||||
channelCount: t.channelCount,
|
||||
aotSpecificConfig: t.aotSpecificConfig,
|
||||
mpegConf: t.mpegConf,
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -106,6 +106,7 @@ func (t *TrackH264) clone() Track {
|
||||
payloadType: t.payloadType,
|
||||
sps: t.sps,
|
||||
pps: t.pps,
|
||||
extradata: t.extradata,
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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{
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user