Fix panic by CreateSenderReport before bind completed (#1397)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user