mirror of
https://github.com/pion/webrtc.git
synced 2025-10-05 15:16:52 +08:00
Take Track write Lock in NewRTPSender
Track is locking for reading when actually writing is taking place
This commit is contained in:
@@ -131,6 +131,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu
|
||||
* [David Hamilton](https://github.com/dihamilton)
|
||||
* [Ilya Mayorov](https://github.com/faroyam)
|
||||
* [Patrick Lange](https://github.com/langep)
|
||||
* [cyannuk](https://github.com/cyannuk)
|
||||
|
||||
### License
|
||||
MIT License - see [LICENSE](LICENSE) for full text
|
||||
|
@@ -33,8 +33,8 @@ func (api *API) NewRTPSender(track *Track, transport *DTLSTransport) (*RTPSender
|
||||
return nil, fmt.Errorf("DTLSTransport must not be nil")
|
||||
}
|
||||
|
||||
track.mu.RLock()
|
||||
defer track.mu.RUnlock()
|
||||
track.mu.Lock()
|
||||
defer track.mu.Unlock()
|
||||
if track.receiver != nil {
|
||||
return nil, fmt.Errorf("RTPSender can not be constructed with remote track")
|
||||
}
|
||||
|
Reference in New Issue
Block a user