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 55eee222445a469ae4dbfab096f5d1047da18ccb..c08b17ca82f6f031d255264a17e962bafb9513b7 100644 |
--- a/content/browser/media/capture/web_contents_audio_input_stream.cc |
+++ b/content/browser/media/capture/web_contents_audio_input_stream.cc |
@@ -74,6 +74,10 @@ class WebContentsAudioInputStream::Impl |
void StartMirroring(); |
void StopMirroring(); |
+ // Invoked on the UI thread to make sure WebContents muting is turned off for |
+ // successful audio capture. |
+ void UnmuteWebContentsAudio(); |
+ |
// AudioMirroringManager::MirroringDestination implementation |
virtual void QueryForMatches( |
const std::set<SourceFrameRef>& candidates, |
@@ -174,6 +178,14 @@ void WebContentsAudioInputStream::Impl::Start(AudioInputCallback* callback) { |
mixer_stream_->Start(callback); |
StartMirroring(); |
+ |
+ // WebContents audio muting is implemented as audio capture to nowhere. |
+ // Unmuting will stop that audio capture, allowing AudioMirroringManager to |
+ // divert audio capture to here. |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, |
+ FROM_HERE, |
+ base::Bind(&Impl::UnmuteWebContentsAudio, this)); |
} |
void WebContentsAudioInputStream::Impl::Stop() { |
@@ -235,6 +247,14 @@ void WebContentsAudioInputStream::Impl::StopMirroring() { |
make_scoped_refptr(this))); |
} |
+void WebContentsAudioInputStream::Impl::UnmuteWebContentsAudio() { |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ |
+ WebContents* const contents = tracker_->web_contents(); |
+ if (contents) |
+ contents->SetAudioMuted(false); |
+} |
+ |
void WebContentsAudioInputStream::Impl::QueryForMatches( |
const std::set<SourceFrameRef>& candidates, |
const MatchesCallback& results_callback) { |