| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/base/fake_output_device.h" | 5 #include "media/base/fake_output_device.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 | 8 |
| 9 namespace media { | 9 namespace media { |
| 10 | 10 |
| 11 FakeOutputDevice::FakeOutputDevice() | 11 FakeOutputDevice::FakeOutputDevice() |
| 12 : FakeOutputDevice(OUTPUT_DEVICE_STATUS_OK) {} | 12 : FakeOutputDevice(OUTPUT_DEVICE_STATUS_OK) {} |
| 13 | 13 |
| 14 FakeOutputDevice::FakeOutputDevice(OutputDeviceStatus device_status) | 14 FakeOutputDevice::FakeOutputDevice(OutputDeviceStatus status) |
| 15 : device_status_(device_status) {} | 15 : FakeOutputDevice( |
| 16 status, |
| 17 media::AudioParameters(media::AudioParameters::AUDIO_FAKE, |
| 18 media::CHANNEL_LAYOUT_STEREO, |
| 19 media::AudioParameters::kTelephoneSampleRate, |
| 20 16, |
| 21 1)) {} |
| 22 |
| 23 FakeOutputDevice::FakeOutputDevice(OutputDeviceStatus status, |
| 24 const AudioParameters& params) |
| 25 : status_(status), params_(params) {} |
| 16 | 26 |
| 17 FakeOutputDevice::~FakeOutputDevice() {} | 27 FakeOutputDevice::~FakeOutputDevice() {} |
| 18 | 28 |
| 19 void FakeOutputDevice::SwitchOutputDevice( | 29 void FakeOutputDevice::SwitchOutputDevice( |
| 20 const std::string& device_id, | 30 const std::string& device_id, |
| 21 const url::Origin& security_origin, | 31 const url::Origin& security_origin, |
| 22 const SwitchOutputDeviceCB& callback) { | 32 const SwitchOutputDeviceCB& callback) { |
| 23 callback.Run(device_status_); | 33 callback.Run(status_); |
| 24 } | 34 } |
| 25 | 35 |
| 26 AudioParameters FakeOutputDevice::GetOutputParameters() { | 36 AudioParameters FakeOutputDevice::GetOutputParameters() { |
| 27 return media::AudioParameters( | 37 return params_; |
| 28 media::AudioParameters::AUDIO_FAKE, media::CHANNEL_LAYOUT_STEREO, | |
| 29 media::AudioParameters::kTelephoneSampleRate, 16, 1); | |
| 30 } | 38 } |
| 31 | 39 |
| 32 OutputDeviceStatus FakeOutputDevice::GetDeviceStatus() { | 40 OutputDeviceStatus FakeOutputDevice::GetDeviceStatus() { |
| 33 return device_status_; | 41 return status_; |
| 34 } | 42 } |
| 35 | 43 |
| 36 } // namespace media | 44 } // namespace media |
| OLD | NEW |