Chromium Code Reviews| 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 1217458b60f50591b4d3aef6f6913d9fd728ad8b..d65d2701c7cc0bdeadd4e352c08e23dbdc649871 100644 |
| --- a/content/renderer/media/webrtc_audio_capturer.cc |
| +++ b/content/renderer/media/webrtc_audio_capturer.cc |
| @@ -134,7 +134,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()"; |
| @@ -143,6 +144,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) { |
| @@ -170,7 +173,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)); |
| @@ -179,10 +182,10 @@ bool WebRtcAudioCapturer::Initialize(media::ChannelLayout channel_layout, |
| } |
| WebRtcAudioCapturer::WebRtcAudioCapturer() |
| - : main_loop_(base::MessageLoopProxy::current()), |
| - source_(NULL), |
| + : source_(NULL), |
| running_(false), |
| - agc_is_enabled_(false) { |
| + agc_is_enabled_(false), |
| + session_id_(0) { |
| DVLOG(1) << "WebRtcAudioCapturer::WebRtcAudioCapturer()"; |
| } |
| @@ -217,6 +220,7 @@ void WebRtcAudioCapturer::SetCapturerSource( |
| media::ChannelLayout channel_layout, |
| float sample_rate) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| + DCHECK_GT(session_id_, 0); |
|
palmer
2013/03/14 21:05:14
Perhaps this should be a run-time check.
no longer working on chromium
2013/03/15 14:52:11
sgtm, making it a CHECK
|
| DVLOG(1) << "SetCapturerSource(channel_layout=" << channel_layout << "," |
| << "sample_rate=" << sample_rate << ")"; |
| scoped_refptr<media::AudioCapturerSource> old_source; |
| @@ -256,7 +260,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_); |
| } |
| } |
| @@ -305,14 +309,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 |
| @@ -365,36 +361,6 @@ void WebRtcAudioCapturer::OnCaptureError() { |
| NOTIMPLEMENTED(); |
| } |
| -void WebRtcAudioCapturer::OnDeviceStarted(const std::string& device_id) { |
| - device_id_ = device_id; |
| -} |
| - |
| -void WebRtcAudioCapturer::OnDeviceStopped() { |
| - DCHECK_EQ(MessageLoop::current(), ChildProcess::current()->io_message_loop()); |
| - main_loop_->PostTask( |
| - FROM_HERE, base::Bind(&WebRtcAudioCapturer::DoOnDeviceStopped, this)); |
| -} |
| - |
| -void WebRtcAudioCapturer::DoOnDeviceStopped() { |
| - DCHECK(thread_checker_.CalledOnValidThread()); |
| - DVLOG(1) << "WebRtcAudioCapturer::DoOnDeviceStopped()"; |
| - { |
| - base::AutoLock auto_lock(lock_); |
| - running_ = false; |
| - } |
| - |
| - SinkList sinks; |
| - { |
| - base::AutoLock auto_lock(lock_); |
| - sinks = sinks_; |
| - } |
| - |
| - // Inform registered sinks about the stopped device so they can take |
| - // appropriate actions. |
| - for (SinkList::const_iterator it = sinks.begin(); it != sinks.end(); ++it) |
| - (*it)->OnCaptureDeviceStopped(); |
| -} |
| - |
| media::AudioParameters WebRtcAudioCapturer::audio_parameters() const { |
| base::AutoLock auto_lock(lock_); |
| return buffer_->params(); |