Update streamer NewTrack function

This commit is contained in:
Alexey Khit
2023-03-04 06:17:04 +03:00
parent c2cdf60ffc
commit 5aa20f0845
17 changed files with 73 additions and 24 deletions
+21
View File
@@ -1,8 +1,10 @@
package streamer
import (
"fmt"
"github.com/pion/sdp/v3"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"net/url"
"testing"
)
@@ -40,3 +42,22 @@ func TestParseQuery(t *testing.T) {
}, medias)
}
}
func TestClone(t *testing.T) {
media1 := &Media{
Kind: KindVideo,
Direction: DirectionRecvonly,
Codecs: []*Codec{
{Name: CodecPCMU, ClockRate: 8000},
},
}
media2 := media1.Clone()
p1 := fmt.Sprintf("%p", media1)
p2 := fmt.Sprintf("%p", media2)
require.NotEqualValues(t, p1, p2)
p3 := fmt.Sprintf("%p", media1.Codecs[0])
p4 := fmt.Sprintf("%p", media2.Codecs[0])
require.NotEqualValues(t, p3, p4)
}