| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 FakeAudioInputStream::~FakeAudioInputStream() {} | 146 FakeAudioInputStream::~FakeAudioInputStream() {} |
| 147 | 147 |
| 148 bool FakeAudioInputStream::Open() { | 148 bool FakeAudioInputStream::Open() { |
| 149 DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); | 149 DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); |
| 150 buffer_.reset(new uint8[buffer_size_]); | 150 buffer_.reset(new uint8[buffer_size_]); |
| 151 memset(buffer_.get(), 0, buffer_size_); | 151 memset(buffer_.get(), 0, buffer_size_); |
| 152 audio_bus_->Zero(); | 152 audio_bus_->Zero(); |
| 153 | 153 |
| 154 if (CommandLine::ForCurrentProcess()->HasSwitch( | 154 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 155 switches::kUseFileForFakeAudioCapture)) { | 155 switches::kUseFileForFakeAudioCapture)) { |
| 156 OpenInFileMode(CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 156 OpenInFileMode(base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 157 switches::kUseFileForFakeAudioCapture)); | 157 switches::kUseFileForFakeAudioCapture)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 return true; | 160 return true; |
| 161 } | 161 } |
| 162 | 162 |
| 163 void FakeAudioInputStream::Start(AudioInputCallback* callback) { | 163 void FakeAudioInputStream::Start(AudioInputCallback* callback) { |
| 164 DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); | 164 DCHECK(audio_manager_->GetTaskRunner()->BelongsToCurrentThread()); |
| 165 DCHECK(!callback_); | 165 DCHECK(!callback_); |
| 166 callback_ = callback; | 166 callback_ = callback; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 return false; | 315 return false; |
| 316 } | 316 } |
| 317 | 317 |
| 318 // static | 318 // static |
| 319 void FakeAudioInputStream::BeepOnce() { | 319 void FakeAudioInputStream::BeepOnce() { |
| 320 BeepContext* beep_context = g_beep_context.Pointer(); | 320 BeepContext* beep_context = g_beep_context.Pointer(); |
| 321 beep_context->SetBeepOnce(true); | 321 beep_context->SetBeepOnce(true); |
| 322 } | 322 } |
| 323 | 323 |
| 324 } // namespace media | 324 } // namespace media |
| OLD | NEW |