Pass along mime type with TrackInfo (#292)
This commit is contained in:
+15
-14
@@ -6,13 +6,14 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/livekit/protocol/auth"
|
||||
"github.com/pion/webrtc/v3"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/rtc"
|
||||
"github.com/livekit/livekit-server/pkg/testutils"
|
||||
testclient "github.com/livekit/livekit-server/test/client"
|
||||
"github.com/livekit/protocol/auth"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/pion/webrtc/v3"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/thoas/go-funk"
|
||||
)
|
||||
|
||||
func TestClientCouldConnect(t *testing.T) {
|
||||
@@ -124,14 +125,14 @@ func TestSinglePublisher(t *testing.T) {
|
||||
waitUntilConnected(t, c1, c2)
|
||||
|
||||
// publish a track and ensure clients receive it ok
|
||||
t1, err := c1.AddStaticTrack("audio/opus", "audio", "webcam")
|
||||
t1, err := c1.AddStaticTrack("audio/opus", "audio", "webcamaudio")
|
||||
require.NoError(t, err)
|
||||
defer t1.Stop()
|
||||
t2, err := c1.AddStaticTrack("video/vp8", "video", "webcam")
|
||||
t2, err := c1.AddStaticTrack("video/vp8", "video", "webcamvideo")
|
||||
require.NoError(t, err)
|
||||
defer t2.Stop()
|
||||
|
||||
success := testutils.WithTimeout(t, "c2 should receive two tracks", func() bool {
|
||||
testutils.WithTimeout(t, "c2 should receive two tracks", func() bool {
|
||||
if len(c2.SubscribedTracks()) == 0 {
|
||||
return false
|
||||
}
|
||||
@@ -145,16 +146,19 @@ func TestSinglePublisher(t *testing.T) {
|
||||
require.Equal(t, c1.ID(), participantId)
|
||||
return true
|
||||
})
|
||||
if !success {
|
||||
t.FailNow()
|
||||
}
|
||||
// ensure mime type is received
|
||||
remoteC1 := c2.GetRemoteParticipant(c1.ID())
|
||||
audioTrack := funk.Find(remoteC1.Tracks, func(ti *livekit.TrackInfo) bool {
|
||||
return ti.Name == "webcamaudio"
|
||||
}).(*livekit.TrackInfo)
|
||||
require.Equal(t, "audio/opus", audioTrack.MimeType)
|
||||
|
||||
// a new client joins and should get the initial stream
|
||||
c3 := createRTCClient("c3", defaultServerPort, nil)
|
||||
|
||||
// ensure that new client that has joined also received tracks
|
||||
waitUntilConnected(t, c3)
|
||||
success = testutils.WithTimeout(t, "c3 should receive two tracks", func() bool {
|
||||
testutils.WithTimeout(t, "c3 should receive two tracks", func() bool {
|
||||
if len(c3.SubscribedTracks()) == 0 {
|
||||
return false
|
||||
}
|
||||
@@ -164,9 +168,6 @@ func TestSinglePublisher(t *testing.T) {
|
||||
}
|
||||
return true
|
||||
})
|
||||
if !success {
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
// ensure that the track ids are generated by server
|
||||
tracks := c3.SubscribedTracks()[c1.ID()]
|
||||
|
||||
Reference in New Issue
Block a user