OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/sound/nullsoundsystem.h" | 11 #include "webrtc/sound/nullsoundsystem.h" |
12 | 12 |
13 #include "webrtc/sound/sounddevicelocator.h" | 13 #include "webrtc/sound/sounddevicelocator.h" |
14 #include "webrtc/sound/soundinputstreaminterface.h" | 14 #include "webrtc/sound/soundinputstreaminterface.h" |
15 #include "webrtc/sound/soundoutputstreaminterface.h" | 15 #include "webrtc/sound/soundoutputstreaminterface.h" |
16 #include "webrtc/base/logging.h" | 16 #include "webrtc/base/logging.h" |
17 | 17 |
18 namespace rtc { | 18 namespace rtc { |
19 | |
20 class Thread; | 19 class Thread; |
21 | |
22 } | 20 } |
23 | 21 |
24 namespace rtc { | 22 namespace rtc { |
25 | 23 |
26 // Name used for the single device and the sound system itself. | 24 // Name used for the single device and the sound system itself. |
27 static const char kNullName[] = "null"; | 25 static const char kNullName[] = "null"; |
28 | 26 |
29 class NullSoundDeviceLocator : public SoundDeviceLocator { | 27 class NullSoundDeviceLocator : public SoundDeviceLocator { |
30 public: | 28 public: |
31 NullSoundDeviceLocator() : SoundDeviceLocator(kNullName, kNullName) {} | 29 NullSoundDeviceLocator() : SoundDeviceLocator(kNullName, kNullName) {} |
32 | 30 |
33 virtual SoundDeviceLocator *Copy() const { | 31 SoundDeviceLocator *Copy() const override { |
34 return new NullSoundDeviceLocator(); | 32 return new NullSoundDeviceLocator(); |
35 } | 33 } |
36 }; | 34 }; |
37 | 35 |
38 class NullSoundInputStream : public SoundInputStreamInterface { | 36 class NullSoundInputStream : public SoundInputStreamInterface { |
39 public: | 37 public: |
40 virtual bool StartReading() { | 38 bool StartReading() override { |
41 return true; | 39 return true; |
42 } | 40 } |
43 | 41 |
44 virtual bool StopReading() { | 42 bool StopReading() override { |
45 return true; | 43 return true; |
46 } | 44 } |
47 | 45 |
48 virtual bool GetVolume(int *volume) { | 46 bool GetVolume(int *volume) override { |
49 *volume = SoundSystemInterface::kMinVolume; | 47 *volume = SoundSystemInterface::kMinVolume; |
50 return true; | 48 return true; |
51 } | 49 } |
52 | 50 |
53 virtual bool SetVolume(int volume) { | 51 bool SetVolume(int volume) override { |
54 return false; | 52 return false; |
55 } | 53 } |
56 | 54 |
57 virtual bool Close() { | 55 bool Close() override { |
58 return true; | 56 return true; |
59 } | 57 } |
60 | 58 |
61 virtual int LatencyUsecs() { | 59 int LatencyUsecs() override { |
62 return 0; | 60 return 0; |
63 } | 61 } |
64 }; | 62 }; |
65 | 63 |
66 class NullSoundOutputStream : public SoundOutputStreamInterface { | 64 class NullSoundOutputStream : public SoundOutputStreamInterface { |
67 public: | 65 public: |
68 virtual bool EnableBufferMonitoring() { | 66 bool EnableBufferMonitoring() override { |
69 return true; | 67 return true; |
70 } | 68 } |
71 | 69 |
72 virtual bool DisableBufferMonitoring() { | 70 bool DisableBufferMonitoring() override { |
73 return true; | 71 return true; |
74 } | 72 } |
75 | 73 |
76 virtual bool WriteSamples(const void *sample_data, | 74 bool WriteSamples(const void *sample_data, size_t size) override { |
77 size_t size) { | |
78 LOG(LS_VERBOSE) << "Got " << size << " bytes of playback samples"; | 75 LOG(LS_VERBOSE) << "Got " << size << " bytes of playback samples"; |
79 return true; | 76 return true; |
80 } | 77 } |
81 | 78 |
82 virtual bool GetVolume(int *volume) { | 79 bool GetVolume(int *volume) override { |
83 *volume = SoundSystemInterface::kMinVolume; | 80 *volume = SoundSystemInterface::kMinVolume; |
84 return true; | 81 return true; |
85 } | 82 } |
86 | 83 |
87 virtual bool SetVolume(int volume) { | 84 bool SetVolume(int volume) override { |
88 return false; | 85 return false; |
89 } | 86 } |
90 | 87 |
91 virtual bool Close() { | 88 bool Close() override { |
92 return true; | 89 return true; |
93 } | 90 } |
94 | 91 |
95 virtual int LatencyUsecs() { | 92 int LatencyUsecs() override { |
96 return 0; | 93 return 0; |
97 } | 94 } |
98 }; | 95 }; |
99 | 96 |
100 NullSoundSystem::~NullSoundSystem() { | 97 NullSoundSystem::~NullSoundSystem() { |
101 } | 98 } |
102 | 99 |
103 bool NullSoundSystem::Init() { | 100 bool NullSoundSystem::Init() { |
104 return true; | 101 return true; |
105 } | 102 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 const SoundDeviceLocator *device, | 145 const SoundDeviceLocator *device, |
149 const OpenParams ¶ms) { | 146 const OpenParams ¶ms) { |
150 return new NullSoundInputStream(); | 147 return new NullSoundInputStream(); |
151 } | 148 } |
152 | 149 |
153 const char *NullSoundSystem::GetName() const { | 150 const char *NullSoundSystem::GetName() const { |
154 return kNullName; | 151 return kNullName; |
155 } | 152 } |
156 | 153 |
157 } // namespace rtc | 154 } // namespace rtc |
OLD | NEW |