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

Unified Diff: content/renderer/media/webrtc/webrtc_audio_sink_adapter.h

Issue 1834323002: MediaStream audio: Refactor 3 separate "glue" implementations into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from PS2: AudioInputDevice --> AudioCapturerSource, and refptr foo in WebRtcMedi… Created 4 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/webrtc/webrtc_audio_sink_adapter.h
diff --git a/content/renderer/media/webrtc/webrtc_audio_sink_adapter.h b/content/renderer/media/webrtc/webrtc_audio_sink_adapter.h
index 4e70d194b5a0eb141b661713ea2dea62b91ad57a..85a418b2425baf50ffdcea686c645e144a29fd3a 100644
--- a/content/renderer/media/webrtc/webrtc_audio_sink_adapter.h
+++ b/content/renderer/media/webrtc/webrtc_audio_sink_adapter.h
@@ -11,6 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "content/public/renderer/media_stream_audio_sink.h"
#include "media/audio/audio_parameters.h"
+#include "media/base/audio_push_fifo.h"
namespace webrtc {
class AudioTrackSinkInterface;
@@ -21,7 +22,8 @@ namespace content {
// Adapter to the webrtc::AudioTrackSinkInterface of the audio track.
// This class is used in between the MediaStreamAudioSink and
// webrtc::AudioTrackSinkInterface. It gets data callback via the
-// MediaStreamAudioSink::OnData() interface and pass the data to
+// MediaStreamAudioSink::OnData() interface, re-chunks the data into the
+// required 10ms chunks if needed, and passes the data to WebRTC via the
// webrtc::AudioTrackSinkInterface.
class WebRtcAudioSinkAdapter : public MediaStreamAudioSink {
public:
@@ -37,8 +39,13 @@ class WebRtcAudioSinkAdapter : public MediaStreamAudioSink {
base::TimeTicks estimated_capture_time) override;
void OnSetFormat(const media::AudioParameters& params) override;
- webrtc::AudioTrackSinkInterface* const sink_;
+ // Called by AudioPushFifo zero or more times during the call to OnData().
+ // Delivers audio data with the required 10ms buffer size to |sink_|.
+ void DeliverRebufferedAudio(const media::AudioBus& audio_bus,
+ int frame_delay);
+ webrtc::AudioTrackSinkInterface* const sink_;
+ media::AudioPushFifo fifo_;
media::AudioParameters params_;
scoped_ptr<int16_t[]> interleaved_data_;

Powered by Google App Engine
This is Rietveld 408576698