OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ | 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ |
6 #define MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ | 6 #define MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/synchronization/lock.h" | |
13 #include "base/threading/thread_checker.h" | |
14 #include "media/base/audio_converter.h" | 12 #include "media/base/audio_converter.h" |
15 #include "media/base/audio_renderer_sink.h" | 13 #include "media/base/audio_renderer_sink.h" |
16 #include "media/base/output_device.h" | 14 #include "media/base/output_device.h" |
17 #include "url/origin.h" | 15 #include "url/origin.h" |
18 | 16 |
19 namespace media { | 17 namespace media { |
20 | 18 |
21 class AudioRendererMixer; | 19 class AudioRendererMixer; |
22 | 20 |
23 class MEDIA_EXPORT AudioRendererMixerInput | 21 class MEDIA_EXPORT AudioRendererMixerInput |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 62 |
65 // Called by AudioRendererMixer when an error occurs. | 63 // Called by AudioRendererMixer when an error occurs. |
66 void OnRenderError(); | 64 void OnRenderError(); |
67 | 65 |
68 protected: | 66 protected: |
69 ~AudioRendererMixerInput() override; | 67 ~AudioRendererMixerInput() override; |
70 | 68 |
71 private: | 69 private: |
72 friend class AudioRendererMixerInputTest; | 70 friend class AudioRendererMixerInputTest; |
73 | 71 |
74 // Used to DCHECK that control methods (Start/Stop/Switch...) are called from | |
75 // the same thread. | |
76 base::ThreadChecker thread_checker_; | |
77 | |
78 // Protect |volume_|, accessed by separate threads in ProvideInput() and | |
79 // SetVolume(). | |
80 base::Lock volume_lock_; | |
81 | |
82 bool started_; | 72 bool started_; |
83 bool playing_; | 73 bool playing_; |
84 double volume_; | 74 double volume_; |
85 | 75 |
86 // AudioConverter::InputCallback implementation. | 76 // AudioConverter::InputCallback implementation. |
87 double ProvideInput(AudioBus* audio_bus, | 77 double ProvideInput(AudioBus* audio_bus, |
88 base::TimeDelta buffer_delay) override; | 78 base::TimeDelta buffer_delay) override; |
89 | 79 |
90 // Callbacks provided during construction which allow AudioRendererMixerInput | 80 // Callbacks provided during construction which allow AudioRendererMixerInput |
91 // to retrieve a mixer during Initialize() and notify when it's done with it. | 81 // to retrieve a mixer during Initialize() and notify when it's done with it. |
(...skipping 26 matching lines...) Expand all Loading... |
118 SwitchOutputDeviceCB pending_switch_callback_; | 108 SwitchOutputDeviceCB pending_switch_callback_; |
119 std::string pending_switch_device_id_; | 109 std::string pending_switch_device_id_; |
120 url::Origin pending_switch_security_origin_; | 110 url::Origin pending_switch_security_origin_; |
121 | 111 |
122 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput); | 112 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput); |
123 }; | 113 }; |
124 | 114 |
125 } // namespace media | 115 } // namespace media |
126 | 116 |
127 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ | 117 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ |
OLD | NEW |