[tsan] Guard audio_device_pulse_linux members from concurrent access.
This CL also fixes data races caused by tests themselves. TBR= henrika@webrtc.org Bug: webrtc:9751 Change-Id: Ie7c785b27142fd465f5b4dc9fb0628bd7274f1d2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146600 Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Commit-Queue: Yves Gerey <yvesg@google.com> Cr-Commit-Position: refs/heads/master@{#28829}
This commit is contained in:
@ -871,8 +871,11 @@ int32_t AudioDeviceLinuxPulse::InitPlayout() {
|
||||
playSampleSpec.rate = sample_rate_hz_;
|
||||
|
||||
// Create a new play stream
|
||||
_playStream =
|
||||
LATE(pa_stream_new)(_paContext, "playStream", &playSampleSpec, NULL);
|
||||
{
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_playStream =
|
||||
LATE(pa_stream_new)(_paContext, "playStream", &playSampleSpec, NULL);
|
||||
}
|
||||
|
||||
if (!_playStream) {
|
||||
RTC_LOG(LS_ERROR) << "failed to create play stream, err="
|
||||
@ -941,8 +944,11 @@ int32_t AudioDeviceLinuxPulse::InitPlayout() {
|
||||
LATE(pa_stream_set_state_callback)(_playStream, PaStreamStateCallback, this);
|
||||
|
||||
// Mark playout side as initialized
|
||||
_playIsInitialized = true;
|
||||
_sndCardPlayDelay = 0;
|
||||
{
|
||||
rtc::CritScope lock(&_critSect);
|
||||
_playIsInitialized = true;
|
||||
_sndCardPlayDelay = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user