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" |
12 #include "media/base/audio_converter.h" | 13 #include "media/base/audio_converter.h" |
13 #include "media/base/audio_renderer_sink.h" | 14 #include "media/base/audio_renderer_sink.h" |
14 #include "media/base/output_device.h" | 15 #include "media/base/output_device.h" |
15 #include "url/origin.h" | 16 #include "url/origin.h" |
16 | 17 |
17 namespace media { | 18 namespace media { |
18 | 19 |
19 class AudioRendererMixer; | 20 class AudioRendererMixer; |
20 | 21 |
21 class MEDIA_EXPORT AudioRendererMixerInput | 22 class MEDIA_EXPORT AudioRendererMixerInput |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 63 |
63 // Called by AudioRendererMixer when an error occurs. | 64 // Called by AudioRendererMixer when an error occurs. |
64 void OnRenderError(); | 65 void OnRenderError(); |
65 | 66 |
66 protected: | 67 protected: |
67 ~AudioRendererMixerInput() override; | 68 ~AudioRendererMixerInput() override; |
68 | 69 |
69 private: | 70 private: |
70 friend class AudioRendererMixerInputTest; | 71 friend class AudioRendererMixerInputTest; |
71 | 72 |
| 73 // Protect |volume_|, accessed by separate threads in ProvideInput() and |
| 74 // SetVolume(). |
| 75 base::Lock volume_lock_; |
| 76 |
72 bool started_; | 77 bool started_; |
73 bool playing_; | 78 bool playing_; |
74 double volume_; | 79 double volume_; |
75 | 80 |
76 // AudioConverter::InputCallback implementation. | 81 // AudioConverter::InputCallback implementation. |
77 double ProvideInput(AudioBus* audio_bus, | 82 double ProvideInput(AudioBus* audio_bus, |
78 base::TimeDelta buffer_delay) override; | 83 base::TimeDelta buffer_delay) override; |
79 | 84 |
80 // Callbacks provided during construction which allow AudioRendererMixerInput | 85 // Callbacks provided during construction which allow AudioRendererMixerInput |
81 // to retrieve a mixer during Initialize() and notify when it's done with it. | 86 // to retrieve a mixer during Initialize() and notify when it's done with it. |
(...skipping 26 matching lines...) Expand all Loading... |
108 SwitchOutputDeviceCB pending_switch_callback_; | 113 SwitchOutputDeviceCB pending_switch_callback_; |
109 std::string pending_switch_device_id_; | 114 std::string pending_switch_device_id_; |
110 url::Origin pending_switch_security_origin_; | 115 url::Origin pending_switch_security_origin_; |
111 | 116 |
112 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput); | 117 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput); |
113 }; | 118 }; |
114 | 119 |
115 } // namespace media | 120 } // namespace media |
116 | 121 |
117 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ | 122 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ |
OLD | NEW |