Fix panic by CreateSenderReport before bind completed (#1397)

This commit is contained in:
cnderrauber
2023-02-08 17:02:19 +08:00
committed by GitHub
parent 4d8def2eb7
commit a04e7ce647
3 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -441,7 +441,7 @@ func (t *MediaTrackReceiver) AddSubscriber(sub types.LocalParticipant) (types.Su
}
tLogger := LoggerWithTrack(sub.GetLogger(), t.ID(), t.params.IsRelayed)
wrParams := NewWrappedReceiver(WrappedReceiverParams{
wr := NewWrappedReceiver(WrappedReceiverParams{
Receivers: receivers,
TrackID: t.ID(),
StreamId: streamId,
@@ -449,7 +449,7 @@ func (t *MediaTrackReceiver) AddSubscriber(sub types.LocalParticipant) (types.Su
Logger: tLogger,
DisableRed: t.trackInfo.GetDisableRed(),
})
return t.MediaTrackSubscriptions.AddSubscriber(sub, wrParams)
return t.MediaTrackSubscriptions.AddSubscriber(sub, wr)
}
// RemoveSubscriber removes participant from subscription
+1 -1
View File
@@ -127,7 +127,7 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
// Bind callback can happen from replaceTrack, so set it up early
var reusingTransceiver atomic.Bool
var dtState sfu.DownTrackState
downTrack.OnBind(func() {
downTrack.OnBinding(func() {
wr.DetermineReceiver(downTrack.Codec())
if reusingTransceiver.Load() {
downTrack.SeedState(dtState)