| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_manager.h" | 5 #include "media/audio/fake_audio_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 const int kDefaultInputBufferSize = 1024; | 14 const int kDefaultInputBufferSize = 1024; |
| 15 const int kDefaultSampleRate = 48000; | 15 const int kDefaultSampleRate = 48000; |
| 16 | 16 |
| 17 const char kAudioManagerName[] = "Fake"; |
| 18 |
| 17 } // namespace | 19 } // namespace |
| 18 | 20 |
| 19 FakeAudioManager::FakeAudioManager( | 21 FakeAudioManager::FakeAudioManager( |
| 20 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 22 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 21 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 23 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, |
| 22 AudioLogFactory* audio_log_factory) | 24 AudioLogFactory* audio_log_factory) |
| 23 : AudioManagerBase(std::move(task_runner), | 25 : AudioManagerBase(std::move(task_runner), |
| 24 std::move(worker_task_runner), | 26 std::move(worker_task_runner), |
| 25 audio_log_factory) { | 27 audio_log_factory) { |
| 26 } | 28 } |
| 27 | 29 |
| 28 FakeAudioManager::~FakeAudioManager() { | 30 FakeAudioManager::~FakeAudioManager() { |
| 29 Shutdown(); | 31 Shutdown(); |
| 30 } | 32 } |
| 31 | 33 |
| 32 // Implementation of AudioManager. | 34 // Implementation of AudioManager. |
| 33 bool FakeAudioManager::HasAudioOutputDevices() { return false; } | 35 bool FakeAudioManager::HasAudioOutputDevices() { return false; } |
| 34 | 36 |
| 35 bool FakeAudioManager::HasAudioInputDevices() { return false; } | 37 bool FakeAudioManager::HasAudioInputDevices() { return false; } |
| 36 | 38 |
| 39 const char* FakeAudioManager::GetName() { |
| 40 return kAudioManagerName; |
| 41 } |
| 42 |
| 37 // Implementation of AudioManagerBase. | 43 // Implementation of AudioManagerBase. |
| 38 AudioOutputStream* FakeAudioManager::MakeLinearOutputStream( | 44 AudioOutputStream* FakeAudioManager::MakeLinearOutputStream( |
| 39 const AudioParameters& params, | 45 const AudioParameters& params, |
| 40 const LogCallback& log_callback) { | 46 const LogCallback& log_callback) { |
| 41 return FakeAudioOutputStream::MakeFakeStream(this, params); | 47 return FakeAudioOutputStream::MakeFakeStream(this, params); |
| 42 } | 48 } |
| 43 | 49 |
| 44 AudioOutputStream* FakeAudioManager::MakeLowLatencyOutputStream( | 50 AudioOutputStream* FakeAudioManager::MakeLowLatencyOutputStream( |
| 45 const AudioParameters& params, | 51 const AudioParameters& params, |
| 46 const std::string& device_id, | 52 const std::string& device_id, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 89 } |
| 84 | 90 |
| 85 AudioParameters FakeAudioManager::GetInputStreamParameters( | 91 AudioParameters FakeAudioManager::GetInputStreamParameters( |
| 86 const std::string& device_id) { | 92 const std::string& device_id) { |
| 87 return AudioParameters( | 93 return AudioParameters( |
| 88 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, | 94 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, |
| 89 kDefaultSampleRate, 16, kDefaultInputBufferSize); | 95 kDefaultSampleRate, 16, kDefaultInputBufferSize); |
| 90 } | 96 } |
| 91 | 97 |
| 92 } // namespace media | 98 } // namespace media |
| OLD | NEW |