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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 return false; | 92 return false; |
93 } | 93 } |
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 const int kNoDelay = 0; | 102 audio_source_->OnMoreData(base::TimeTicks(), 0, audio_bus_.get()); |
chcunningham
2016/07/29 01:21:09
Now?
jameswest
2016/08/26 02:08:47
Done.
| |
103 audio_source_->OnMoreData(audio_bus_.get(), kNoDelay, 0); | |
104 callback_->OnData(this, audio_bus_.get(), 0, 1.0); | 103 callback_->OnData(this, audio_bus_.get(), 0, 1.0); |
105 } | 104 } |
106 | 105 |
107 using AudioSourceCallback = AudioOutputStream::AudioSourceCallback; | 106 using AudioSourceCallback = AudioOutputStream::AudioSourceCallback; |
108 std::unique_ptr<AudioSourceCallback> FakeAudioInputStream::ChooseSource() { | 107 std::unique_ptr<AudioSourceCallback> FakeAudioInputStream::ChooseSource() { |
109 DCHECK(audio_manager_->GetWorkerTaskRunner()->BelongsToCurrentThread()); | 108 DCHECK(audio_manager_->GetWorkerTaskRunner()->BelongsToCurrentThread()); |
110 | 109 |
111 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 110 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
112 switches::kUseFileForFakeAudioCapture)) { | 111 switches::kUseFileForFakeAudioCapture)) { |
113 base::CommandLine::StringType switch_value = | 112 base::CommandLine::StringType switch_value = |
(...skipping 16 matching lines...) Expand all Loading... | |
130 return base::WrapUnique(new FileSource(params_, path_to_wav_file, looping)); | 129 return base::WrapUnique(new FileSource(params_, path_to_wav_file, looping)); |
131 } | 130 } |
132 return base::WrapUnique(new BeepingSource(params_)); | 131 return base::WrapUnique(new 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 |