summaryrefslogtreecommitdiff
path: root/chromium/media/fuchsia/audio/fake_audio_device_enumerator.cc
blob: f9a2c0682a5cf9744dba1d2c966ed789a7e5a580 (plain)
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
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/fuchsia/audio/fake_audio_device_enumerator.h"

#include "base/logging.h"

namespace media {

FakeAudioDeviceEnumerator::FakeAudioDeviceEnumerator(vfs::PseudoDir* pseudo_dir)
    : binding_(pseudo_dir, this) {}

FakeAudioDeviceEnumerator::~FakeAudioDeviceEnumerator() = default;

void FakeAudioDeviceEnumerator::GetDevices(GetDevicesCallback callback) {
  std::vector<fuchsia::media::AudioDeviceInfo> result = {
      {
          .name = "input",
          .unique_id = "input",
          .token_id = 1,
          .is_input = true,
          .is_default = true,
      },
      {
          .name = "output",
          .unique_id = "output",
          .token_id = 2,
          .is_input = false,
          .is_default = true,
      },
  };
  callback(std::move(result));
}

void FakeAudioDeviceEnumerator::NotImplemented_(const std::string& name) {
  LOG(FATAL) << "Reached non-implemented " << name;
}

}  // namespace media