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:
@@ -90,6 +90,14 @@ func (t *MediaTrackReceiver) SetupReceiver(receiver sfu.TrackReceiver) {
|
|||||||
t.MediaTrackSubscriptions.Start()
|
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)) {
|
func (t *MediaTrackReceiver) OnMediaLossUpdate(f func(fractionalLoss uint8)) {
|
||||||
t.onMediaLossUpdate = f
|
t.onMediaLossUpdate = f
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user