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

Unified Diff: content/browser/media/capture/web_contents_audio_input_stream.cc

Issue 586303004: WebContentsAudioMuter: Mute all audio output from a WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dale's comments. Created 6 years, 3 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
« no previous file with comments | « no previous file | content/browser/media/capture/web_contents_audio_muter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | content/browser/media/capture/web_contents_audio_muter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698