| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 // TODO(xians): Merge this interface with WebRtcAudioRendererSource. | 233 // TODO(xians): Merge this interface with WebRtcAudioRendererSource. |
| 234 // The reason why we could not do it today is that WebRtcAudioRendererSource | 234 // The reason why we could not do it today is that WebRtcAudioRendererSource |
| 235 // gets the data by pulling, while the data is pushed into | 235 // gets the data by pulling, while the data is pushed into |
| 236 // WebRtcPlayoutDataSource::Sink. | 236 // WebRtcPlayoutDataSource::Sink. |
| 237 class WebRtcPlayoutDataSource { | 237 class WebRtcPlayoutDataSource { |
| 238 public: | 238 public: |
| 239 class Sink { | 239 class Sink { |
| 240 public: | 240 public: |
| 241 // Callback to get the playout data. | 241 // Callback to get the playout data. |
| 242 // Called on the render audio thread. |
| 242 virtual void OnPlayoutData(media::AudioBus* audio_bus, | 243 virtual void OnPlayoutData(media::AudioBus* audio_bus, |
| 243 int sample_rate, | 244 int sample_rate, |
| 244 int audio_delay_milliseconds) = 0; | 245 int audio_delay_milliseconds) = 0; |
| 246 |
| 247 // Callback to notify the sink that the source has changed. |
| 248 // Called on the main render thread. |
| 249 virtual void OnPlayoutDataSourceChanged() = 0; |
| 250 |
| 245 protected: | 251 protected: |
| 246 virtual ~Sink() {} | 252 virtual ~Sink() {} |
| 247 }; | 253 }; |
| 248 | 254 |
| 249 // Adds/Removes the sink of WebRtcAudioRendererSource to the ADM. | 255 // Adds/Removes the sink of WebRtcAudioRendererSource to the ADM. |
| 250 // These methods are used by the MediaStreamAudioProcesssor to get the | 256 // These methods are used by the MediaStreamAudioProcesssor to get the |
| 251 // rendered data for AEC. | 257 // rendered data for AEC. |
| 252 virtual void AddPlayoutSink(Sink* sink) = 0; | 258 virtual void AddPlayoutSink(Sink* sink) = 0; |
| 253 virtual void RemovePlayoutSink(Sink* sink) = 0; | 259 virtual void RemovePlayoutSink(Sink* sink) = 0; |
| 254 | 260 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 // Buffer used for temporary storage during render callback. | 436 // Buffer used for temporary storage during render callback. |
| 431 // It is only accessed by the audio render thread. | 437 // It is only accessed by the audio render thread. |
| 432 std::vector<int16> render_buffer_; | 438 std::vector<int16> render_buffer_; |
| 433 | 439 |
| 434 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); | 440 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); |
| 435 }; | 441 }; |
| 436 | 442 |
| 437 } // namespace content | 443 } // namespace content |
| 438 | 444 |
| 439 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 445 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
| OLD | NEW |