| 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 "media/audio/fake_audio_input_stream.h" | 5 #include "media/audio/fake_audio_input_stream.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 DCHECK(audio_manager_->GetWorkerTaskRunner()->BelongsToCurrentThread()); | 109 DCHECK(audio_manager_->GetWorkerTaskRunner()->BelongsToCurrentThread()); |
| 110 | 110 |
| 111 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 111 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 112 switches::kUseFileForFakeAudioCapture)) { | 112 switches::kUseFileForFakeAudioCapture)) { |
| 113 base::CommandLine::StringType switch_value = | 113 base::CommandLine::StringType switch_value = |
| 114 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( | 114 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( |
| 115 switches::kUseFileForFakeAudioCapture); | 115 switches::kUseFileForFakeAudioCapture); |
| 116 base::CommandLine::StringVector parameters = | 116 base::CommandLine::StringVector parameters = |
| 117 base::SplitString(switch_value, FILE_PATH_LITERAL("%"), | 117 base::SplitString(switch_value, FILE_PATH_LITERAL("%"), |
| 118 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 118 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 119 CHECK(parameters.size() > 0) << "You must pass <file>[%noloop] to --" | 119 LOG_IF(FATAL, parameters.empty()) << "You must pass <file>[%noloop] to --" |
| 120 << switches::kUseFileForFakeAudioCapture | 120 << switches::kUseFileForFakeAudioCapture |
| 121 << "."; | 121 << "."; |
| 122 |
| 122 base::FilePath path_to_wav_file = base::FilePath(parameters[0]); | 123 base::FilePath path_to_wav_file = base::FilePath(parameters[0]); |
| 123 bool looping = true; | 124 bool looping = true; |
| 124 if (parameters.size() == 2) { | 125 if (parameters.size() == 2) { |
| 125 CHECK(parameters[1] == FILE_PATH_LITERAL("noloop")) | 126 CHECK(parameters[1] == FILE_PATH_LITERAL("noloop")); |
| 126 << "Unknown parameter " << parameters[1] << " to " | |
| 127 << switches::kUseFileForFakeAudioCapture << "."; | |
| 128 looping = false; | 127 looping = false; |
| 129 } | 128 } |
| 130 return base::MakeUnique<FileSource>(params_, path_to_wav_file, looping); | 129 return base::MakeUnique<FileSource>(params_, path_to_wav_file, looping); |
| 131 } | 130 } |
| 132 return base::MakeUnique<BeepingSource>(params_); | 131 return base::MakeUnique<BeepingSource>(params_); |
| 133 } | 132 } |
| 134 | 133 |
| 135 void FakeAudioInputStream::BeepOnce() { | 134 void FakeAudioInputStream::BeepOnce() { |
| 136 BeepingSource::BeepOnce(); | 135 BeepingSource::BeepOnce(); |
| 137 } | 136 } |
| 138 | 137 |
| 139 } // namespace media | 138 } // namespace media |
| OLD | NEW |