| Index: content/browser/media/capture/web_contents_audio_input_stream.cc
|
| diff --git a/content/browser/media/capture/web_contents_audio_input_stream.cc b/content/browser/media/capture/web_contents_audio_input_stream.cc
|
| index 348af609ed0ce2f46b648fed24496a9108b8131e..b9f15e6cd0607142c1a8194363f36a01239c06a0 100644
|
| --- a/content/browser/media/capture/web_contents_audio_input_stream.cc
|
| +++ b/content/browser/media/capture/web_contents_audio_input_stream.cc
|
| @@ -78,6 +78,10 @@ class WebContentsAudioInputStream::Impl
|
| void StartMirroring();
|
| void StopMirroring();
|
|
|
| + // Increment/decrement the capturer count on the UI BrowserThread.
|
| + void IncrementCapturerCount();
|
| + void DecrementCapturerCount();
|
| +
|
| // Invoked on the UI thread to make sure WebContents muting is turned off for
|
| // successful audio capture.
|
| void UnmuteWebContentsAudio();
|
| @@ -165,14 +169,22 @@ bool WebContentsAudioInputStream::Impl::Open() {
|
| return false;
|
|
|
| state_ = OPENED;
|
| -
|
| tracker_->Start(
|
| initial_render_process_id_, initial_main_render_frame_id_,
|
| base::Bind(&Impl::OnTargetChanged, this));
|
| + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
| + base::Bind(&Impl::IncrementCapturerCount, this));
|
|
|
| return true;
|
| }
|
|
|
| +void WebContentsAudioInputStream::Impl::IncrementCapturerCount() {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| +
|
| + if (WebContents* contents = tracker_->web_contents())
|
| + contents->IncrementCapturerCount(gfx::Size());
|
| +}
|
| +
|
| void WebContentsAudioInputStream::Impl::Start(AudioInputCallback* callback) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(callback);
|
| @@ -222,6 +234,8 @@ void WebContentsAudioInputStream::Impl::Close() {
|
|
|
| if (state_ == OPENED) {
|
| state_ = CONSTRUCTED;
|
| + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
| + base::Bind(&Impl::DecrementCapturerCount, this));
|
| tracker_->Stop();
|
| mixer_stream_->Close();
|
| }
|
| @@ -230,6 +244,13 @@ void WebContentsAudioInputStream::Impl::Close() {
|
| state_ = CLOSED;
|
| }
|
|
|
| +void WebContentsAudioInputStream::Impl::DecrementCapturerCount() {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| +
|
| + if (WebContents* contents = tracker_->web_contents())
|
| + contents->DecrementCapturerCount();
|
| +}
|
| +
|
| void WebContentsAudioInputStream::Impl::ReportError() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
|
|