Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Unified Diff: media/base/audio_renderer_mixer_input.h

Issue 1748183006: Add lock to fix race in AudioRendererMixerInput. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/audio_renderer_mixer_input.cc » ('j') | media/base/audio_renderer_mixer_input.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_renderer_mixer_input.h
diff --git a/media/base/audio_renderer_mixer_input.h b/media/base/audio_renderer_mixer_input.h
index 34f37c5ee00a3c0d0803ef4f807992942bbf8401..6ae5a4bcd76be784f9ac3e21aaa8415564456313 100644
--- a/media/base/audio_renderer_mixer_input.h
+++ b/media/base/audio_renderer_mixer_input.h
@@ -9,6 +9,8 @@
#include "base/callback.h"
#include "base/macros.h"
+#include "base/synchronization/lock.h"
+#include "base/threading/thread_checker.h"
#include "media/base/audio_converter.h"
#include "media/base/audio_renderer_sink.h"
#include "media/base/output_device.h"
@@ -69,6 +71,14 @@ class MEDIA_EXPORT AudioRendererMixerInput
private:
friend class AudioRendererMixerInputTest;
+ // Used to DCHECK that control methods (Start/Stop/Switch...) are called from
+ // the same thread.
+ base::ThreadChecker thread_checker_;
+
+ // Protect |volume_|, accessed by separate threads in ProvideInput() and
+ // SetVolume().
+ base::Lock volume_lock_;
+
bool started_;
bool playing_;
double volume_;
« no previous file with comments | « no previous file | media/base/audio_renderer_mixer_input.cc » ('j') | media/base/audio_renderer_mixer_input.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698