uptrackmanager reuse (#318)

* WIP commit

* Remove the double lock

* Remove unused variable

* WIP commit

* Fix test

* WIP commit

* Split out MediaTrackReceiver

* Address comments from David
This commit is contained in:
Raja Subramanian
2022-01-09 10:45:49 +05:30
committed by GitHub
parent 8582ca4c9b
commit a9e0598210
12 changed files with 1007 additions and 866 deletions
+6 -4
View File
@@ -80,7 +80,8 @@ func TestTrackPublishing(t *testing.T) {
p.OnTrackPublished(func(p types.Participant, track types.PublishedTrack) {
published = true
})
p.UptrackManager.handleTrackPublished(track)
p.LocalParticipant.AddPublishedTrack(track)
p.LocalParticipant.handleTrackPublished(track)
require.True(t, published)
require.False(t, updated)
@@ -202,7 +203,8 @@ func TestDisconnectTiming(t *testing.T) {
}
}()
track := &typesfakes.FakePublishedTrack{}
p.UptrackManager.handleTrackPublished(track)
p.LocalParticipant.AddPublishedTrack(track)
p.LocalParticipant.handleTrackPublished(track)
// close channel and then try to Negotiate
msg.Close()
@@ -220,7 +222,7 @@ func TestMuteSetting(t *testing.T) {
t.Run("can set mute when track is pending", func(t *testing.T) {
p := newParticipantForTest("test")
ti := &livekit.TrackInfo{Sid: "testTrack"}
p.UptrackManager.pendingTracks["cid"] = &pendingTrackInfo{TrackInfo: ti}
p.LocalParticipant.pendingTracks["cid"] = &pendingTrackInfo{TrackInfo: ti}
p.SetTrackMuted(livekit.TrackID(ti.Sid), true, false)
require.True(t, ti.Muted)
@@ -234,7 +236,7 @@ func TestMuteSetting(t *testing.T) {
Muted: true,
})
_, ti := p.UptrackManager.getPendingTrack("cid", livekit.TrackType_AUDIO)
_, ti := p.LocalParticipant.getPendingTrack("cid", livekit.TrackType_AUDIO)
require.NotNil(t, ti)
require.True(t, ti.Muted)
})