| 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" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/numerics/safe_math.h" | 14 #include "base/numerics/safe_math.h" |
| 15 #include "base/process/process.h" | 15 #include "base/process/process.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "content/browser/media/capture/web_contents_audio_input_stream.h" | 19 #include "content/browser/media/capture/web_contents_audio_input_stream.h" |
| 20 #include "content/browser/media/capture/web_contents_capture_util.h" | |
| 21 #include "content/browser/media/media_internals.h" | 20 #include "content/browser/media/media_internals.h" |
| 22 #include "content/browser/media/webrtc_internals.h" | 21 #include "content/browser/media/webrtc_internals.h" |
| 23 #include "content/browser/renderer_host/media/audio_input_debug_writer.h" | 22 #include "content/browser/renderer_host/media/audio_input_debug_writer.h" |
| 24 #include "content/browser/renderer_host/media/audio_input_device_manager.h" | 23 #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
| 25 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" | 24 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" |
| 26 #include "content/browser/renderer_host/media/media_stream_manager.h" | 25 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 26 #include "content/public/browser/web_contents_media_capture_id.h" |
| 27 #include "media/audio/audio_manager_base.h" | 27 #include "media/audio/audio_manager_base.h" |
| 28 #include "media/base/audio_bus.h" | 28 #include "media/base/audio_bus.h" |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 #ifdef ENABLE_WEBRTC | 34 #ifdef ENABLE_WEBRTC |
| 35 const base::FilePath::CharType kDebugRecordingFileNameAddition[] = | 35 const base::FilePath::CharType kDebugRecordingFileNameAddition[] = |
| 36 FILE_PATH_LITERAL("source_input"); | 36 FILE_PATH_LITERAL("source_input"); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 435 |
| 436 if (!writer->Init()) { | 436 if (!writer->Init()) { |
| 437 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); | 437 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); |
| 438 MaybeUnregisterKeyboardMicStream(config); | 438 MaybeUnregisterKeyboardMicStream(config); |
| 439 return; | 439 return; |
| 440 } | 440 } |
| 441 | 441 |
| 442 // If we have successfully created the SyncWriter then assign it to the | 442 // If we have successfully created the SyncWriter then assign it to the |
| 443 // entry and construct an AudioInputController. | 443 // entry and construct an AudioInputController. |
| 444 entry->writer.reset(writer.release()); | 444 entry->writer.reset(writer.release()); |
| 445 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { | 445 if (WebContentsMediaCaptureId::IsWebContentsDeviceId(device_id)) { |
| 446 entry->controller = media::AudioInputController::CreateForStream( | 446 entry->controller = media::AudioInputController::CreateForStream( |
| 447 audio_manager_->GetTaskRunner(), | 447 audio_manager_->GetTaskRunner(), |
| 448 this, | 448 this, |
| 449 WebContentsAudioInputStream::Create( | 449 WebContentsAudioInputStream::Create( |
| 450 device_id, | 450 device_id, |
| 451 audio_params, | 451 audio_params, |
| 452 audio_manager_->GetWorkerTaskRunner(), | 452 audio_manager_->GetWorkerTaskRunner(), |
| 453 audio_mirroring_manager_), | 453 audio_mirroring_manager_), |
| 454 entry->writer.get(), | 454 entry->writer.get(), |
| 455 user_input_monitor_); | 455 user_input_monitor_); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 if (entry->input_debug_writer.get()) { | 721 if (entry->input_debug_writer.get()) { |
| 722 BrowserThread::PostTask( | 722 BrowserThread::PostTask( |
| 723 BrowserThread::FILE, FROM_HERE, | 723 BrowserThread::FILE, FROM_HERE, |
| 724 base::Bind(&DeleteInputDebugWriterOnFileThread, | 724 base::Bind(&DeleteInputDebugWriterOnFileThread, |
| 725 base::Passed(std::move(entry->input_debug_writer)))); | 725 base::Passed(std::move(entry->input_debug_writer)))); |
| 726 } | 726 } |
| 727 } | 727 } |
| 728 #endif // defined(ENABLE_WEBRTC) | 728 #endif // defined(ENABLE_WEBRTC) |
| 729 | 729 |
| 730 } // namespace content | 730 } // namespace content |
| OLD | NEW |