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..4a0165781918bf2c7eec902236123d69d94eb688 100644 |
--- a/media/base/audio_renderer_mixer_input.h |
+++ b/media/base/audio_renderer_mixer_input.h |
@@ -9,6 +9,7 @@ |
#include "base/callback.h" |
#include "base/macros.h" |
+#include "base/synchronization/lock.h" |
#include "media/base/audio_converter.h" |
#include "media/base/audio_renderer_sink.h" |
#include "media/base/output_device.h" |
@@ -69,13 +70,30 @@ class MEDIA_EXPORT AudioRendererMixerInput |
private: |
friend class AudioRendererMixerInputTest; |
+ // AudioConverter::InputCallback implementation. |
+ double ProvideInput(AudioBus* audio_bus, |
+ base::TimeDelta buffer_delay) override; |
+ |
+ // The implementation for these methods is split out to avoid re-entrant |
+ // locking when called by multiple internal callers. Re-entrant locking is |
+ // not supported with base::Lock. |
+ void Stop_Locked(); |
+ void Play_Locked(); |
+ void Pause_Locked(); |
+ void SwitchOutputDevice_Locked(const std::string& device_id, |
+ const url::Origin& security_origin, |
+ const SwitchOutputDeviceCB& callback); |
+ |
+ // This class is used by both media thread (e.g. SetVolume) and audio device |
+ // thread (e.g. ProvideInput). |
+ base::Lock lock_; |
+ |
+ // ---------------[ All variables below protected by |lock_| ]--------------- |
+ |
bool started_; |
bool playing_; |
double volume_; |
- // AudioConverter::InputCallback implementation. |
- double ProvideInput(AudioBus* audio_bus, |
- base::TimeDelta buffer_delay) override; |
// Callbacks provided during construction which allow AudioRendererMixerInput |
// to retrieve a mixer during Initialize() and notify when it's done with it. |