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

Unified Diff: content/renderer/media/webaudio_capturer_source.h

Issue 1714593003: Introduce media::AudioPushFifo and a couple of use cases (and clean-ups). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Win compile issue. Created 4 years, 10 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/webaudio_capturer_source.h
diff --git a/content/renderer/media/webaudio_capturer_source.h b/content/renderer/media/webaudio_capturer_source.h
index b0ee262ccd7c3c06135b9252b3b394db8c0dc7dd..4a06ee9a8bd2a217d7cb5ca00c710a491f3353fb 100644
--- a/content/renderer/media/webaudio_capturer_source.h
+++ b/content/renderer/media/webaudio_capturer_source.h
@@ -12,8 +12,9 @@
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "media/audio/audio_parameters.h"
+#include "media/base/audio_bus.h"
#include "media/base/audio_capturer_source.h"
-#include "media/base/audio_fifo.h"
+#include "media/base/audio_rechunker.h"
#include "third_party/WebKit/public/platform/WebAudioDestinationConsumer.h"
#include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
#include "third_party/WebKit/public/platform/WebVector.h"
@@ -58,6 +59,11 @@ class WebAudioCapturerSource
~WebAudioCapturerSource() override;
private:
+ // Called by AudioRechunker zero or more times during the call to
+ // consumeAudio(). Delivers re-chunked audio data to the track.
+ void DeliverRechunkedAudio(const media::AudioBus& audio_bus,
+ base::TimeDelta reference_timestamp);
+
// Removes this object from a blink::WebMediaStreamSource with which it
// might be registered. The goal is to avoid dangling pointers.
void removeFromBlinkSource();
@@ -75,14 +81,14 @@ class WebAudioCapturerSource
// Flag to help notify the |track_| when the audio format has changed.
bool audio_format_changed_;
- // Wraps data coming from HandleCapture().
+ // A wrapper used for providing audio to |rechunker_|.
scoped_ptr<media::AudioBus> wrapper_bus_;
- // Bus for reading from FIFO and calling the CaptureCallback.
- scoped_ptr<media::AudioBus> capture_bus_;
-
- // Handles mismatch between WebAudio buffer size and WebRTC.
- scoped_ptr<media::AudioFifo> fifo_;
+ // Takes in the audio data passed to consumeAudio() and re-chunks it into 10
+ // ms chunks for the track. This ensures each chunk of audio delivered to the
+ // track has the required buffer size, regardless of the amount of audio
+ // provided via each consumeAudio() call.
+ media::AudioRechunker rechunker_;
// Synchronizes HandleCapture() with AudioCapturerSource calls.
base::Lock lock_;

Powered by Google App Engine
This is Rietveld 408576698