Add a method to clear receiver. (#372)

With remote media track receiver starting/stopping/restarting possibly,
receiver should be cleared when stopped and will be re-initialized when
it is restarted.
This commit is contained in:
Raja Subramanian
2022-01-25 18:08:41 +05:30
committed by GitHub
parent b2cb93d9a4
commit bb26109096
+8
View File
@@ -90,6 +90,14 @@ func (t *MediaTrackReceiver) SetupReceiver(receiver sfu.TrackReceiver) {
t.MediaTrackSubscriptions.Start()
}
func (t *MediaTrackReceiver) ClearReceiver() {
t.lock.Lock()
t.receiver = nil
t.lock.Unlock()
t.MediaTrackSubscriptions.Close()
}
func (t *MediaTrackReceiver) OnMediaLossUpdate(f func(fractionalLoss uint8)) {
t.onMediaLossUpdate = f
}