Index: media/audio/win/waveout_output_win.cc |
diff --git a/media/audio/win/waveout_output_win.cc b/media/audio/win/waveout_output_win.cc |
index 12b4251d5ef671b11a2203bc2ee903e8f51792d9..5e56169a4db67d213a21e086f34777681de1209e 100644 |
--- a/media/audio/win/waveout_output_win.cc |
+++ b/media/audio/win/waveout_output_win.cc |
@@ -278,6 +278,9 @@ void PCMWaveOutAudioOutputStream::Stop() { |
return; |
} |
+ // Wait for lock to ensure all outstanding callbacks have completed. |
+ base::AutoLock auto_lock(lock_); |
+ |
// waveOutReset() leaves buffers in the unpredictable state, causing |
// problems if we want to close, release, or reuse them. Fix the states. |
for (int ix = 0; ix != num_buffers_; ++ix) { |