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

Side by Side Diff: webrtc/modules/audio_device/include/fake_audio_device.h

Issue 2710023010: Fix busy loop in FakeAudioDeviceModule. (Closed)
Patch Set: Add some logic to reduce callbacks when appropriate Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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
(...skipping 23 matching lines...) Expand all
34 virtual int32_t SetPlayoutDevice(uint16_t index) { return 0; } 34 virtual int32_t SetPlayoutDevice(uint16_t index) { return 0; }
35 virtual int32_t SetPlayoutDevice(WindowsDeviceType device) { return 0; } 35 virtual int32_t SetPlayoutDevice(WindowsDeviceType device) { return 0; }
36 virtual int32_t SetStereoPlayout(bool enable) { return 0; } 36 virtual int32_t SetStereoPlayout(bool enable) { return 0; }
37 virtual int32_t StopPlayout() { return 0; } 37 virtual int32_t StopPlayout() { return 0; }
38 virtual int32_t InitMicrophone() { return 0; } 38 virtual int32_t InitMicrophone() { return 0; }
39 virtual int32_t SetRecordingDevice(uint16_t index) { return 0; } 39 virtual int32_t SetRecordingDevice(uint16_t index) { return 0; }
40 virtual int32_t SetRecordingDevice(WindowsDeviceType device) { return 0; } 40 virtual int32_t SetRecordingDevice(WindowsDeviceType device) { return 0; }
41 virtual int32_t SetStereoRecording(bool enable) { return 0; } 41 virtual int32_t SetStereoRecording(bool enable) { return 0; }
42 virtual int32_t SetAGC(bool enable) { return 0; } 42 virtual int32_t SetAGC(bool enable) { return 0; }
43 virtual int32_t StopRecording() { return 0; } 43 virtual int32_t StopRecording() { return 0; }
44 virtual int64_t TimeUntilNextProcess() { return 0; } 44
45 virtual void Process() {} 45 // If the subclass doesn't override the ProcessThread implementation,
46 // we'll fall back on an implementation that doesn't eat too much CPU.
47 virtual int64_t TimeUntilNextProcess() {
48 if (turn_off_module_callbacks_)
the sun 2017/02/25 20:01:07 return time_until_next_process_;
49 return 7 * 24 * 60 * 60 * 1000; // call me next week.
50 uses_default_module_implementation_ = true;
51 return 10;
52 }
53
54 virtual void Process() {
55 turn_off_module_callbacks_ = uses_default_module_implementation_;
the sun 2017/02/25 20:01:07 // After first call to Process(), we wait a long t
56 }
57
46 virtual int32_t Terminate() { return 0; } 58 virtual int32_t Terminate() { return 0; }
47 59
48 virtual int32_t ActiveAudioLayer(AudioLayer* audioLayer) const { return 0; } 60 virtual int32_t ActiveAudioLayer(AudioLayer* audioLayer) const { return 0; }
49 virtual ErrorCode LastError() const { return kAdmErrNone; } 61 virtual ErrorCode LastError() const { return kAdmErrNone; }
50 virtual bool Initialized() const { return true; } 62 virtual bool Initialized() const { return true; }
51 virtual int16_t PlayoutDevices() { return 0; } 63 virtual int16_t PlayoutDevices() { return 0; }
52 virtual int16_t RecordingDevices() { return 0; } 64 virtual int16_t RecordingDevices() { return 0; }
53 virtual int32_t PlayoutDeviceName(uint16_t index, 65 virtual int32_t PlayoutDeviceName(uint16_t index,
54 char name[kAdmMaxDeviceNameSize], 66 char name[kAdmMaxDeviceNameSize],
55 char guid[kAdmMaxGuidSize]) { 67 char guid[kAdmMaxGuidSize]) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 virtual int32_t EnableBuiltInNS(bool enable) { return -1; } 172 virtual int32_t EnableBuiltInNS(bool enable) { return -1; }
161 173
162 #if defined(WEBRTC_IOS) 174 #if defined(WEBRTC_IOS)
163 virtual int GetPlayoutAudioParameters(AudioParameters* params) const { 175 virtual int GetPlayoutAudioParameters(AudioParameters* params) const {
164 return -1; 176 return -1;
165 } 177 }
166 virtual int GetRecordAudioParameters(AudioParameters* params) const { 178 virtual int GetRecordAudioParameters(AudioParameters* params) const {
167 return -1; 179 return -1;
168 } 180 }
169 #endif // WEBRTC_IOS 181 #endif // WEBRTC_IOS
182
183 private:
184 bool uses_default_module_implementation_ = false;
the sun 2017/02/25 20:01:07 int64_t time_until_next_process_ = 10;
185 bool turn_off_module_callbacks_ = false;
170 }; 186 };
171 187
172 } // namespace webrtc 188 } // namespace webrtc
173 189
174 #endif // WEBRTC_MODULES_AUDIO_DEVICE_INCLUDE_FAKE_AUDIO_DEVICE_H_ 190 #endif // WEBRTC_MODULES_AUDIO_DEVICE_INCLUDE_FAKE_AUDIO_DEVICE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698