| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 void FakeAudioInputStream::ReadAudioFromSource() { | 95 void FakeAudioInputStream::ReadAudioFromSource() { |
| 96 DCHECK(audio_manager_->GetWorkerTaskRunner()->BelongsToCurrentThread()); | 96 DCHECK(audio_manager_->GetWorkerTaskRunner()->BelongsToCurrentThread()); |
| 97 DCHECK(callback_); | 97 DCHECK(callback_); |
| 98 | 98 |
| 99 if (!audio_source_) | 99 if (!audio_source_) |
| 100 audio_source_ = ChooseSource(); | 100 audio_source_ = ChooseSource(); |
| 101 | 101 |
| 102 audio_source_->OnMoreData(base::TimeDelta(), base::TimeTicks::Now(), 0, | 102 audio_source_->OnMoreData(base::TimeDelta(), base::TimeTicks::Now(), 0, |
| 103 audio_bus_.get()); | 103 audio_bus_.get()); |
| 104 callback_->OnData(this, audio_bus_.get(), 0, 1.0); | 104 callback_->OnData(this, audio_bus_.get(), base::TimeDelta(), |
| 105 base::TimeTicks::Now(), 1.0); |
| 105 } | 106 } |
| 106 | 107 |
| 107 using AudioSourceCallback = AudioOutputStream::AudioSourceCallback; | 108 using AudioSourceCallback = AudioOutputStream::AudioSourceCallback; |
| 108 std::unique_ptr<AudioSourceCallback> FakeAudioInputStream::ChooseSource() { | 109 std::unique_ptr<AudioSourceCallback> FakeAudioInputStream::ChooseSource() { |
| 109 DCHECK(audio_manager_->GetWorkerTaskRunner()->BelongsToCurrentThread()); | 110 DCHECK(audio_manager_->GetWorkerTaskRunner()->BelongsToCurrentThread()); |
| 110 | 111 |
| 111 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 112 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 112 switches::kUseFileForFakeAudioCapture)) { | 113 switches::kUseFileForFakeAudioCapture)) { |
| 113 base::CommandLine::StringType switch_value = | 114 base::CommandLine::StringType switch_value = |
| 114 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( | 115 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 130 return base::MakeUnique<FileSource>(params_, path_to_wav_file, looping); | 131 return base::MakeUnique<FileSource>(params_, path_to_wav_file, looping); |
| 131 } | 132 } |
| 132 return base::MakeUnique<BeepingSource>(params_); | 133 return base::MakeUnique<BeepingSource>(params_); |
| 133 } | 134 } |
| 134 | 135 |
| 135 void FakeAudioInputStream::BeepOnce() { | 136 void FakeAudioInputStream::BeepOnce() { |
| 136 BeepingSource::BeepOnce(); | 137 BeepingSource::BeepOnce(); |
| 137 } | 138 } |
| 138 | 139 |
| 139 } // namespace media | 140 } // namespace media |
| OLD | NEW |