1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
media / base / mock_audio_renderer_sink.cc [blame]
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/base/mock_audio_renderer_sink.h"
#include "base/functional/bind.h"
#include "base/task/sequenced_task_runner.h"
namespace media {
MockAudioRendererSink::MockAudioRendererSink()
: MockAudioRendererSink(OUTPUT_DEVICE_STATUS_OK) {}
MockAudioRendererSink::MockAudioRendererSink(OutputDeviceStatus device_status)
: MockAudioRendererSink(std::string(), device_status) {}
MockAudioRendererSink::MockAudioRendererSink(const std::string& device_id,
OutputDeviceStatus device_status)
: MockAudioRendererSink(
device_id,
device_status,
AudioParameters(AudioParameters::AUDIO_FAKE,
ChannelLayoutConfig::Stereo(),
AudioParameters::kTelephoneSampleRate,
1)) {}
MockAudioRendererSink::MockAudioRendererSink(
const std::string& device_id,
OutputDeviceStatus device_status,
const AudioParameters& device_output_params)
: output_device_info_(device_id, device_status, device_output_params) {}
MockAudioRendererSink::~MockAudioRendererSink() = default;
void MockAudioRendererSink::SwitchOutputDevice(const std::string& device_id,
OutputDeviceStatusCB callback) {
// NB: output device won't be changed, since it's not required by any tests
// now.
std::move(callback).Run(output_device_info_.device_status());
}
void MockAudioRendererSink::Initialize(const AudioParameters& params,
RenderCallback* renderer) {
callback_ = renderer;
}
OutputDeviceInfo MockAudioRendererSink::GetOutputDeviceInfo() {
return output_device_info_;
}
void MockAudioRendererSink::GetOutputDeviceInfoAsync(
OutputDeviceInfoCB info_cb) {
base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE, base::BindOnce(std::move(info_cb), output_device_info_));
}
bool MockAudioRendererSink::IsOptimizedForHardwareParameters() {
return false;
}
} // namespace media