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

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

Issue 23691038: Switch LiveAudio to source provider solution. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased and fixed some unittests Created 7 years, 3 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 68bd05fbe03b8e396c436ce2426853b79e8f7dab..b3780ac425ba7376aa59201d474b61fd5db69ddf 100644
--- a/content/renderer/media/webaudio_capturer_source.h
+++ b/content/renderer/media/webaudio_capturer_source.h
@@ -8,30 +8,28 @@
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "media/audio/audio_parameters.h"
-#include "media/base/audio_capturer_source.h"
#include "media/base/audio_fifo.h"
#include "third_party/WebKit/public/platform/WebAudioDestinationConsumer.h"
#include "third_party/WebKit/public/platform/WebVector.h"
namespace content {
-class WebRtcAudioCapturer;
+class WebRtcLocalAudioTrack;
+class WebRtcLocalAudioSourceProvider;
// WebAudioCapturerSource is the missing link between
-// WebAudio's MediaStreamAudioDestinationNode and WebRtcAudioCapturer.
+// WebAudio's MediaStreamAudioDestinationNode and WebRtcLocalAudioTrack.
//
// 1. WebKit calls the setFormat() method setting up the basic stream format
// (channels, and sample-rate). At this time, it dispatches this information
// to the WebRtcAudioCapturer by calling its SetCapturerSource() method.
-// 2. Initialize() is called, where we should get back the same
-// stream format information as (1). We also get the CaptureCallback here.
// 3. consumeAudio() is called periodically by WebKit which dispatches the
// audio stream to the CaptureCallback::Capture() method.
class WebAudioCapturerSource
- : public media::AudioCapturerSource,
- public WebKit::WebAudioDestinationConsumer {
+ : public base::RefCountedThreadSafe<WebAudioCapturerSource>,
+ public WebKit::WebAudioDestinationConsumer {
public:
- explicit WebAudioCapturerSource(WebRtcAudioCapturer* capturer);
+ WebAudioCapturerSource();
// WebAudioDestinationConsumer implementation.
// setFormat() is called early on, so that we can configure the capturer.
@@ -40,25 +38,27 @@ class WebAudioCapturerSource
virtual void consumeAudio(const WebKit::WebVector<const float*>& audio_data,
size_t number_of_frames) OVERRIDE;
- // AudioCapturerSource implementation.
- virtual void Initialize(
- const media::AudioParameters& params,
- media::AudioCapturerSource::CaptureCallback* callback,
- int session_id) OVERRIDE;
+ // Called when the WebAudioCapturerSource is hooking to a media audio track.
+ void Start(WebRtcLocalAudioTrack* track,
tommi (sloooow) - chröme 2013/09/06 11:20:30 can you add documentation about the parameters and
no longer working on chromium 2013/09/10 12:43:15 Done.
+ WebRtcLocalAudioSourceProvider* source_provider);
- virtual void Start() OVERRIDE;
- virtual void Stop() OVERRIDE;
- virtual void SetVolume(double volume) OVERRIDE { }
- virtual void SetAutomaticGainControl(bool enable) OVERRIDE { }
+ // Called when the media audio track is stopping.
+ void Stop();
+
+ protected:
+ friend class base::RefCountedThreadSafe<WebAudioCapturerSource>;
tommi (sloooow) - chröme 2013/09/06 11:20:30 indent seems off
no longer working on chromium 2013/09/10 12:43:15 Done.
+ virtual ~WebAudioCapturerSource();
private:
- virtual ~WebAudioCapturerSource();
+ // a weak pointer to the audio track this WebAudioCapturerSource is feeding
tommi (sloooow) - chröme 2013/09/06 11:20:30 this isn't a weak pointer, it's a raw pointer. "we
no longer working on chromium 2013/09/10 12:43:15 Done.
+ // data to.
+ WebRtcLocalAudioTrack* track_;
- WebRtcAudioCapturer* capturer_;
+ // A weak pointer to the source provider to get the delay, volume,
+ // key_pressed information.
+ WebRtcLocalAudioSourceProvider* source_provider_;
tommi (sloooow) - chröme 2013/09/06 11:20:30 this is also a raw pointer. please add comments t
no longer working on chromium 2013/09/10 12:43:15 Done.
- int set_format_channels_;
media::AudioParameters params_;
- media::AudioCapturerSource::CaptureCallback* callback_;
// Wraps data coming from HandleCapture().
scoped_ptr<media::AudioBus> wrapper_bus_;

Powered by Google App Engine
This is Rietveld 408576698