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

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

Issue 12440027: Do not pass the string device_id via IPC message to create an audio input stream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready for review Created 7 years, 9 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 960b4e02c4db8104028ad8161fff7312781f97a8..38990d7f3c7e1ee342eaead491d7efe576fa9f25 100644
--- a/content/renderer/media/webrtc_audio_capturer.h
+++ b/content/renderer/media/webrtc_audio_capturer.h
@@ -33,23 +33,22 @@ class WebRtcLocalAudioRenderer;
// created on the main render thread, captured data is provided on a dedicated
// AudioInputDevice thread, and methods can be called either on the Libjingle
// thread or on the main render thread but also other client threads
-// if an alternative AudioCapturerSource has been set. In addition, the
-// AudioCapturerSource::CaptureEventHandler methods are called on the IO thread
-// and requests for data to render is done on the AudioOutputDevice thread.
+// if an alternative AudioCapturerSource has been set.
class CONTENT_EXPORT WebRtcAudioCapturer
: public base::RefCountedThreadSafe<WebRtcAudioCapturer>,
- NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback),
- NON_EXPORTED_BASE(
- public media::AudioCapturerSource::CaptureEventHandler) {
+ NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback) {
public:
// Use to construct the audio capturer.
// Called on the main render thread.
static scoped_refptr<WebRtcAudioCapturer> CreateCapturer();
// Creates and configures the default audio capturing source using the
- // provided audio parameters.
+ // provided audio parameters, |session_id| is used to be passed to the
palmer 2013/03/12 17:45:11 NIT: Extra space again. :)
no longer working on chromium 2013/03/14 10:47:32 Done.
+ // browser to decide which device to use.
// Called on the main render thread.
- bool Initialize(media::ChannelLayout channel_layout, int sample_rate);
+ bool Initialize(media::ChannelLayout channel_layout,
+ int sample_rate,
+ int session_id);
// Called by the client on the sink side to add a sink.
// WebRtcAudioDeviceImpl calls this method on the main render thread but
@@ -84,10 +83,6 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Called on the AudioInputDevice audio thread.
void SetVolume(double volume);
- // Specifies the |session_id| to query which device to use.
- // Called on the main render thread.
- void SetDevice(int session_id);
-
// Enables or disables the WebRtc AGC control.
// Called from a Libjingle working thread.
void SetAutomaticGainControl(bool enable);
@@ -109,11 +104,6 @@ class CONTENT_EXPORT WebRtcAudioCapturer
double volume) OVERRIDE;
virtual void OnCaptureError() OVERRIDE;
- // AudioCapturerSource::CaptureEventHandler implementation.
- // Called on the IO thread.
- virtual void OnDeviceStarted(const std::string& device_id) OVERRIDE;
- virtual void OnDeviceStopped() OVERRIDE;
-
protected:
friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>;
virtual ~WebRtcAudioCapturer();
@@ -127,21 +117,11 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Must be called without holding the lock. Returns true on success.
bool Reconfigure(int sample_rate, media::ChannelLayout channel_layout);
- // Distributes information about a stopped capture device to all registered
- // capture sinks.
- // Runs on the main render thread.
- void DoOnDeviceStopped();
-
// Used to DCHECK that we are called on the correct thread.
base::ThreadChecker thread_checker_;
- // Message loop for the main render thread. Utilized in OnDeviceStopped() to
- // ensure that OnSourceCaptureDeviceStopped() is called on the main thread
- // instead of the originating IO thread.
- scoped_refptr<base::MessageLoopProxy> main_loop_;
-
- // Protects |source_|, |sinks_|, |running_|, |on_device_stopped_cb_|,
- // |loopback_fifo_|, |params_|, |buffering_| and |agc_is_enabled_|.
+ // Protects |source_|, |sinks_|, |running_|, |loopback_fifo_|, |params_|,
+ // |buffering_| and |agc_is_enabled_|.
mutable base::Lock lock_;
// A list of sinks that the audio data is fed to.
@@ -154,12 +134,14 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Allocated during initialization.
class ConfiguredBuffer;
scoped_refptr<ConfiguredBuffer> buffer_;
- std::string device_id_;
bool running_;
// True when automatic gain control is enabled, false otherwise.
bool agc_is_enabled_;
+ // The media session ID used to identify which input device to be started.
+ int session_id_;
palmer 2013/03/12 17:45:11 As discussed in other comments, it *might* make se
no longer working on chromium 2013/03/14 10:47:32 Answered in that comment, anyhow this should be do
+
DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer);
};

Powered by Google App Engine
This is Rietveld 408576698