mirror of
https://github.com/pion/webrtc.git
synced 2025-10-05 23:26:58 +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)
|
* [David Hamilton](https://github.com/dihamilton)
|
||||||
* [Ilya Mayorov](https://github.com/faroyam)
|
* [Ilya Mayorov](https://github.com/faroyam)
|
||||||
* [Patrick Lange](https://github.com/langep)
|
* [Patrick Lange](https://github.com/langep)
|
||||||
|
* [cyannuk](https://github.com/cyannuk)
|
||||||
|
|
||||||
### License
|
### License
|
||||||
MIT License - see [LICENSE](LICENSE) for full text
|
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")
|
return nil, fmt.Errorf("DTLSTransport must not be nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
track.mu.RLock()
|
track.mu.Lock()
|
||||||
defer track.mu.RUnlock()
|
defer track.mu.Unlock()
|
||||||
if track.receiver != nil {
|
if track.receiver != nil {
|
||||||
return nil, fmt.Errorf("RTPSender can not be constructed with remote track")
|
return nil, fmt.Errorf("RTPSender can not be constructed with remote track")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user