Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1589)

Side by Side Diff: webrtc/sound/nullsoundsystem.cc

Issue 1715043002: Remove webrtc/sound/ subdir. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@remove_devicemanager
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/sound/nullsoundsystem.h ('k') | webrtc/sound/nullsoundsystemfactory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/sound/nullsoundsystem.h"
12
13 #include "webrtc/sound/sounddevicelocator.h"
14 #include "webrtc/sound/soundinputstreaminterface.h"
15 #include "webrtc/sound/soundoutputstreaminterface.h"
16 #include "webrtc/base/logging.h"
17
18 namespace rtc {
19 class Thread;
20 }
21
22 namespace rtc {
23
24 // Name used for the single device and the sound system itself.
25 static const char kNullName[] = "null";
26
27 class NullSoundDeviceLocator : public SoundDeviceLocator {
28 public:
29 NullSoundDeviceLocator() : SoundDeviceLocator(kNullName, kNullName) {}
30
31 SoundDeviceLocator *Copy() const override {
32 return new NullSoundDeviceLocator();
33 }
34 };
35
36 class NullSoundInputStream : public SoundInputStreamInterface {
37 public:
38 bool StartReading() override {
39 return true;
40 }
41
42 bool StopReading() override {
43 return true;
44 }
45
46 bool GetVolume(int *volume) override {
47 *volume = SoundSystemInterface::kMinVolume;
48 return true;
49 }
50
51 bool SetVolume(int volume) override {
52 return false;
53 }
54
55 bool Close() override {
56 return true;
57 }
58
59 int LatencyUsecs() override {
60 return 0;
61 }
62 };
63
64 class NullSoundOutputStream : public SoundOutputStreamInterface {
65 public:
66 bool EnableBufferMonitoring() override {
67 return true;
68 }
69
70 bool DisableBufferMonitoring() override {
71 return true;
72 }
73
74 bool WriteSamples(const void *sample_data, size_t size) override {
75 LOG(LS_VERBOSE) << "Got " << size << " bytes of playback samples";
76 return true;
77 }
78
79 bool GetVolume(int *volume) override {
80 *volume = SoundSystemInterface::kMinVolume;
81 return true;
82 }
83
84 bool SetVolume(int volume) override {
85 return false;
86 }
87
88 bool Close() override {
89 return true;
90 }
91
92 int LatencyUsecs() override {
93 return 0;
94 }
95 };
96
97 NullSoundSystem::~NullSoundSystem() {
98 }
99
100 bool NullSoundSystem::Init() {
101 return true;
102 }
103
104 void NullSoundSystem::Terminate() {
105 // Nothing to do.
106 }
107
108 bool NullSoundSystem::EnumeratePlaybackDevices(
109 SoundSystemInterface::SoundDeviceLocatorList *devices) {
110 ClearSoundDeviceLocatorList(devices);
111 SoundDeviceLocator *device;
112 GetDefaultPlaybackDevice(&device);
113 devices->push_back(device);
114 return true;
115 }
116
117 bool NullSoundSystem::EnumerateCaptureDevices(
118 SoundSystemInterface::SoundDeviceLocatorList *devices) {
119 ClearSoundDeviceLocatorList(devices);
120 SoundDeviceLocator *device;
121 GetDefaultCaptureDevice(&device);
122 devices->push_back(device);
123 return true;
124 }
125
126 bool NullSoundSystem::GetDefaultPlaybackDevice(
127 SoundDeviceLocator **device) {
128 *device = new NullSoundDeviceLocator();
129 return true;
130 }
131
132 bool NullSoundSystem::GetDefaultCaptureDevice(
133 SoundDeviceLocator **device) {
134 *device = new NullSoundDeviceLocator();
135 return true;
136 }
137
138 SoundOutputStreamInterface *NullSoundSystem::OpenPlaybackDevice(
139 const SoundDeviceLocator *device,
140 const OpenParams &params) {
141 return new NullSoundOutputStream();
142 }
143
144 SoundInputStreamInterface *NullSoundSystem::OpenCaptureDevice(
145 const SoundDeviceLocator *device,
146 const OpenParams &params) {
147 return new NullSoundInputStream();
148 }
149
150 const char *NullSoundSystem::GetName() const {
151 return kNullName;
152 }
153
154 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/sound/nullsoundsystem.h ('k') | webrtc/sound/nullsoundsystemfactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698