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 CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 19 matching lines...) Expand all Loading... |
30 } // namespace webrtc | 30 } // namespace webrtc |
31 | 31 |
32 namespace content { | 32 namespace content { |
33 | 33 |
34 class WebRtcAudioRendererSource; | 34 class WebRtcAudioRendererSource; |
35 | 35 |
36 // This renderer handles calls from the pipeline and WebRtc ADM. It is used | 36 // This renderer handles calls from the pipeline and WebRtc ADM. It is used |
37 // for connecting WebRtc MediaStream with the audio pipeline. | 37 // for connecting WebRtc MediaStream with the audio pipeline. |
38 class CONTENT_EXPORT WebRtcAudioRenderer | 38 class CONTENT_EXPORT WebRtcAudioRenderer |
39 : NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback), | 39 : NON_EXPORTED_BASE(public media::AudioRendererSink::RenderCallback), |
40 NON_EXPORTED_BASE(public MediaStreamAudioRenderer), | 40 NON_EXPORTED_BASE(public MediaStreamAudioRenderer) { |
41 NON_EXPORTED_BASE(public media::OutputDevice) { | |
42 public: | 41 public: |
43 // This is a little utility class that holds the configured state of an audio | 42 // This is a little utility class that holds the configured state of an audio |
44 // stream. | 43 // stream. |
45 // It is used by both WebRtcAudioRenderer and SharedAudioRenderer (see cc | 44 // It is used by both WebRtcAudioRenderer and SharedAudioRenderer (see cc |
46 // file) so a part of why it exists is to avoid code duplication and track | 45 // file) so a part of why it exists is to avoid code duplication and track |
47 // the state in the same way in WebRtcAudioRenderer and SharedAudioRenderer. | 46 // the state in the same way in WebRtcAudioRenderer and SharedAudioRenderer. |
48 class PlayingState : public base::NonThreadSafe { | 47 class PlayingState : public base::NonThreadSafe { |
49 public: | 48 public: |
50 PlayingState() : playing_(false), volume_(1.0f) {} | 49 PlayingState() : playing_(false), volume_(1.0f) {} |
51 | 50 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // callers to use proxy objects. | 114 // callers to use proxy objects. |
116 // TODO(tommi): Make the MediaStreamAudioRenderer implementation a pimpl? | 115 // TODO(tommi): Make the MediaStreamAudioRenderer implementation a pimpl? |
117 void Start() override; | 116 void Start() override; |
118 void Play() override; | 117 void Play() override; |
119 void Pause() override; | 118 void Pause() override; |
120 void Stop() override; | 119 void Stop() override; |
121 void SetVolume(float volume) override; | 120 void SetVolume(float volume) override; |
122 media::OutputDevice* GetOutputDevice() override; | 121 media::OutputDevice* GetOutputDevice() override; |
123 base::TimeDelta GetCurrentRenderTime() const override; | 122 base::TimeDelta GetCurrentRenderTime() const override; |
124 bool IsLocalRenderer() const override; | 123 bool IsLocalRenderer() const override; |
125 | |
126 // media::OutputDevice implementation | |
127 void SwitchOutputDevice(const std::string& device_id, | 124 void SwitchOutputDevice(const std::string& device_id, |
128 const url::Origin& security_origin, | 125 const url::Origin& security_origin, |
129 const media::SwitchOutputDeviceCB& callback) override; | 126 const media::SwitchOutputDeviceCB& callback) override; |
130 media::AudioParameters GetOutputParameters() override; | |
131 media::OutputDeviceStatus GetDeviceStatus() override; | |
132 | 127 |
133 // Called when an audio renderer, either the main or a proxy, starts playing. | 128 // Called when an audio renderer, either the main or a proxy, starts playing. |
134 // Here we maintain a reference count of how many renderers are currently | 129 // Here we maintain a reference count of how many renderers are currently |
135 // playing so that the shared play state of all the streams can be reflected | 130 // playing so that the shared play state of all the streams can be reflected |
136 // correctly. | 131 // correctly. |
137 void EnterPlayState(); | 132 void EnterPlayState(); |
138 | 133 |
139 // Called when an audio renderer, either the main or a proxy, is paused. | 134 // Called when an audio renderer, either the main or a proxy, is paused. |
140 // See EnterPlayState for more details. | 135 // See EnterPlayState for more details. |
141 void EnterPauseState(); | 136 void EnterPauseState(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // Used for triggering new UMA histogram. Counts number of render | 255 // Used for triggering new UMA histogram. Counts number of render |
261 // callbacks modulo |kNumCallbacksBetweenRenderTimeHistograms|. | 256 // callbacks modulo |kNumCallbacksBetweenRenderTimeHistograms|. |
262 int render_callback_count_; | 257 int render_callback_count_; |
263 | 258 |
264 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); | 259 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); |
265 }; | 260 }; |
266 | 261 |
267 } // namespace content | 262 } // namespace content |
268 | 263 |
269 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 264 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
OLD | NEW |