change way tracks are initialized

A config object is now required to initialize tracks.
Config objects are provided for H264 and AAC.
This allows to pass parameters easily and treat AAC
parameters explicitly.
This commit is contained in:
aler9
2021-08-25 19:16:51 +02:00
parent accfc7cd5d
commit d744a2e0d3
13 changed files with 283 additions and 165 deletions

View File

@@ -633,7 +633,7 @@ func TestServerErrorInvalidMethod(t *testing.T) {
}
func TestServerErrorTCPTwoConnOneSession(t *testing.T) {
track, err := NewTrackH264(96, []byte("123456"), []byte("123456"))
track, err := NewTrackH264(96, &TrackConfigH264{[]byte{0x01, 0x02, 0x03, 0x04}, []byte{0x01, 0x02, 0x03, 0x04}})
require.NoError(t, err)
stream := NewServerStream(Tracks{track})
@@ -730,7 +730,7 @@ func TestServerErrorTCPTwoConnOneSession(t *testing.T) {
}
func TestServerErrorTCPOneConnTwoSessions(t *testing.T) {
track, err := NewTrackH264(96, []byte("123456"), []byte("123456"))
track, err := NewTrackH264(96, &TrackConfigH264{[]byte{0x01, 0x02, 0x03, 0x04}, []byte{0x01, 0x02, 0x03, 0x04}})
require.NoError(t, err)
stream := NewServerStream(Tracks{track})
@@ -989,7 +989,7 @@ func TestServerSessionClose(t *testing.T) {
func TestServerSessionAutoClose(t *testing.T) {
sessionClosed := make(chan struct{})
track, err := NewTrackH264(96, []byte("123456"), []byte("123456"))
track, err := NewTrackH264(96, &TrackConfigH264{[]byte{0x01, 0x02, 0x03, 0x04}, []byte{0x01, 0x02, 0x03, 0x04}})
require.NoError(t, err)
stream := NewServerStream(Tracks{track})
@@ -1055,7 +1055,7 @@ func TestServerErrorInvalidPath(t *testing.T) {
t.Run(string(method), func(t *testing.T) {
connClosed := make(chan struct{})
track, err := NewTrackH264(96, []byte("123456"), []byte("123456"))
track, err := NewTrackH264(96, &TrackConfigH264{[]byte{0x01, 0x02, 0x03, 0x04}, []byte{0x01, 0x02, 0x03, 0x04}})
require.NoError(t, err)
stream := NewServerStream(Tracks{track})
@@ -1096,7 +1096,7 @@ func TestServerErrorInvalidPath(t *testing.T) {
sxID := ""
if method == base.Record {
track, err := NewTrackH264(96, []byte("123456"), []byte("123456"))
track, err := NewTrackH264(96, &TrackConfigH264{[]byte{0x01, 0x02, 0x03, 0x04}, []byte{0x01, 0x02, 0x03, 0x04}})
require.NoError(t, err)
tracks := Tracks{track}