| 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 26307b9f95eff204241a5e616f40e5f9fed77dd8..4f3eed88d6df09dc98e85d2d1a0e6ca2c9c6e964 100644
|
| --- a/content/renderer/media/webrtc_audio_capturer.cc
|
| +++ b/content/renderer/media/webrtc_audio_capturer.cc
|
| @@ -78,7 +78,6 @@ class WebRtcAudioCapturer::SinkOwner
|
| int audio_delay_milliseconds,
|
| double volume) OVERRIDE;
|
| virtual void SetCaptureFormat(const media::AudioParameters& params) OVERRIDE;
|
| - virtual void OnCaptureDeviceStopped() OVERRIDE;
|
|
|
| bool IsEqual(const WebRtcAudioCapturerSink* other) const;
|
| void Reset();
|
| @@ -126,12 +125,6 @@ void WebRtcAudioCapturer::SinkOwner::SetCaptureFormat(
|
| delegate_->SetCaptureFormat(params);
|
| }
|
|
|
| -void WebRtcAudioCapturer::SinkOwner::OnCaptureDeviceStopped() {
|
| - base::AutoLock lock(lock_);
|
| - if (delegate_)
|
| - delegate_->OnCaptureDeviceStopped();
|
| -}
|
| -
|
| bool WebRtcAudioCapturer::SinkOwner::IsEqual(
|
| const WebRtcAudioCapturerSink* other) const {
|
| base::AutoLock lock(lock_);
|
| @@ -212,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()";
|
| @@ -221,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) {
|
| @@ -248,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));
|
| @@ -257,10 +253,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()";
|
| }
|
|
|
| @@ -307,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;
|
| @@ -346,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_);
|
| }
|
| }
|
|
|
| @@ -390,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
|
| @@ -450,34 +439,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));
|
| -}
|
| -
|
| -// TODO(henrika): this implementation should be removed as soon as we add
|
| -// suppport for proper handling of LocalMediaStream::stop().
|
| -void WebRtcAudioCapturer::DoOnDeviceStopped() {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| - DVLOG(1) << "WebRtcAudioCapturer::DoOnDeviceStopped()";
|
| - SinkList sinks;
|
| - {
|
| - base::AutoLock auto_lock(lock_);
|
| - running_ = false;
|
| - 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();
|
|
|