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_; |