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

Side by Side Diff: modules/audio_device/audio_device_data_observer.cc

Issue 3020493002: Remove AudioDeviceObserver and make ADM not inherit from the Module interface.
Patch Set: linux build error Created 3 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 18 matching lines...) Expand all
29 is_valid_ = (impl_.get() != nullptr) && (res == 0); 29 is_valid_ = (impl_.get() != nullptr) && (res == 0);
30 } 30 }
31 virtual ~ADMWrapper() { 31 virtual ~ADMWrapper() {
32 audio_transport_ = nullptr; 32 audio_transport_ = nullptr;
33 observer_ = nullptr; 33 observer_ = nullptr;
34 } 34 }
35 35
36 // Make sure we have a valid ADM before returning it to user. 36 // Make sure we have a valid ADM before returning it to user.
37 bool IsValid() { return is_valid_; } 37 bool IsValid() { return is_valid_; }
38 38
39 // RefCountedModule methods overrides.
40 int64_t TimeUntilNextProcess() override {
41 return impl_->TimeUntilNextProcess();
42 }
43 void Process() override { return impl_->Process(); }
44
45 // AudioTransport methods overrides. 39 // AudioTransport methods overrides.
46 int32_t RecordedDataIsAvailable(const void* audioSamples, 40 int32_t RecordedDataIsAvailable(const void* audioSamples,
47 const size_t nSamples, 41 const size_t nSamples,
48 const size_t nBytesPerSample, 42 const size_t nBytesPerSample,
49 const size_t nChannels, 43 const size_t nChannels,
50 const uint32_t samples_per_sec, 44 const uint32_t samples_per_sec,
51 const uint32_t total_delay_ms, 45 const uint32_t total_delay_ms,
52 const int32_t clockDrift, 46 const int32_t clockDrift,
53 const uint32_t currentMicLevel, 47 const uint32_t currentMicLevel,
54 const bool keyPressed, 48 const bool keyPressed,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Remember the audio callback to forward PCM data 114 // Remember the audio callback to forward PCM data
121 audio_transport_ = audio_callback; 115 audio_transport_ = audio_callback;
122 return 0; 116 return 0;
123 } 117 }
124 118
125 // AudioDeviceModule pass through method overrides. 119 // AudioDeviceModule pass through method overrides.
126 int32_t ActiveAudioLayer(AudioLayer* audio_layer) const override { 120 int32_t ActiveAudioLayer(AudioLayer* audio_layer) const override {
127 return impl_->ActiveAudioLayer(audio_layer); 121 return impl_->ActiveAudioLayer(audio_layer);
128 } 122 }
129 ErrorCode LastError() const override { return impl_->LastError(); } 123 ErrorCode LastError() const override { return impl_->LastError(); }
130 int32_t RegisterEventObserver(AudioDeviceObserver* event_callback) override {
131 return impl_->RegisterEventObserver(event_callback);
132 }
133 int32_t Init() override { return impl_->Init(); } 124 int32_t Init() override { return impl_->Init(); }
134 int32_t Terminate() override { return impl_->Terminate(); } 125 int32_t Terminate() override { return impl_->Terminate(); }
135 bool Initialized() const override { return impl_->Initialized(); } 126 bool Initialized() const override { return impl_->Initialized(); }
136 int16_t PlayoutDevices() override { return impl_->PlayoutDevices(); } 127 int16_t PlayoutDevices() override { return impl_->PlayoutDevices(); }
137 int16_t RecordingDevices() override { return impl_->RecordingDevices(); } 128 int16_t RecordingDevices() override { return impl_->RecordingDevices(); }
138 int32_t PlayoutDeviceName(uint16_t index, 129 int32_t PlayoutDeviceName(uint16_t index,
139 char name[kAdmMaxDeviceNameSize], 130 char name[kAdmMaxDeviceNameSize],
140 char guid[kAdmMaxGuidSize]) override { 131 char guid[kAdmMaxGuidSize]) override {
141 return impl_->PlayoutDeviceName(index, name, guid); 132 return impl_->PlayoutDeviceName(index, name, guid);
142 } 133 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 new rtc::RefCountedObject<ADMWrapper>(id, audio_layer, observer)); 319 new rtc::RefCountedObject<ADMWrapper>(id, audio_layer, observer));
329 320
330 if (!audio_device->IsValid()) { 321 if (!audio_device->IsValid()) {
331 return nullptr; 322 return nullptr;
332 } 323 }
333 324
334 return audio_device; 325 return audio_device;
335 } 326 }
336 327
337 } // namespace webrtc 328 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698