1 /* 2 * Copyright (c) 2017 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 #ifndef MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DATA_OBSERVER_H_ 12 #define MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DATA_OBSERVER_H_ 13 14 #include <stddef.h> 15 #include <stdint.h> 16 17 #include "absl/base/attributes.h" 18 #include "api/scoped_refptr.h" 19 #include "api/task_queue/task_queue_factory.h" 20 #include "modules/audio_device/include/audio_device.h" 21 22 namespace webrtc { 23 24 // This interface will capture the raw PCM data of both the local captured as 25 // well as the mixed/rendered remote audio. 26 class AudioDeviceDataObserver { 27 public: 28 virtual void OnCaptureData(const void* audio_samples, 29 size_t num_samples, 30 size_t bytes_per_sample, 31 size_t num_channels, 32 uint32_t samples_per_sec) = 0; 33 34 virtual void OnRenderData(const void* audio_samples, 35 size_t num_samples, 36 size_t bytes_per_sample, 37 size_t num_channels, 38 uint32_t samples_per_sec) = 0; 39 40 AudioDeviceDataObserver() = default; 41 virtual ~AudioDeviceDataObserver() = default; 42 }; 43 44 // Creates an ADMWrapper around an ADM instance that registers 45 // the provided AudioDeviceDataObserver. 46 rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver( 47 rtc::scoped_refptr<AudioDeviceModule> impl, 48 std::unique_ptr<AudioDeviceDataObserver> observer); 49 50 // Creates an ADMWrapper around an ADM instance that registers 51 // the provided AudioDeviceDataObserver. 52 ABSL_DEPRECATED("") 53 rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver( 54 rtc::scoped_refptr<AudioDeviceModule> impl, 55 AudioDeviceDataObserver* observer); 56 57 // Creates an ADM instance with AudioDeviceDataObserver registered. 58 rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver( 59 AudioDeviceModule::AudioLayer audio_layer, 60 TaskQueueFactory* task_queue_factory, 61 std::unique_ptr<AudioDeviceDataObserver> observer); 62 63 // Creates an ADM instance with AudioDeviceDataObserver registered. 64 ABSL_DEPRECATED("") 65 rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver( 66 AudioDeviceModule::AudioLayer audio_layer, 67 TaskQueueFactory* task_queue_factory, 68 AudioDeviceDataObserver* observer); 69 70 } // namespace webrtc 71 72 #endif // MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DATA_OBSERVER_H_ 73