| OLD | NEW |
| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 if (!writer->Init()) { | 429 if (!writer->Init()) { |
| 430 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); | 430 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); |
| 431 MaybeUnregisterKeyboardMicStream(config); | 431 MaybeUnregisterKeyboardMicStream(config); |
| 432 return; | 432 return; |
| 433 } | 433 } |
| 434 | 434 |
| 435 // If we have successfully created the SyncWriter then assign it to the | 435 // If we have successfully created the SyncWriter then assign it to the |
| 436 // entry and construct an AudioInputController. | 436 // entry and construct an AudioInputController. |
| 437 entry->writer.reset(writer.release()); | 437 entry->writer.reset(writer.release()); |
| 438 if (WebContentsMediaCaptureId::IsWebContentsDeviceId(device_id)) { | 438 if (WebContentsMediaCaptureId::IsWebContentsDeviceId(device_id)) { |
| 439 // For MEDIA_DESKTOP_AUDIO_CAPTURE, the source is selected from picker |
| 440 // window, we do not mute the source audio. |
| 441 // For MEDIA_TAB_AUDIO_CAPTURE, the probable use case is Cast, we mute |
| 442 // the source audio. |
| 443 // TODO(qiangchen): Analyze audio constraints to make a duplicating or |
| 444 // diverting decision. It would give web developer more flexibility. |
| 439 entry->controller = media::AudioInputController::CreateForStream( | 445 entry->controller = media::AudioInputController::CreateForStream( |
| 440 audio_manager_->GetTaskRunner(), | 446 audio_manager_->GetTaskRunner(), this, |
| 441 this, | |
| 442 WebContentsAudioInputStream::Create( | 447 WebContentsAudioInputStream::Create( |
| 443 device_id, | 448 device_id, audio_params, audio_manager_->GetWorkerTaskRunner(), |
| 444 audio_params, | 449 audio_mirroring_manager_, type == MEDIA_DESKTOP_AUDIO_CAPTURE), |
| 445 audio_manager_->GetWorkerTaskRunner(), | 450 entry->writer.get(), user_input_monitor_); |
| 446 audio_mirroring_manager_), | |
| 447 entry->writer.get(), | |
| 448 user_input_monitor_); | |
| 449 // Only count for captures from desktop media picker dialog. | 451 // Only count for captures from desktop media picker dialog. |
| 450 if (entry->controller.get() && type == MEDIA_DESKTOP_AUDIO_CAPTURE) | 452 if (entry->controller.get() && type == MEDIA_DESKTOP_AUDIO_CAPTURE) |
| 451 IncrementDesktopCaptureCounter(TAB_AUDIO_CAPTURER_CREATED); | 453 IncrementDesktopCaptureCounter(TAB_AUDIO_CAPTURER_CREATED); |
| 452 } else { | 454 } else { |
| 453 // We call CreateLowLatency regardless of the value of | 455 // We call CreateLowLatency regardless of the value of |
| 454 // |audio_params.format|. Low latency can currently mean different things in | 456 // |audio_params.format|. Low latency can currently mean different things in |
| 455 // different parts of the stack. | 457 // different parts of the stack. |
| 456 // TODO(grunell): Clean up the low latency terminology so that it's less | 458 // TODO(grunell): Clean up the low latency terminology so that it's less |
| 457 // confusing. | 459 // confusing. |
| 458 entry->controller = media::AudioInputController::CreateLowLatency( | 460 entry->controller = media::AudioInputController::CreateLowLatency( |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 if (entry->input_debug_writer.get()) { | 731 if (entry->input_debug_writer.get()) { |
| 730 BrowserThread::PostTask( | 732 BrowserThread::PostTask( |
| 731 BrowserThread::FILE, FROM_HERE, | 733 BrowserThread::FILE, FROM_HERE, |
| 732 base::Bind(&DeleteInputDebugWriterOnFileThread, | 734 base::Bind(&DeleteInputDebugWriterOnFileThread, |
| 733 base::Passed(std::move(entry->input_debug_writer)))); | 735 base::Passed(std::move(entry->input_debug_writer)))); |
| 734 } | 736 } |
| 735 } | 737 } |
| 736 #endif // defined(ENABLE_WEBRTC) | 738 #endif // defined(ENABLE_WEBRTC) |
| 737 | 739 |
| 738 } // namespace content | 740 } // namespace content |
| OLD | NEW |