audio_device_data_observer.h (1849B)
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 <cstddef> 15 #include <cstdint> 16 #include <memory> 17 18 #include "api/audio/audio_device.h" 19 #include "api/scoped_refptr.h" 20 21 namespace webrtc { 22 23 // This interface will capture the raw PCM data of both the local captured as 24 // well as the mixed/rendered remote audio. 25 class AudioDeviceDataObserver { 26 public: 27 virtual void OnCaptureData(const void* audio_samples, 28 size_t num_samples, 29 size_t bytes_per_sample, 30 size_t num_channels, 31 uint32_t samples_per_sec) = 0; 32 33 virtual void OnRenderData(const void* audio_samples, 34 size_t num_samples, 35 size_t bytes_per_sample, 36 size_t num_channels, 37 uint32_t samples_per_sec) = 0; 38 39 AudioDeviceDataObserver() = default; 40 virtual ~AudioDeviceDataObserver() = default; 41 }; 42 43 // Creates an ADMWrapper around an ADM instance that registers 44 // the provided AudioDeviceDataObserver. 45 scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver( 46 scoped_refptr<AudioDeviceModule> impl, 47 std::unique_ptr<AudioDeviceDataObserver> observer); 48 49 } // namespace webrtc 50 51 #endif // MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DATA_OBSERVER_H_