Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: content/renderer/media/webrtc_audio_device_impl.h

Issue 1528473003: Feed the WebRTC APM with empty far-end frames for the number of frames skipped by OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review. Rebase. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 class WebRtcAudioRenderer; 185 class WebRtcAudioRenderer;
186 186
187 // TODO(xians): Move the following two interfaces to webrtc so that 187 // TODO(xians): Move the following two interfaces to webrtc so that
188 // libjingle can own references to the renderer and capturer. 188 // libjingle can own references to the renderer and capturer.
189 class WebRtcAudioRendererSource { 189 class WebRtcAudioRendererSource {
190 public: 190 public:
191 // Callback to get the rendered data. 191 // Callback to get the rendered data.
192 virtual void RenderData(media::AudioBus* audio_bus, 192 virtual void RenderData(media::AudioBus* audio_bus,
193 int sample_rate, 193 int sample_rate,
194 int audio_delay_milliseconds, 194 int audio_delay_milliseconds,
195 uint32_t skipped_frames,
195 base::TimeDelta* current_time) = 0; 196 base::TimeDelta* current_time) = 0;
196 197
197 // Callback to notify the client that the renderer is going away. 198 // Callback to notify the client that the renderer is going away.
198 virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) = 0; 199 virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) = 0;
199 200
200 // Callback to notify the client that the audio renderer thread stopped. 201 // Callback to notify the client that the audio renderer thread stopped.
201 // This function must be called only when that thread is actually stopped. 202 // This function must be called only when that thread is actually stopped.
202 // Otherwise a race may occur. 203 // Otherwise a race may occur.
203 virtual void AudioRendererThreadStopped() = 0; 204 virtual void AudioRendererThreadStopped() = 0;
204 205
205 protected: 206 protected:
206 virtual ~WebRtcAudioRendererSource() {} 207 virtual ~WebRtcAudioRendererSource() {}
207 }; 208 };
208 209
209 // TODO(xians): Merge this interface with WebRtcAudioRendererSource. 210 // TODO(xians): Merge this interface with WebRtcAudioRendererSource.
210 // The reason why we could not do it today is that WebRtcAudioRendererSource 211 // The reason why we could not do it today is that WebRtcAudioRendererSource
211 // gets the data by pulling, while the data is pushed into 212 // gets the data by pulling, while the data is pushed into
212 // WebRtcPlayoutDataSource::Sink. 213 // WebRtcPlayoutDataSource::Sink.
213 class WebRtcPlayoutDataSource { 214 class WebRtcPlayoutDataSource {
214 public: 215 public:
215 class Sink { 216 class Sink {
216 public: 217 public:
217 // Callback to get the playout data. 218 // Callback to get the playout data.
218 // Called on the render audio thread. 219 // Called on the render audio thread.
219 virtual void OnPlayoutData(media::AudioBus* audio_bus, 220 virtual void OnPlayoutData(media::AudioBus* audio_bus,
220 int sample_rate, 221 int sample_rate,
221 int audio_delay_milliseconds) = 0; 222 int audio_delay_milliseconds,
223 uint32_t skipped_frames) = 0;
222 224
223 // Callback to notify the sink that the source has changed. 225 // Callback to notify the sink that the source has changed.
224 // Called on the main render thread. 226 // Called on the main render thread.
225 virtual void OnPlayoutDataSourceChanged() = 0; 227 virtual void OnPlayoutDataSourceChanged() = 0;
226 228
227 protected: 229 protected:
228 virtual ~Sink() {} 230 virtual ~Sink() {}
229 }; 231 };
230 232
231 // Adds/Removes the sink of WebRtcAudioRendererSource to the ADM. 233 // Adds/Removes the sink of WebRtcAudioRendererSource to the ADM.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 337
336 // Make destructor private to ensure that we can only be deleted by Release(). 338 // Make destructor private to ensure that we can only be deleted by Release().
337 ~WebRtcAudioDeviceImpl() override; 339 ~WebRtcAudioDeviceImpl() override;
338 340
339 // WebRtcAudioRendererSource implementation. 341 // WebRtcAudioRendererSource implementation.
340 342
341 // Called on the AudioOutputDevice worker thread. 343 // Called on the AudioOutputDevice worker thread.
342 void RenderData(media::AudioBus* audio_bus, 344 void RenderData(media::AudioBus* audio_bus,
343 int sample_rate, 345 int sample_rate,
344 int audio_delay_milliseconds, 346 int audio_delay_milliseconds,
347 uint32_t skipped_frames,
345 base::TimeDelta* current_time) override; 348 base::TimeDelta* current_time) override;
346 349
347 // Called on the main render thread. 350 // Called on the main render thread.
348 void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) override; 351 void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) override;
349 void AudioRendererThreadStopped() override; 352 void AudioRendererThreadStopped() override;
350 353
351 // WebRtcPlayoutDataSource implementation. 354 // WebRtcPlayoutDataSource implementation.
352 void AddPlayoutSink(WebRtcPlayoutDataSource::Sink* sink) override; 355 void AddPlayoutSink(WebRtcPlayoutDataSource::Sink* sink) override;
353 void RemovePlayoutSink(WebRtcPlayoutDataSource::Sink* sink) override; 356 void RemovePlayoutSink(WebRtcPlayoutDataSource::Sink* sink) override;
354 357
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 // Buffer used for temporary storage during render callback. 406 // Buffer used for temporary storage during render callback.
404 // It is only accessed by the audio render thread. 407 // It is only accessed by the audio render thread.
405 std::vector<int16> render_buffer_; 408 std::vector<int16> render_buffer_;
406 409
407 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); 410 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl);
408 }; 411 };
409 412
410 } // namespace content 413 } // namespace content
411 414
412 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ 415 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_audio_processor_unittest.cc ('k') | content/renderer/media/webrtc_audio_device_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698