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

Unified Diff: content/renderer/media/webrtc_audio_capturer.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/webrtc_audio_capturer.h
diff --git a/content/renderer/media/webrtc_audio_capturer.h b/content/renderer/media/webrtc_audio_capturer.h
index caa88d03825fe6d93ebf0f0c856c86405d9569d0..43a9575562c80718c0e77af942b81a9ab66c2cbe 100644
--- a/content/renderer/media/webrtc_audio_capturer.h
+++ b/content/renderer/media/webrtc_audio_capturer.h
@@ -20,9 +20,14 @@ namespace media {
class AudioBus;
}
+namespace WebKit {
+class WebAudioSourceProvider;
+}
+
namespace content {
class WebRtcLocalAudioRenderer;
+class WebRtcLocalAudioSourceProvider;
class WebRtcLocalAudioTrack;
// This class manages the capture data flow by getting data from its
@@ -73,6 +78,8 @@ class CONTENT_EXPORT WebRtcAudioCapturer
media::ChannelLayout channel_layout,
float sample_rate);
+ void EnablePeerConnectionMode();
tommi (sloooow) - chröme 2013/09/06 11:20:30 documentation
no longer working on chromium 2013/09/10 12:43:15 Done.
+
// Volume APIs used by WebRtcAudioDeviceImpl.
// Called on the AudioInputDevice audio thread.
void SetVolume(int volume);
@@ -95,6 +102,8 @@ class CONTENT_EXPORT WebRtcAudioCapturer
const std::string& device_id() const { return device_id_; }
+ WebKit::WebAudioSourceProvider* AudioSourceProvider() const;
tommi (sloooow) - chröme 2013/09/06 11:20:30 GetAudioSourceProvider usually for inline getters
no longer working on chromium 2013/09/10 12:43:15 Done.
+
protected:
friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>;
WebRtcAudioCapturer();
@@ -112,9 +121,9 @@ class CONTENT_EXPORT WebRtcAudioCapturer
bool key_pressed) OVERRIDE;
virtual void OnCaptureError() OVERRIDE;
- // Reconfigures the capturer with a new buffer size and capture parameters.
- // Must be called without holding the lock. Returns true on success.
- bool Reconfigure(int sample_rate, media::ChannelLayout channel_layout);
+ // Reconfigures the capturer with a new capture parameters.
+ // Must be called without holding the lock.
+ void Reconfigure(int sample_rate, media::ChannelLayout channel_layout);
// Starts recording audio.
// Triggered by AddSink() on the main render thread or a Libjingle working
@@ -126,6 +135,9 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// thread. It should NOT be called under |lock_|.
void Stop();
+ // Helper function to get the buffer size based on |native_mode_| and
tommi (sloooow) - chröme 2013/09/06 11:20:30 s/native_mode_/peer_connection_mode_
no longer working on chromium 2013/09/10 12:43:15 Done.
+ // sample rate;
+ int GetBufferSize(int sample_rate) const;
// Used to DCHECK that we are called on the correct thread.
base::ThreadChecker thread_checker_;
@@ -140,15 +152,16 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// The audio data source from the browser process.
scoped_refptr<media::AudioCapturerSource> source_;
- // Buffers used for temporary storage during capture callbacks.
- // Allocated during initialization.
- class ConfiguredBuffer;
- scoped_refptr<ConfiguredBuffer> buffer_;
+ // Cached values of utilized audio parameters.
tommi (sloooow) - chröme 2013/09/06 11:20:30 nit: utilized and used does not mean exactly the s
no longer working on chromium 2013/09/10 12:43:15 Done.
+ media::AudioParameters params_;
+
bool running_;
// True when automatic gain control is enabled, false otherwise.
bool agc_is_enabled_;
+ int render_view_id_;
+
// The media session ID used to identify which input device to be started by
// the browser.
int session_id_;
@@ -160,6 +173,15 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Range is [0, 255].
int volume_;
+ // The source provider to feed the capture data to other clients like
+ // WebAudio.
+ // TODO(xians): Move the source provider to track once we don't need to feed
+ // delay, volume, key_pressed information to WebAudioCapturerSource.
+ scoped_ptr<WebRtcLocalAudioSourceProvider> source_provider_;
+
+ // Flag which affects the buffer size used by the capturer.
+ bool peer_connection_mode_;
+
DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer);
};

Powered by Google App Engine
This is Rietveld 408576698