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(std::string(), OUTPUT_DEVICE_STATUS_OK) {} |
13 | 13 |
14 FakeOutputDevice::FakeOutputDevice(OutputDeviceStatus device_status) | 14 FakeOutputDevice::FakeOutputDevice(const std::string& device_id, |
15 : device_status_(device_status) {} | 15 OutputDeviceStatus status) |
| 16 : FakeOutputDevice( |
| 17 device_id, |
| 18 status, |
| 19 media::AudioParameters(media::AudioParameters::AUDIO_FAKE, |
| 20 media::CHANNEL_LAYOUT_STEREO, |
| 21 media::AudioParameters::kTelephoneSampleRate, |
| 22 16, |
| 23 1)) {} |
| 24 |
| 25 FakeOutputDevice::FakeOutputDevice(const std::string& device_id, |
| 26 OutputDeviceStatus status, |
| 27 const AudioParameters& params) |
| 28 : device_id_(device_id), status_(status), params_(params) {} |
16 | 29 |
17 FakeOutputDevice::~FakeOutputDevice() {} | 30 FakeOutputDevice::~FakeOutputDevice() {} |
18 | 31 |
19 void FakeOutputDevice::SwitchOutputDevice( | |
20 const std::string& device_id, | |
21 const url::Origin& security_origin, | |
22 const SwitchOutputDeviceCB& callback) { | |
23 callback.Run(device_status_); | |
24 } | |
25 | |
26 AudioParameters FakeOutputDevice::GetOutputParameters() { | 32 AudioParameters FakeOutputDevice::GetOutputParameters() { |
27 return media::AudioParameters( | 33 return params_; |
28 media::AudioParameters::AUDIO_FAKE, media::CHANNEL_LAYOUT_STEREO, | |
29 media::AudioParameters::kTelephoneSampleRate, 16, 1); | |
30 } | 34 } |
31 | 35 |
32 OutputDeviceStatus FakeOutputDevice::GetDeviceStatus() { | 36 OutputDeviceStatus FakeOutputDevice::GetDeviceStatus() { |
33 return device_status_; | 37 return status_; |
| 38 } |
| 39 |
| 40 std::string FakeOutputDevice::GetDeviceId() { |
| 41 return device_id_; |
34 } | 42 } |
35 | 43 |
36 } // namespace media | 44 } // namespace media |
OLD | NEW |