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

Side by Side Diff: content/browser/media/capture/web_contents_audio_input_stream.cc

Issue 1839723002: Experimental: Unmute Audio During Tab Sourced Desktop Share (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Loopback Sink (Rebased) Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/media/capture/web_contents_audio_input_stream.h" 5 #include "content/browser/media/capture/web_contents_audio_input_stream.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 void UnmuteWebContentsAudio(); 80 void UnmuteWebContentsAudio();
81 81
82 // AudioMirroringManager::MirroringDestination implementation 82 // AudioMirroringManager::MirroringDestination implementation
83 void QueryForMatches(const std::set<SourceFrameRef>& candidates, 83 void QueryForMatches(const std::set<SourceFrameRef>& candidates,
84 const MatchesCallback& results_callback) override; 84 const MatchesCallback& results_callback) override;
85 void QueryForMatchesOnUIThread(const std::set<SourceFrameRef>& candidates, 85 void QueryForMatchesOnUIThread(const std::set<SourceFrameRef>& candidates,
86 const MatchesCallback& results_callback); 86 const MatchesCallback& results_callback);
87 media::AudioOutputStream* AddInput( 87 media::AudioOutputStream* AddInput(
88 const media::AudioParameters& params) override; 88 const media::AudioParameters& params) override;
89 89
90 media::AudioPushSink* AddPushInput(
91 const media::AudioParameters& params) override;
92
90 // Callback which is run when |stream| is closed. Deletes |stream|. 93 // Callback which is run when |stream| is closed. Deletes |stream|.
91 void ReleaseInput(media::VirtualAudioOutputStream* stream); 94 void ReleaseInput(media::VirtualAudioOutputStream* stream);
92 95
96 void ReleasePushInput(media::LoopbackSink* stream);
97
98 bool IsDuplication() override;
99
93 // Called by WebContentsTracker when the target of the audio mirroring has 100 // Called by WebContentsTracker when the target of the audio mirroring has
94 // changed. 101 // changed.
95 void OnTargetChanged(bool had_target); 102 void OnTargetChanged(bool had_target);
96 103
97 // Injected dependencies. 104 // Injected dependencies.
98 const int initial_render_process_id_; 105 const int initial_render_process_id_;
99 const int initial_main_render_frame_id_; 106 const int initial_main_render_frame_id_;
100 AudioMirroringManager* const mirroring_manager_; 107 AudioMirroringManager* const mirroring_manager_;
101 const scoped_refptr<WebContentsTracker> tracker_; 108 const scoped_refptr<WebContentsTracker> tracker_;
102 // The AudioInputStream implementation that handles the audio conversion and 109 // The AudioInputStream implementation that handles the audio conversion and
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 params, 302 params,
296 mixer_stream_.get(), 303 mixer_stream_.get(),
297 base::Bind(&Impl::ReleaseInput, this)); 304 base::Bind(&Impl::ReleaseInput, this));
298 } 305 }
299 306
300 void WebContentsAudioInputStream::Impl::ReleaseInput( 307 void WebContentsAudioInputStream::Impl::ReleaseInput(
301 media::VirtualAudioOutputStream* stream) { 308 media::VirtualAudioOutputStream* stream) {
302 delete stream; 309 delete stream;
303 } 310 }
304 311
312 media::AudioPushSink* WebContentsAudioInputStream::Impl::AddPushInput(
313 const media::AudioParameters& params) {
314 // Note: The closure created here holds a reference to "this," which will
315 // guarantee the VirtualAudioInputStream (mixer_stream_) outlives the
316 // VirtualAudioOutputStream.
317 return new media::LoopbackSink(params, mixer_stream_.get(),
318 base::Bind(&Impl::ReleasePushInput, this));
319 }
320
321 void WebContentsAudioInputStream::Impl::ReleasePushInput(
322 media::LoopbackSink* stream) {
323 delete stream;
324 }
325
326 bool WebContentsAudioInputStream::Impl::IsDuplication() {
327 return true;
328 }
329
305 void WebContentsAudioInputStream::Impl::OnTargetChanged(bool had_target) { 330 void WebContentsAudioInputStream::Impl::OnTargetChanged(bool had_target) {
306 DCHECK(thread_checker_.CalledOnValidThread()); 331 DCHECK(thread_checker_.CalledOnValidThread());
307 332
308 is_target_lost_ = !had_target; 333 is_target_lost_ = !had_target;
309 334
310 if (state_ == MIRRORING) { 335 if (state_ == MIRRORING) {
311 if (is_target_lost_) { 336 if (is_target_lost_) {
312 ReportError(); 337 ReportError();
313 Stop(); 338 Stop();
314 } else { 339 } else {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 409
385 bool WebContentsAudioInputStream::GetAutomaticGainControl() { 410 bool WebContentsAudioInputStream::GetAutomaticGainControl() {
386 return impl_->mixer_stream()->GetAutomaticGainControl(); 411 return impl_->mixer_stream()->GetAutomaticGainControl();
387 } 412 }
388 413
389 bool WebContentsAudioInputStream::IsMuted() { 414 bool WebContentsAudioInputStream::IsMuted() {
390 return false; 415 return false;
391 } 416 }
392 417
393 } // namespace content 418 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/capture/audio_mirroring_manager.cc ('k') | content/browser/media/capture/web_contents_audio_muter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698