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/base/mock_audio_renderer_sink.h" | 5 #include "media/base/mock_audio_renderer_sink.h" |
6 #include "media/base/fake_output_device.h" | |
7 | 6 |
8 namespace media { | 7 namespace media { |
9 MockAudioRendererSink::MockAudioRendererSink() | 8 MockAudioRendererSink::MockAudioRendererSink() |
10 : MockAudioRendererSink(OUTPUT_DEVICE_STATUS_OK) {} | 9 : MockAudioRendererSink(OUTPUT_DEVICE_STATUS_OK) {} |
11 | 10 |
12 MockAudioRendererSink::MockAudioRendererSink(OutputDeviceStatus device_status) | 11 MockAudioRendererSink::MockAudioRendererSink(OutputDeviceStatus device_status) |
13 : output_device_(new FakeOutputDevice(device_status)) {} | 12 : MockAudioRendererSink(std::string(), device_status) {} |
| 13 |
| 14 MockAudioRendererSink::MockAudioRendererSink(const std::string& device_id, |
| 15 OutputDeviceStatus device_status) |
| 16 : MockAudioRendererSink( |
| 17 device_id, |
| 18 device_status, |
| 19 media::AudioParameters(media::AudioParameters::AUDIO_FAKE, |
| 20 media::CHANNEL_LAYOUT_STEREO, |
| 21 media::AudioParameters::kTelephoneSampleRate, |
| 22 16, |
| 23 1)) {} |
| 24 |
| 25 MockAudioRendererSink::MockAudioRendererSink( |
| 26 const std::string& device_id, |
| 27 OutputDeviceStatus device_status, |
| 28 const AudioParameters& device_output_params) |
| 29 : output_device_info_(device_id, device_status, device_output_params) {} |
14 | 30 |
15 MockAudioRendererSink::~MockAudioRendererSink() {} | 31 MockAudioRendererSink::~MockAudioRendererSink() {} |
16 | 32 |
| 33 void MockAudioRendererSink::SwitchOutputDevice( |
| 34 const std::string& device_id, |
| 35 const url::Origin& security_origin, |
| 36 const OutputDeviceStatusCB& callback) { |
| 37 // NB: output device won't be changed, since it's not required by any tests |
| 38 // now. |
| 39 callback.Run(output_device_info_.device_status()); |
| 40 } |
| 41 |
17 void MockAudioRendererSink::Initialize(const AudioParameters& params, | 42 void MockAudioRendererSink::Initialize(const AudioParameters& params, |
18 RenderCallback* renderer) { | 43 RenderCallback* renderer) { |
19 callback_ = renderer; | 44 callback_ = renderer; |
20 } | 45 } |
21 | 46 |
22 OutputDevice* MockAudioRendererSink::GetOutputDevice() { | 47 OutputDeviceInfo MockAudioRendererSink::GetOutputDeviceInfo() { |
23 return output_device_.get(); | 48 return output_device_info_; |
24 } | 49 } |
25 | 50 |
26 } // namespace media | 51 } // namespace media |
OLD | NEW |