2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
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.
11 #ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_DEFINES_H
12 #define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_DEFINES_H
14 #include "webrtc/typedefs.h"
18 static const int kAdmMaxDeviceNameSize = 128;
19 static const int kAdmMaxFileNameSize = 512;
20 static const int kAdmMaxGuidSize = 128;
22 static const int kAdmMinPlayoutBufferSizeMs = 10;
23 static const int kAdmMaxPlayoutBufferSizeMs = 250;
25 // ----------------------------------------------------------------------------
26 // AudioDeviceObserver
27 // ----------------------------------------------------------------------------
29 class AudioDeviceObserver
39 kRecordingWarning = 0,
43 virtual void OnErrorIsReported(const ErrorCode error) = 0;
44 virtual void OnWarningIsReported(const WarningCode warning) = 0;
47 virtual ~AudioDeviceObserver() {}
50 // ----------------------------------------------------------------------------
52 // ----------------------------------------------------------------------------
57 virtual int32_t RecordedDataIsAvailable(const void* audioSamples,
58 const uint32_t nSamples,
59 const uint8_t nBytesPerSample,
60 const uint8_t nChannels,
61 const uint32_t samplesPerSec,
62 const uint32_t totalDelayMS,
63 const int32_t clockDrift,
64 const uint32_t currentMicLevel,
65 const bool keyPressed,
66 uint32_t& newMicLevel) = 0;
68 virtual int32_t NeedMorePlayData(const uint32_t nSamples,
69 const uint8_t nBytesPerSample,
70 const uint8_t nChannels,
71 const uint32_t samplesPerSec,
73 uint32_t& nSamplesOut) = 0;
75 // Method to pass captured data directly and unmixed to network channels.
76 // |channel_ids| contains a list of VoE channels which are the
77 // sinks to the capture data. |audio_delay_milliseconds| is the sum of
78 // recording delay and playout delay of the hardware. |current_volume| is
79 // in the range of [0, 255], representing the current microphone analog
80 // volume. |key_pressed| is used by the typing detection.
81 // |need_audio_processing| specify if the data needs to be processed by APM.
82 // Currently WebRtc supports only one APM, and Chrome will make sure only
83 // one stream goes through APM. When |need_audio_processing| is false, the
84 // values of |audio_delay_milliseconds|, |current_volume| and |key_pressed|
86 // The return value is the new microphone volume, in the range of |0, 255].
87 // When the volume does not need to be updated, it returns 0.
88 // TODO(xians): Remove this interface after Chrome and Libjingle switches
90 virtual int OnDataAvailable(const int voe_channels[],
91 int number_of_voe_channels,
92 const int16_t* audio_data,
94 int number_of_channels,
96 int audio_delay_milliseconds,
99 bool need_audio_processing) { return 0; }
101 // Method to pass the captured audio data to the specific VoE channel.
102 // |voe_channel| is the id of the VoE channel which is the sink to the
104 // TODO(xians): Make the interface pure virtual after libjingle
105 // has its implementation.
106 virtual void OnData(int voe_channel, const void* audio_data,
107 int bits_per_sample, int sample_rate,
108 int number_of_channels,
109 int number_of_frames) {}
112 virtual ~AudioTransport() {}
115 } // namespace webrtc
117 #endif // WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_DEFINES_H