Commit 0704833d authored by olka's avatar olka Committed by Commit bot

Adding syncrhonization to PulseAudioOutputStream::SetVolume

to avoid a race with rendering callback (https://cs.chromium.org/chromium/src/media/audio/pulse/pulse_output.cc?sq=package:chromium&rcl=1475536681&l=148)

BUG=285242

Review-Url: https://codereview.chromium.org/2394483002
Cr-Commit-Position: refs/heads/master@{#422845}
parent e462f7cc
...@@ -227,6 +227,9 @@ void PulseAudioOutputStream::Stop() { ...@@ -227,6 +227,9 @@ void PulseAudioOutputStream::Stop() {
void PulseAudioOutputStream::SetVolume(double volume) { void PulseAudioOutputStream::SetVolume(double volume) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
// Waiting for the main loop lock will ensure outstanding callbacks have
// completed and |volume_| is not accessed from them.
AutoPulseLock auto_lock(pa_mainloop_);
volume_ = static_cast<float>(volume); volume_ = static_cast<float>(volume);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment