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