OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_DEVICE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 // TODO(xians): Merge this interface with WebRtcAudioRendererSource. | 213 // TODO(xians): Merge this interface with WebRtcAudioRendererSource. |
214 // The reason why we could not do it today is that WebRtcAudioRendererSource | 214 // The reason why we could not do it today is that WebRtcAudioRendererSource |
215 // gets the data by pulling, while the data is pushed into | 215 // gets the data by pulling, while the data is pushed into |
216 // WebRtcPlayoutDataSource::Sink. | 216 // WebRtcPlayoutDataSource::Sink. |
217 class WebRtcPlayoutDataSource { | 217 class WebRtcPlayoutDataSource { |
218 public: | 218 public: |
219 class Sink { | 219 class Sink { |
220 public: | 220 public: |
221 // Callback to get the playout data. | 221 // Callback to get the playout data. |
222 // Called on the render audio thread. | 222 // Called on the audio render thread. |
223 virtual void OnPlayoutData(media::AudioBus* audio_bus, | 223 virtual void OnPlayoutData(media::AudioBus* audio_bus, |
224 int sample_rate, | 224 int sample_rate, |
225 int audio_delay_milliseconds) = 0; | 225 int audio_delay_milliseconds) = 0; |
226 | 226 |
227 // Callback to notify the sink that the source has changed. | 227 // Callback to notify the sink that the source has changed. |
228 // Called on the main render thread. | 228 // Called on the main render thread. |
229 virtual void OnPlayoutDataSourceChanged() = 0; | 229 virtual void OnPlayoutDataSourceChanged() = 0; |
230 | 230 |
| 231 // Called to notify that the audio render thread has changed, and |
| 232 // OnPlayoutData() will from now on be called on the new thread. |
| 233 // Called on the new audio render thread. |
| 234 virtual void OnRenderThreadChanged() = 0; |
| 235 |
231 protected: | 236 protected: |
232 virtual ~Sink() {} | 237 virtual ~Sink() {} |
233 }; | 238 }; |
234 | 239 |
235 // Adds/Removes the sink of WebRtcAudioRendererSource to the ADM. | 240 // Adds/Removes the sink of WebRtcAudioRendererSource to the ADM. |
236 // These methods are used by the MediaStreamAudioProcesssor to get the | 241 // These methods are used by the MediaStreamAudioProcesssor to get the |
237 // rendered data for AEC. | 242 // rendered data for AEC. |
238 virtual void AddPlayoutSink(Sink* sink) = 0; | 243 virtual void AddPlayoutSink(Sink* sink) = 0; |
239 virtual void RemovePlayoutSink(Sink* sink) = 0; | 244 virtual void RemovePlayoutSink(Sink* sink) = 0; |
240 | 245 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 // Buffer used for temporary storage during render callback. | 404 // Buffer used for temporary storage during render callback. |
400 // It is only accessed by the audio render thread. | 405 // It is only accessed by the audio render thread. |
401 std::vector<int16_t> render_buffer_; | 406 std::vector<int16_t> render_buffer_; |
402 | 407 |
403 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); | 408 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); |
404 }; | 409 }; |
405 | 410 |
406 } // namespace content | 411 } // namespace content |
407 | 412 |
408 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 413 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
OLD | NEW |