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

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 unittest compile breakage caused by recent method rename. 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
« no previous file with comments | « chrome/renderer/media/cast_rtp_stream.cc ('k') | content/renderer/media/webaudio_capturer_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d5b3bb5b554514d8d75ee909bf8ab23f63914279 100644
--- a/content/renderer/media/webaudio_capturer_source.h
+++ b/content/renderer/media/webaudio_capturer_source.h
@@ -11,9 +11,11 @@
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
+#include "base/time/time.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_push_fifo.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 +60,12 @@ class WebAudioCapturerSource
~WebAudioCapturerSource() override;
private:
+ // Called by AudioPushFifo zero or more times during the call to
+ // consumeAudio(). Delivers audio data with the required buffer size to the
+ // track.
+ void DeliverRebufferedAudio(const media::AudioBus& audio_bus,
+ int frame_delay);
+
// Removes this object from a blink::WebMediaStreamSource with which it
// might be registered. The goal is to avoid dangling pointers.
void removeFromBlinkSource();
@@ -75,14 +83,18 @@ 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 |fifo_|.
scoped_ptr<media::AudioBus> wrapper_bus_;
- // Bus for reading from FIFO and calling the CaptureCallback.
- scoped_ptr<media::AudioBus> capture_bus_;
+ // Takes in the audio data passed to consumeAudio() and re-buffers 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::AudioPushFifo fifo_;
- // Handles mismatch between WebAudio buffer size and WebRTC.
- scoped_ptr<media::AudioFifo> fifo_;
+ // Used to pass the reference timestamp between DeliverDecodedAudio() and
+ // DeliverRebufferedAudio().
+ base::TimeTicks current_reference_time_;
// Synchronizes HandleCapture() with AudioCapturerSource calls.
base::Lock lock_;
« no previous file with comments | « chrome/renderer/media/cast_rtp_stream.cc ('k') | content/renderer/media/webaudio_capturer_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698