| 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" |
| 11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
| 14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
| 15 #include "base/numerics/safe_math.h" | 15 #include "base/numerics/safe_math.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "base/sync_socket.h" | 19 #include "base/sync_socket.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "content/browser/bad_message.h" | 21 #include "content/browser/bad_message.h" |
| 22 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" | 22 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" |
| 23 #include "content/browser/media/capture/web_contents_audio_input_stream.h" | 23 #include "content/browser/media/capture/web_contents_audio_input_stream.h" |
| 24 #include "content/browser/media/media_internals.h" | 24 #include "content/browser/media/media_internals.h" |
| 25 #include "content/browser/renderer_host/media/audio_input_debug_writer.h" | 25 #include "content/browser/renderer_host/media/audio_debug_file_writer.h" |
| 26 #include "content/browser/renderer_host/media/audio_input_device_manager.h" | 26 #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
| 27 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" | 27 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" |
| 28 #include "content/browser/renderer_host/media/media_stream_manager.h" | 28 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 29 #include "content/browser/webrtc/webrtc_internals.h" | 29 #include "content/browser/webrtc/webrtc_internals.h" |
| 30 #include "content/public/browser/web_contents_media_capture_id.h" | 30 #include "content/public/browser/web_contents_media_capture_id.h" |
| 31 #include "media/audio/audio_device_description.h" | 31 #include "media/audio/audio_device_description.h" |
| 32 #include "media/base/audio_bus.h" | 32 #include "media/base/audio_bus.h" |
| 33 #include "media/base/media_switches.h" | 33 #include "media/base/media_switches.h" |
| 34 #include "media/media_features.h" | 34 #include "media/media_features.h" |
| 35 | 35 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 entry->shared_memory.memory(), entry->shared_memory.requested_size(), | 341 entry->shared_memory.memory(), entry->shared_memory.requested_size(), |
| 342 entry->shared_memory_segment_count, audio_params)); | 342 entry->shared_memory_segment_count, audio_params)); |
| 343 | 343 |
| 344 if (!writer->Init()) { | 344 if (!writer->Init()) { |
| 345 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); | 345 SendErrorMessage(stream_id, SYNC_WRITER_INIT_FAILED); |
| 346 MaybeUnregisterKeyboardMicStream(config); | 346 MaybeUnregisterKeyboardMicStream(config); |
| 347 return; | 347 return; |
| 348 } | 348 } |
| 349 | 349 |
| 350 #if BUILDFLAG(ENABLE_WEBRTC) | 350 #if BUILDFLAG(ENABLE_WEBRTC) |
| 351 std::unique_ptr<media::AudioInputWriter> debug_writer( | 351 std::unique_ptr<media::AudioFileWriter> debug_writer( |
| 352 new AudioInputDebugWriter(audio_params)); | 352 new AudioDebugFileWriter(audio_params)); |
| 353 #else | 353 #else |
| 354 std::unique_ptr<media::AudioInputWriter> debug_writer(nullptr); | 354 std::unique_ptr<media::AudioFileWriter> debug_writer(nullptr); |
| 355 #endif | 355 #endif |
| 356 | 356 |
| 357 // If we have successfully created the SyncWriter then assign it to the | 357 // If we have successfully created the SyncWriter then assign it to the |
| 358 // entry and construct an AudioInputController. | 358 // entry and construct an AudioInputController. |
| 359 entry->writer.reset(writer.release()); | 359 entry->writer.reset(writer.release()); |
| 360 if (WebContentsMediaCaptureId::Parse(device_id, nullptr)) { | 360 if (WebContentsMediaCaptureId::Parse(device_id, nullptr)) { |
| 361 // For MEDIA_DESKTOP_AUDIO_CAPTURE, the source is selected from picker | 361 // For MEDIA_DESKTOP_AUDIO_CAPTURE, the source is selected from picker |
| 362 // window, we do not mute the source audio. | 362 // window, we do not mute the source audio. |
| 363 // For MEDIA_TAB_AUDIO_CAPTURE, the probable use case is Cast, we mute | 363 // For MEDIA_TAB_AUDIO_CAPTURE, the probable use case is Cast, we mute |
| 364 // the source audio. | 364 // the source audio. |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 entry->controller->EnableDebugRecording( | 606 entry->controller->EnableDebugRecording( |
| 607 file_name.AddExtension(IntToStringType(stream_id)) | 607 file_name.AddExtension(IntToStringType(stream_id)) |
| 608 .AddExtension(kDebugRecordingFileNameExtension)); | 608 .AddExtension(kDebugRecordingFileNameExtension)); |
| 609 } | 609 } |
| 610 | 610 |
| 611 #undef IntToStringType | 611 #undef IntToStringType |
| 612 | 612 |
| 613 #endif // BUILDFLAG(ENABLE_WEBRTC) | 613 #endif // BUILDFLAG(ENABLE_WEBRTC) |
| 614 | 614 |
| 615 } // namespace content | 615 } // namespace content |
| OLD | NEW |