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

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

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: addressed Per's comments. 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.cc
diff --git a/content/renderer/media/webrtc_audio_capturer.cc b/content/renderer/media/webrtc_audio_capturer.cc
index d50be35645260bba52d25ce705323c0cdb9667b3..4f3eed88d6df09dc98e85d2d1a0e6ca2c9c6e964 100644
--- a/content/renderer/media/webrtc_audio_capturer.cc
+++ b/content/renderer/media/webrtc_audio_capturer.cc
@@ -205,7 +205,8 @@ bool WebRtcAudioCapturer::Reconfigure(int sample_rate,
}
bool WebRtcAudioCapturer::Initialize(media::ChannelLayout channel_layout,
- int sample_rate) {
+ int sample_rate,
+ int session_id) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!sinks_.empty());
DVLOG(1) << "WebRtcAudioCapturer::Initialize()";
@@ -214,6 +215,8 @@ bool WebRtcAudioCapturer::Initialize(media::ChannelLayout channel_layout,
UMA_HISTOGRAM_ENUMERATION("WebRTC.AudioInputChannelLayout",
channel_layout, media::CHANNEL_LAYOUT_MAX);
+ session_id_ = session_id;
+
// Verify that the reported input channel configuration is supported.
if (channel_layout != media::CHANNEL_LAYOUT_MONO &&
channel_layout != media::CHANNEL_LAYOUT_STEREO) {
@@ -241,7 +244,7 @@ bool WebRtcAudioCapturer::Initialize(media::ChannelLayout channel_layout,
// Create and configure the default audio capturing source. The |source_|
// will be overwritten if an external client later calls SetCapturerSource()
- // providing an alternaive media::AudioCapturerSource.
+ // providing an alternative media::AudioCapturerSource.
SetCapturerSource(AudioDeviceFactory::NewInputDevice(),
channel_layout,
static_cast<float>(sample_rate));
@@ -252,7 +255,8 @@ bool WebRtcAudioCapturer::Initialize(media::ChannelLayout channel_layout,
WebRtcAudioCapturer::WebRtcAudioCapturer()
: source_(NULL),
running_(false),
- agc_is_enabled_(false) {
+ agc_is_enabled_(false),
+ session_id_(0) {
DVLOG(1) << "WebRtcAudioCapturer::WebRtcAudioCapturer()";
}
@@ -299,6 +303,7 @@ void WebRtcAudioCapturer::SetCapturerSource(
media::ChannelLayout channel_layout,
float sample_rate) {
DCHECK(thread_checker_.CalledOnValidThread());
+ CHECK_GT(session_id_, 0);
DVLOG(1) << "SetCapturerSource(channel_layout=" << channel_layout << ","
<< "sample_rate=" << sample_rate << ")";
scoped_refptr<media::AudioCapturerSource> old_source;
@@ -338,7 +343,7 @@ void WebRtcAudioCapturer::SetCapturerSource(
if (source) {
// Make sure to grab the new parameters in case they were reconfigured.
- source->Initialize(current_buffer->params(), this, this);
+ source->Initialize(current_buffer->params(), this, session_id_);
}
}
@@ -382,14 +387,6 @@ void WebRtcAudioCapturer::SetVolume(double volume) {
source_->SetVolume(volume);
}
-void WebRtcAudioCapturer::SetDevice(int session_id) {
- DCHECK(thread_checker_.CalledOnValidThread());
- DVLOG(1) << "WebRtcAudioCapturer::SetDevice(" << session_id << ")";
- base::AutoLock auto_lock(lock_);
- if (source_)
- source_->SetDevice(session_id);
-}
-
void WebRtcAudioCapturer::SetAutomaticGainControl(bool enable) {
base::AutoLock auto_lock(lock_);
// Store the setting since SetAutomaticGainControl() can be called before
@@ -442,14 +439,6 @@ void WebRtcAudioCapturer::OnCaptureError() {
NOTIMPLEMENTED();
}
-void WebRtcAudioCapturer::OnDeviceStarted(const std::string& device_id) {
- device_id_ = device_id;
-}
-
-void WebRtcAudioCapturer::OnDeviceStopped() {
- NOTIMPLEMENTED();
-}
-
media::AudioParameters WebRtcAudioCapturer::audio_parameters() const {
base::AutoLock auto_lock(lock_);
return buffer_->params();
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.h ('k') | content/renderer/media/webrtc_audio_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698