xref: /aosp_15_r20/external/webrtc/api/audio_options.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3*d9f75844SAndroid Build Coastguard Worker  *
4*d9f75844SAndroid Build Coastguard Worker  *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker  *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker  *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker  *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker  *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker  */
10*d9f75844SAndroid Build Coastguard Worker 
11*d9f75844SAndroid Build Coastguard Worker #ifndef API_AUDIO_OPTIONS_H_
12*d9f75844SAndroid Build Coastguard Worker #define API_AUDIO_OPTIONS_H_
13*d9f75844SAndroid Build Coastguard Worker 
14*d9f75844SAndroid Build Coastguard Worker #include <stdint.h>
15*d9f75844SAndroid Build Coastguard Worker 
16*d9f75844SAndroid Build Coastguard Worker #include <string>
17*d9f75844SAndroid Build Coastguard Worker 
18*d9f75844SAndroid Build Coastguard Worker #include "absl/types/optional.h"
19*d9f75844SAndroid Build Coastguard Worker #include "rtc_base/system/rtc_export.h"
20*d9f75844SAndroid Build Coastguard Worker 
21*d9f75844SAndroid Build Coastguard Worker namespace cricket {
22*d9f75844SAndroid Build Coastguard Worker 
23*d9f75844SAndroid Build Coastguard Worker // Options that can be applied to a VoiceMediaChannel or a VoiceMediaEngine.
24*d9f75844SAndroid Build Coastguard Worker // Used to be flags, but that makes it hard to selectively apply options.
25*d9f75844SAndroid Build Coastguard Worker // We are moving all of the setting of options to structs like this,
26*d9f75844SAndroid Build Coastguard Worker // but some things currently still use flags.
27*d9f75844SAndroid Build Coastguard Worker struct RTC_EXPORT AudioOptions {
28*d9f75844SAndroid Build Coastguard Worker   AudioOptions();
29*d9f75844SAndroid Build Coastguard Worker   ~AudioOptions();
30*d9f75844SAndroid Build Coastguard Worker   void SetAll(const AudioOptions& change);
31*d9f75844SAndroid Build Coastguard Worker 
32*d9f75844SAndroid Build Coastguard Worker   bool operator==(const AudioOptions& o) const;
33*d9f75844SAndroid Build Coastguard Worker   bool operator!=(const AudioOptions& o) const { return !(*this == o); }
34*d9f75844SAndroid Build Coastguard Worker 
35*d9f75844SAndroid Build Coastguard Worker   std::string ToString() const;
36*d9f75844SAndroid Build Coastguard Worker 
37*d9f75844SAndroid Build Coastguard Worker   // Audio processing that attempts to filter away the output signal from
38*d9f75844SAndroid Build Coastguard Worker   // later inbound pickup.
39*d9f75844SAndroid Build Coastguard Worker   absl::optional<bool> echo_cancellation;
40*d9f75844SAndroid Build Coastguard Worker #if defined(WEBRTC_IOS)
41*d9f75844SAndroid Build Coastguard Worker   // Forces software echo cancellation on iOS. This is a temporary workaround
42*d9f75844SAndroid Build Coastguard Worker   // (until Apple fixes the bug) for a device with non-functioning AEC. May
43*d9f75844SAndroid Build Coastguard Worker   // improve performance on that particular device, but will cause unpredictable
44*d9f75844SAndroid Build Coastguard Worker   // behavior in all other cases. See http://bugs.webrtc.org/8682.
45*d9f75844SAndroid Build Coastguard Worker   absl::optional<bool> ios_force_software_aec_HACK;
46*d9f75844SAndroid Build Coastguard Worker #endif
47*d9f75844SAndroid Build Coastguard Worker   // Audio processing to adjust the sensitivity of the local mic dynamically.
48*d9f75844SAndroid Build Coastguard Worker   absl::optional<bool> auto_gain_control;
49*d9f75844SAndroid Build Coastguard Worker   // Audio processing to filter out background noise.
50*d9f75844SAndroid Build Coastguard Worker   absl::optional<bool> noise_suppression;
51*d9f75844SAndroid Build Coastguard Worker   // Audio processing to remove background noise of lower frequencies.
52*d9f75844SAndroid Build Coastguard Worker   absl::optional<bool> highpass_filter;
53*d9f75844SAndroid Build Coastguard Worker   // Audio processing to swap the left and right channels.
54*d9f75844SAndroid Build Coastguard Worker   absl::optional<bool> stereo_swapping;
55*d9f75844SAndroid Build Coastguard Worker   // Audio receiver jitter buffer (NetEq) max capacity in number of packets.
56*d9f75844SAndroid Build Coastguard Worker   absl::optional<int> audio_jitter_buffer_max_packets;
57*d9f75844SAndroid Build Coastguard Worker   // Audio receiver jitter buffer (NetEq) fast accelerate mode.
58*d9f75844SAndroid Build Coastguard Worker   absl::optional<bool> audio_jitter_buffer_fast_accelerate;
59*d9f75844SAndroid Build Coastguard Worker   // Audio receiver jitter buffer (NetEq) minimum target delay in milliseconds.
60*d9f75844SAndroid Build Coastguard Worker   absl::optional<int> audio_jitter_buffer_min_delay_ms;
61*d9f75844SAndroid Build Coastguard Worker   // Enable combined audio+bandwidth BWE.
62*d9f75844SAndroid Build Coastguard Worker   // TODO(pthatcher): This flag is set from the
63*d9f75844SAndroid Build Coastguard Worker   // "googCombinedAudioVideoBwe", but not used anywhere. So delete it,
64*d9f75844SAndroid Build Coastguard Worker   // and check if any other AudioOptions members are unused.
65*d9f75844SAndroid Build Coastguard Worker   absl::optional<bool> combined_audio_video_bwe;
66*d9f75844SAndroid Build Coastguard Worker   // Enable audio network adaptor.
67*d9f75844SAndroid Build Coastguard Worker   // TODO(webrtc:11717): Remove this API in favor of adaptivePtime in
68*d9f75844SAndroid Build Coastguard Worker   // RtpEncodingParameters.
69*d9f75844SAndroid Build Coastguard Worker   absl::optional<bool> audio_network_adaptor;
70*d9f75844SAndroid Build Coastguard Worker   // Config string for audio network adaptor.
71*d9f75844SAndroid Build Coastguard Worker   absl::optional<std::string> audio_network_adaptor_config;
72*d9f75844SAndroid Build Coastguard Worker   // Pre-initialize the ADM for recording when starting to send. Default to
73*d9f75844SAndroid Build Coastguard Worker   // true.
74*d9f75844SAndroid Build Coastguard Worker   // TODO(webrtc:13566): Remove this option. See issue for details.
75*d9f75844SAndroid Build Coastguard Worker   absl::optional<bool> init_recording_on_send;
76*d9f75844SAndroid Build Coastguard Worker };
77*d9f75844SAndroid Build Coastguard Worker 
78*d9f75844SAndroid Build Coastguard Worker }  // namespace cricket
79*d9f75844SAndroid Build Coastguard Worker 
80*d9f75844SAndroid Build Coastguard Worker #endif  // API_AUDIO_OPTIONS_H_
81