mirror of
https://github.com/pion/mediadevices.git
synced 2026-04-22 15:57:27 +08:00
fix track.unbind panic (#634)
Fix #633 Here the signalCh could have been closed by another goroutine, we should use returned signalCh from `track.removeActivePeerConnection()` to close the channel. Actually, I don't know why we need to close the signalCh, we're using it to send over the doneCh, why ever close it?
This commit is contained in:
@@ -203,8 +203,10 @@ func (track *baseTrack) bind(ctx webrtc.TrackLocalContext, specializedTrack Trac
|
||||
encodedReader.Close()
|
||||
|
||||
// When there's another call to unbind, it won't block since we remove the current ctx from active connections
|
||||
track.removeActivePeerConnection(ctx.ID())
|
||||
close(signalCh)
|
||||
signalCh := track.removeActivePeerConnection(ctx.ID())
|
||||
if signalCh != nil {
|
||||
close(signalCh)
|
||||
}
|
||||
if doneCh != nil {
|
||||
close(doneCh)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user