• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "api/scoped_refptr.h"
18 #include "api/task_queue/task_queue_factory.h"
19 #include "modules/audio_device/include/audio_device.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                              const size_t num_samples,
29                              const size_t bytes_per_sample,
30                              const size_t num_channels,
31                              const uint32_t samples_per_sec) = 0;
32 
33   virtual void OnRenderData(const void* audio_samples,
34                             const size_t num_samples,
35                             const size_t bytes_per_sample,
36                             const size_t num_channels,
37                             const 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 rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver(
46     rtc::scoped_refptr<AudioDeviceModule> impl,
47     std::unique_ptr<AudioDeviceDataObserver> observer);
48 
49 // Creates an ADMWrapper around an ADM instance that registers
50 // the provided AudioDeviceDataObserver.
51 RTC_DEPRECATED
52 rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver(
53     rtc::scoped_refptr<AudioDeviceModule> impl,
54     AudioDeviceDataObserver* observer);
55 
56 // Creates an ADM instance with AudioDeviceDataObserver registered.
57 rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver(
58     const AudioDeviceModule::AudioLayer audio_layer,
59     TaskQueueFactory* task_queue_factory,
60     std::unique_ptr<AudioDeviceDataObserver> observer);
61 
62 // Creates an ADM instance with AudioDeviceDataObserver registered.
63 RTC_DEPRECATED
64 rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceWithDataObserver(
65     const AudioDeviceModule::AudioLayer audio_layer,
66     TaskQueueFactory* task_queue_factory,
67     AudioDeviceDataObserver* observer);
68 
69 }  // namespace webrtc
70 
71 #endif  // MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DATA_OBSERVER_H_
72