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

Side by Side Diff: content/browser/renderer_host/media/audio_input_renderer_host.cc

Issue 2291893002: Let Contraints Controll Mute/Unmute Audio Local Playback For Desktop Sharing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/media/audio_input_renderer_host.h" 5 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 417
418 if (!writer->Init()) { 418 if (!writer->Init()) {
419 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); 419 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED);
420 MaybeUnregisterKeyboardMicStream(config); 420 MaybeUnregisterKeyboardMicStream(config);
421 return; 421 return;
422 } 422 }
423 423
424 // If we have successfully created the SyncWriter then assign it to the 424 // If we have successfully created the SyncWriter then assign it to the
425 // entry and construct an AudioInputController. 425 // entry and construct an AudioInputController.
426 entry->writer.reset(writer.release()); 426 entry->writer.reset(writer.release());
427 if (WebContentsMediaCaptureId::IsWebContentsDeviceId(device_id)) { 427 if (WebContentsMediaCaptureId::TryParse(device_id, nullptr)) {
428 // For MEDIA_DESKTOP_AUDIO_CAPTURE, the source is selected from picker 428 // For MEDIA_DESKTOP_AUDIO_CAPTURE, the source is selected from picker
429 // window, we do not mute the source audio. 429 // window, we do not mute the source audio.
430 // For MEDIA_TAB_AUDIO_CAPTURE, the probable use case is Cast, we mute 430 // For MEDIA_TAB_AUDIO_CAPTURE, the probable use case is Cast, we mute
431 // the source audio. 431 // the source audio.
432 // TODO(qiangchen): Analyze audio constraints to make a duplicating or 432 // TODO(qiangchen): Analyze audio constraints to make a duplicating or
433 // diverting decision. It would give web developer more flexibility. 433 // diverting decision. It would give web developer more flexibility.
434 entry->controller = media::AudioInputController::CreateForStream( 434 entry->controller = media::AudioInputController::CreateForStream(
435 audio_manager_->GetTaskRunner(), this, 435 audio_manager_->GetTaskRunner(), this,
436 WebContentsAudioInputStream::Create( 436 WebContentsAudioInputStream::Create(
437 device_id, audio_params, audio_manager_->GetWorkerTaskRunner(), 437 device_id, audio_params, audio_manager_->GetWorkerTaskRunner(),
438 audio_mirroring_manager_, type == MEDIA_DESKTOP_AUDIO_CAPTURE), 438 audio_mirroring_manager_),
439 entry->writer.get(), user_input_monitor_); 439 entry->writer.get(), user_input_monitor_);
440 // Only count for captures from desktop media picker dialog. 440 // Only count for captures from desktop media picker dialog.
441 if (entry->controller.get() && type == MEDIA_DESKTOP_AUDIO_CAPTURE) 441 if (entry->controller.get() && type == MEDIA_DESKTOP_AUDIO_CAPTURE)
442 IncrementDesktopCaptureCounter(TAB_AUDIO_CAPTURER_CREATED); 442 IncrementDesktopCaptureCounter(TAB_AUDIO_CAPTURER_CREATED);
443 } else { 443 } else {
444 // We call CreateLowLatency regardless of the value of 444 // We call CreateLowLatency regardless of the value of
445 // |audio_params.format|. Low latency can currently mean different things in 445 // |audio_params.format|. Low latency can currently mean different things in
446 // different parts of the stack. 446 // different parts of the stack.
447 // TODO(grunell): Clean up the low latency terminology so that it's less 447 // TODO(grunell): Clean up the low latency terminology so that it's less
448 // confusing. 448 // confusing.
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 if (entry->input_debug_writer.get()) { 722 if (entry->input_debug_writer.get()) {
723 BrowserThread::PostTask( 723 BrowserThread::PostTask(
724 BrowserThread::FILE, FROM_HERE, 724 BrowserThread::FILE, FROM_HERE,
725 base::Bind(&DeleteInputDebugWriterOnFileThread, 725 base::Bind(&DeleteInputDebugWriterOnFileThread,
726 base::Passed(std::move(entry->input_debug_writer)))); 726 base::Passed(std::move(entry->input_debug_writer))));
727 } 727 }
728 } 728 }
729 #endif // defined(ENABLE_WEBRTC) 729 #endif // defined(ENABLE_WEBRTC)
730 730
731 } // namespace content 731 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698