xref: /aosp_15_r20/external/webrtc/sdk/objc/components/audio/RTCAudioSession.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright 2016 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 #import <AVFoundation/AVFoundation.h>
12*d9f75844SAndroid Build Coastguard Worker #import <Foundation/Foundation.h>
13*d9f75844SAndroid Build Coastguard Worker 
14*d9f75844SAndroid Build Coastguard Worker #import "RTCMacros.h"
15*d9f75844SAndroid Build Coastguard Worker 
16*d9f75844SAndroid Build Coastguard Worker NS_ASSUME_NONNULL_BEGIN
17*d9f75844SAndroid Build Coastguard Worker 
18*d9f75844SAndroid Build Coastguard Worker extern NSString *const kRTCAudioSessionErrorDomain;
19*d9f75844SAndroid Build Coastguard Worker /** Method that requires lock was called without lock. */
20*d9f75844SAndroid Build Coastguard Worker extern NSInteger const kRTCAudioSessionErrorLockRequired;
21*d9f75844SAndroid Build Coastguard Worker /** Unknown configuration error occurred. */
22*d9f75844SAndroid Build Coastguard Worker extern NSInteger const kRTCAudioSessionErrorConfiguration;
23*d9f75844SAndroid Build Coastguard Worker 
24*d9f75844SAndroid Build Coastguard Worker @class RTC_OBJC_TYPE(RTCAudioSession);
25*d9f75844SAndroid Build Coastguard Worker @class RTC_OBJC_TYPE(RTCAudioSessionConfiguration);
26*d9f75844SAndroid Build Coastguard Worker 
27*d9f75844SAndroid Build Coastguard Worker // Surfaces AVAudioSession events. WebRTC will listen directly for notifications
28*d9f75844SAndroid Build Coastguard Worker // from AVAudioSession and handle them before calling these delegate methods,
29*d9f75844SAndroid Build Coastguard Worker // at which point applications can perform additional processing if required.
30*d9f75844SAndroid Build Coastguard Worker RTC_OBJC_EXPORT
31*d9f75844SAndroid Build Coastguard Worker @protocol RTC_OBJC_TYPE
32*d9f75844SAndroid Build Coastguard Worker (RTCAudioSessionDelegate)<NSObject>
33*d9f75844SAndroid Build Coastguard Worker 
34*d9f75844SAndroid Build Coastguard Worker     @optional
35*d9f75844SAndroid Build Coastguard Worker /** Called on a system notification thread when AVAudioSession starts an
36*d9f75844SAndroid Build Coastguard Worker  *  interruption event.
37*d9f75844SAndroid Build Coastguard Worker  */
38*d9f75844SAndroid Build Coastguard Worker - (void)audioSessionDidBeginInterruption:(RTC_OBJC_TYPE(RTCAudioSession) *)session;
39*d9f75844SAndroid Build Coastguard Worker 
40*d9f75844SAndroid Build Coastguard Worker /** Called on a system notification thread when AVAudioSession ends an
41*d9f75844SAndroid Build Coastguard Worker  *  interruption event.
42*d9f75844SAndroid Build Coastguard Worker  */
43*d9f75844SAndroid Build Coastguard Worker - (void)audioSessionDidEndInterruption:(RTC_OBJC_TYPE(RTCAudioSession) *)session
44*d9f75844SAndroid Build Coastguard Worker                    shouldResumeSession:(BOOL)shouldResumeSession;
45*d9f75844SAndroid Build Coastguard Worker 
46*d9f75844SAndroid Build Coastguard Worker /** Called on a system notification thread when AVAudioSession changes the
47*d9f75844SAndroid Build Coastguard Worker  *  route.
48*d9f75844SAndroid Build Coastguard Worker  */
49*d9f75844SAndroid Build Coastguard Worker - (void)audioSessionDidChangeRoute:(RTC_OBJC_TYPE(RTCAudioSession) *)session
50*d9f75844SAndroid Build Coastguard Worker                             reason:(AVAudioSessionRouteChangeReason)reason
51*d9f75844SAndroid Build Coastguard Worker                      previousRoute:(AVAudioSessionRouteDescription *)previousRoute;
52*d9f75844SAndroid Build Coastguard Worker 
53*d9f75844SAndroid Build Coastguard Worker /** Called on a system notification thread when AVAudioSession media server
54*d9f75844SAndroid Build Coastguard Worker  *  terminates.
55*d9f75844SAndroid Build Coastguard Worker  */
56*d9f75844SAndroid Build Coastguard Worker - (void)audioSessionMediaServerTerminated:(RTC_OBJC_TYPE(RTCAudioSession) *)session;
57*d9f75844SAndroid Build Coastguard Worker 
58*d9f75844SAndroid Build Coastguard Worker /** Called on a system notification thread when AVAudioSession media server
59*d9f75844SAndroid Build Coastguard Worker  *  restarts.
60*d9f75844SAndroid Build Coastguard Worker  */
61*d9f75844SAndroid Build Coastguard Worker - (void)audioSessionMediaServerReset:(RTC_OBJC_TYPE(RTCAudioSession) *)session;
62*d9f75844SAndroid Build Coastguard Worker 
63*d9f75844SAndroid Build Coastguard Worker // TODO(tkchin): Maybe handle SilenceSecondaryAudioHintNotification.
64*d9f75844SAndroid Build Coastguard Worker 
65*d9f75844SAndroid Build Coastguard Worker - (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)session
66*d9f75844SAndroid Build Coastguard Worker     didChangeCanPlayOrRecord:(BOOL)canPlayOrRecord;
67*d9f75844SAndroid Build Coastguard Worker 
68*d9f75844SAndroid Build Coastguard Worker /** Called on a WebRTC thread when the audio device is notified to begin
69*d9f75844SAndroid Build Coastguard Worker  *  playback or recording.
70*d9f75844SAndroid Build Coastguard Worker  */
71*d9f75844SAndroid Build Coastguard Worker - (void)audioSessionDidStartPlayOrRecord:(RTC_OBJC_TYPE(RTCAudioSession) *)session;
72*d9f75844SAndroid Build Coastguard Worker 
73*d9f75844SAndroid Build Coastguard Worker /** Called on a WebRTC thread when the audio device is notified to stop
74*d9f75844SAndroid Build Coastguard Worker  *  playback or recording.
75*d9f75844SAndroid Build Coastguard Worker  */
76*d9f75844SAndroid Build Coastguard Worker - (void)audioSessionDidStopPlayOrRecord:(RTC_OBJC_TYPE(RTCAudioSession) *)session;
77*d9f75844SAndroid Build Coastguard Worker 
78*d9f75844SAndroid Build Coastguard Worker /** Called when the AVAudioSession output volume value changes. */
79*d9f75844SAndroid Build Coastguard Worker - (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession
80*d9f75844SAndroid Build Coastguard Worker     didChangeOutputVolume:(float)outputVolume;
81*d9f75844SAndroid Build Coastguard Worker 
82*d9f75844SAndroid Build Coastguard Worker /** Called when the audio device detects a playout glitch. The argument is the
83*d9f75844SAndroid Build Coastguard Worker  *  number of glitches detected so far in the current audio playout session.
84*d9f75844SAndroid Build Coastguard Worker  */
85*d9f75844SAndroid Build Coastguard Worker - (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession
86*d9f75844SAndroid Build Coastguard Worker     didDetectPlayoutGlitch:(int64_t)totalNumberOfGlitches;
87*d9f75844SAndroid Build Coastguard Worker 
88*d9f75844SAndroid Build Coastguard Worker /** Called when the audio session is about to change the active state.
89*d9f75844SAndroid Build Coastguard Worker  */
90*d9f75844SAndroid Build Coastguard Worker - (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession willSetActive:(BOOL)active;
91*d9f75844SAndroid Build Coastguard Worker 
92*d9f75844SAndroid Build Coastguard Worker /** Called after the audio session sucessfully changed the active state.
93*d9f75844SAndroid Build Coastguard Worker  */
94*d9f75844SAndroid Build Coastguard Worker - (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession didSetActive:(BOOL)active;
95*d9f75844SAndroid Build Coastguard Worker 
96*d9f75844SAndroid Build Coastguard Worker /** Called after the audio session failed to change the active state.
97*d9f75844SAndroid Build Coastguard Worker  */
98*d9f75844SAndroid Build Coastguard Worker - (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession
99*d9f75844SAndroid Build Coastguard Worker     failedToSetActive:(BOOL)active
100*d9f75844SAndroid Build Coastguard Worker                 error:(NSError *)error;
101*d9f75844SAndroid Build Coastguard Worker 
102*d9f75844SAndroid Build Coastguard Worker - (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession
103*d9f75844SAndroid Build Coastguard Worker     audioUnitStartFailedWithError:(NSError *)error;
104*d9f75844SAndroid Build Coastguard Worker 
105*d9f75844SAndroid Build Coastguard Worker @end
106*d9f75844SAndroid Build Coastguard Worker 
107*d9f75844SAndroid Build Coastguard Worker /** This is a protocol used to inform RTCAudioSession when the audio session
108*d9f75844SAndroid Build Coastguard Worker  *  activation state has changed outside of RTCAudioSession. The current known use
109*d9f75844SAndroid Build Coastguard Worker  *  case of this is when CallKit activates the audio session for the application
110*d9f75844SAndroid Build Coastguard Worker  */
111*d9f75844SAndroid Build Coastguard Worker RTC_OBJC_EXPORT
112*d9f75844SAndroid Build Coastguard Worker @protocol RTC_OBJC_TYPE
113*d9f75844SAndroid Build Coastguard Worker (RTCAudioSessionActivationDelegate)<NSObject>
114*d9f75844SAndroid Build Coastguard Worker 
115*d9f75844SAndroid Build Coastguard Worker     /** Called when the audio session is activated outside of the app by iOS. */
116*d9f75844SAndroid Build Coastguard Worker     - (void)audioSessionDidActivate : (AVAudioSession *)session;
117*d9f75844SAndroid Build Coastguard Worker 
118*d9f75844SAndroid Build Coastguard Worker /** Called when the audio session is deactivated outside of the app by iOS. */
119*d9f75844SAndroid Build Coastguard Worker - (void)audioSessionDidDeactivate:(AVAudioSession *)session;
120*d9f75844SAndroid Build Coastguard Worker 
121*d9f75844SAndroid Build Coastguard Worker @end
122*d9f75844SAndroid Build Coastguard Worker 
123*d9f75844SAndroid Build Coastguard Worker /** Proxy class for AVAudioSession that adds a locking mechanism similar to
124*d9f75844SAndroid Build Coastguard Worker  *  AVCaptureDevice. This is used to that interleaving configurations between
125*d9f75844SAndroid Build Coastguard Worker  *  WebRTC and the application layer are avoided.
126*d9f75844SAndroid Build Coastguard Worker  *
127*d9f75844SAndroid Build Coastguard Worker  *  RTCAudioSession also coordinates activation so that the audio session is
128*d9f75844SAndroid Build Coastguard Worker  *  activated only once. See `setActive:error:`.
129*d9f75844SAndroid Build Coastguard Worker  */
130*d9f75844SAndroid Build Coastguard Worker RTC_OBJC_EXPORT
131*d9f75844SAndroid Build Coastguard Worker @interface RTC_OBJC_TYPE (RTCAudioSession) : NSObject <RTC_OBJC_TYPE(RTCAudioSessionActivationDelegate)>
132*d9f75844SAndroid Build Coastguard Worker 
133*d9f75844SAndroid Build Coastguard Worker /** Convenience property to access the AVAudioSession singleton. Callers should
134*d9f75844SAndroid Build Coastguard Worker  *  not call setters on AVAudioSession directly, but other method invocations
135*d9f75844SAndroid Build Coastguard Worker  *  are fine.
136*d9f75844SAndroid Build Coastguard Worker  */
137*d9f75844SAndroid Build Coastguard Worker @property(nonatomic, readonly) AVAudioSession *session;
138*d9f75844SAndroid Build Coastguard Worker 
139*d9f75844SAndroid Build Coastguard Worker /** Our best guess at whether the session is active based on results of calls to
140*d9f75844SAndroid Build Coastguard Worker  *  AVAudioSession.
141*d9f75844SAndroid Build Coastguard Worker  */
142*d9f75844SAndroid Build Coastguard Worker @property(nonatomic, readonly) BOOL isActive;
143*d9f75844SAndroid Build Coastguard Worker 
144*d9f75844SAndroid Build Coastguard Worker /** If YES, WebRTC will not initialize the audio unit automatically when an
145*d9f75844SAndroid Build Coastguard Worker  *  audio track is ready for playout or recording. Instead, applications should
146*d9f75844SAndroid Build Coastguard Worker  *  call setIsAudioEnabled. If NO, WebRTC will initialize the audio unit
147*d9f75844SAndroid Build Coastguard Worker  *  as soon as an audio track is ready for playout or recording.
148*d9f75844SAndroid Build Coastguard Worker  */
149*d9f75844SAndroid Build Coastguard Worker @property(nonatomic, assign) BOOL useManualAudio;
150*d9f75844SAndroid Build Coastguard Worker 
151*d9f75844SAndroid Build Coastguard Worker /** This property is only effective if useManualAudio is YES.
152*d9f75844SAndroid Build Coastguard Worker  *  Represents permission for WebRTC to initialize the VoIP audio unit.
153*d9f75844SAndroid Build Coastguard Worker  *  When set to NO, if the VoIP audio unit used by WebRTC is active, it will be
154*d9f75844SAndroid Build Coastguard Worker  *  stopped and uninitialized. This will stop incoming and outgoing audio.
155*d9f75844SAndroid Build Coastguard Worker  *  When set to YES, WebRTC will initialize and start the audio unit when it is
156*d9f75844SAndroid Build Coastguard Worker  *  needed (e.g. due to establishing an audio connection).
157*d9f75844SAndroid Build Coastguard Worker  *  This property was introduced to work around an issue where if an AVPlayer is
158*d9f75844SAndroid Build Coastguard Worker  *  playing audio while the VoIP audio unit is initialized, its audio would be
159*d9f75844SAndroid Build Coastguard Worker  *  either cut off completely or played at a reduced volume. By preventing
160*d9f75844SAndroid Build Coastguard Worker  *  the audio unit from being initialized until after the audio has completed,
161*d9f75844SAndroid Build Coastguard Worker  *  we are able to prevent the abrupt cutoff.
162*d9f75844SAndroid Build Coastguard Worker  */
163*d9f75844SAndroid Build Coastguard Worker @property(nonatomic, assign) BOOL isAudioEnabled;
164*d9f75844SAndroid Build Coastguard Worker 
165*d9f75844SAndroid Build Coastguard Worker // Proxy properties.
166*d9f75844SAndroid Build Coastguard Worker @property(readonly) NSString *category;
167*d9f75844SAndroid Build Coastguard Worker @property(readonly) AVAudioSessionCategoryOptions categoryOptions;
168*d9f75844SAndroid Build Coastguard Worker @property(readonly) NSString *mode;
169*d9f75844SAndroid Build Coastguard Worker @property(readonly) BOOL secondaryAudioShouldBeSilencedHint;
170*d9f75844SAndroid Build Coastguard Worker @property(readonly) AVAudioSessionRouteDescription *currentRoute;
171*d9f75844SAndroid Build Coastguard Worker @property(readonly) NSInteger maximumInputNumberOfChannels;
172*d9f75844SAndroid Build Coastguard Worker @property(readonly) NSInteger maximumOutputNumberOfChannels;
173*d9f75844SAndroid Build Coastguard Worker @property(readonly) float inputGain;
174*d9f75844SAndroid Build Coastguard Worker @property(readonly) BOOL inputGainSettable;
175*d9f75844SAndroid Build Coastguard Worker @property(readonly) BOOL inputAvailable;
176*d9f75844SAndroid Build Coastguard Worker @property(readonly, nullable) NSArray<AVAudioSessionDataSourceDescription *> *inputDataSources;
177*d9f75844SAndroid Build Coastguard Worker @property(readonly, nullable) AVAudioSessionDataSourceDescription *inputDataSource;
178*d9f75844SAndroid Build Coastguard Worker @property(readonly, nullable) NSArray<AVAudioSessionDataSourceDescription *> *outputDataSources;
179*d9f75844SAndroid Build Coastguard Worker @property(readonly, nullable) AVAudioSessionDataSourceDescription *outputDataSource;
180*d9f75844SAndroid Build Coastguard Worker @property(readonly) double sampleRate;
181*d9f75844SAndroid Build Coastguard Worker @property(readonly) double preferredSampleRate;
182*d9f75844SAndroid Build Coastguard Worker @property(readonly) NSInteger inputNumberOfChannels;
183*d9f75844SAndroid Build Coastguard Worker @property(readonly) NSInteger outputNumberOfChannels;
184*d9f75844SAndroid Build Coastguard Worker @property(readonly) float outputVolume;
185*d9f75844SAndroid Build Coastguard Worker @property(readonly) NSTimeInterval inputLatency;
186*d9f75844SAndroid Build Coastguard Worker @property(readonly) NSTimeInterval outputLatency;
187*d9f75844SAndroid Build Coastguard Worker @property(readonly) NSTimeInterval IOBufferDuration;
188*d9f75844SAndroid Build Coastguard Worker @property(readonly) NSTimeInterval preferredIOBufferDuration;
189*d9f75844SAndroid Build Coastguard Worker 
190*d9f75844SAndroid Build Coastguard Worker /**
191*d9f75844SAndroid Build Coastguard Worker  When YES, calls to -setConfiguration:error: and -setConfiguration:active:error: ignore errors in
192*d9f75844SAndroid Build Coastguard Worker  configuring the audio session's "preferred" attributes (e.g. preferredInputNumberOfChannels).
193*d9f75844SAndroid Build Coastguard Worker  Typically, configurations to preferred attributes are optimizations, and ignoring this type of
194*d9f75844SAndroid Build Coastguard Worker  configuration error allows code flow to continue along the happy path when these optimization are
195*d9f75844SAndroid Build Coastguard Worker  not available. The default value of this property is NO.
196*d9f75844SAndroid Build Coastguard Worker  */
197*d9f75844SAndroid Build Coastguard Worker @property(nonatomic) BOOL ignoresPreferredAttributeConfigurationErrors;
198*d9f75844SAndroid Build Coastguard Worker 
199*d9f75844SAndroid Build Coastguard Worker /** Default constructor. */
200*d9f75844SAndroid Build Coastguard Worker + (instancetype)sharedInstance;
201*d9f75844SAndroid Build Coastguard Worker - (instancetype)init NS_UNAVAILABLE;
202*d9f75844SAndroid Build Coastguard Worker 
203*d9f75844SAndroid Build Coastguard Worker /** Adds a delegate, which is held weakly. */
204*d9f75844SAndroid Build Coastguard Worker - (void)addDelegate:(id<RTC_OBJC_TYPE(RTCAudioSessionDelegate)>)delegate;
205*d9f75844SAndroid Build Coastguard Worker /** Removes an added delegate. */
206*d9f75844SAndroid Build Coastguard Worker - (void)removeDelegate:(id<RTC_OBJC_TYPE(RTCAudioSessionDelegate)>)delegate;
207*d9f75844SAndroid Build Coastguard Worker 
208*d9f75844SAndroid Build Coastguard Worker /** Request exclusive access to the audio session for configuration. This call
209*d9f75844SAndroid Build Coastguard Worker  *  will block if the lock is held by another object.
210*d9f75844SAndroid Build Coastguard Worker  */
211*d9f75844SAndroid Build Coastguard Worker - (void)lockForConfiguration;
212*d9f75844SAndroid Build Coastguard Worker /** Relinquishes exclusive access to the audio session. */
213*d9f75844SAndroid Build Coastguard Worker - (void)unlockForConfiguration;
214*d9f75844SAndroid Build Coastguard Worker 
215*d9f75844SAndroid Build Coastguard Worker /** If `active`, activates the audio session if it isn't already active.
216*d9f75844SAndroid Build Coastguard Worker  *  Successful calls must be balanced with a setActive:NO when activation is no
217*d9f75844SAndroid Build Coastguard Worker  *  longer required. If not `active`, deactivates the audio session if one is
218*d9f75844SAndroid Build Coastguard Worker  *  active and this is the last balanced call. When deactivating, the
219*d9f75844SAndroid Build Coastguard Worker  *  AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation option is passed to
220*d9f75844SAndroid Build Coastguard Worker  *  AVAudioSession.
221*d9f75844SAndroid Build Coastguard Worker  */
222*d9f75844SAndroid Build Coastguard Worker - (BOOL)setActive:(BOOL)active error:(NSError **)outError;
223*d9f75844SAndroid Build Coastguard Worker 
224*d9f75844SAndroid Build Coastguard Worker // The following methods are proxies for the associated methods on
225*d9f75844SAndroid Build Coastguard Worker // AVAudioSession. `lockForConfiguration` must be called before using them
226*d9f75844SAndroid Build Coastguard Worker // otherwise they will fail with kRTCAudioSessionErrorLockRequired.
227*d9f75844SAndroid Build Coastguard Worker 
228*d9f75844SAndroid Build Coastguard Worker - (BOOL)setCategory:(NSString *)category
229*d9f75844SAndroid Build Coastguard Worker         withOptions:(AVAudioSessionCategoryOptions)options
230*d9f75844SAndroid Build Coastguard Worker               error:(NSError **)outError;
231*d9f75844SAndroid Build Coastguard Worker - (BOOL)setMode:(NSString *)mode error:(NSError **)outError;
232*d9f75844SAndroid Build Coastguard Worker - (BOOL)setInputGain:(float)gain error:(NSError **)outError;
233*d9f75844SAndroid Build Coastguard Worker - (BOOL)setPreferredSampleRate:(double)sampleRate error:(NSError **)outError;
234*d9f75844SAndroid Build Coastguard Worker - (BOOL)setPreferredIOBufferDuration:(NSTimeInterval)duration error:(NSError **)outError;
235*d9f75844SAndroid Build Coastguard Worker - (BOOL)setPreferredInputNumberOfChannels:(NSInteger)count error:(NSError **)outError;
236*d9f75844SAndroid Build Coastguard Worker - (BOOL)setPreferredOutputNumberOfChannels:(NSInteger)count error:(NSError **)outError;
237*d9f75844SAndroid Build Coastguard Worker - (BOOL)overrideOutputAudioPort:(AVAudioSessionPortOverride)portOverride error:(NSError **)outError;
238*d9f75844SAndroid Build Coastguard Worker - (BOOL)setPreferredInput:(AVAudioSessionPortDescription *)inPort error:(NSError **)outError;
239*d9f75844SAndroid Build Coastguard Worker - (BOOL)setInputDataSource:(AVAudioSessionDataSourceDescription *)dataSource
240*d9f75844SAndroid Build Coastguard Worker                      error:(NSError **)outError;
241*d9f75844SAndroid Build Coastguard Worker - (BOOL)setOutputDataSource:(AVAudioSessionDataSourceDescription *)dataSource
242*d9f75844SAndroid Build Coastguard Worker                       error:(NSError **)outError;
243*d9f75844SAndroid Build Coastguard Worker @end
244*d9f75844SAndroid Build Coastguard Worker 
245*d9f75844SAndroid Build Coastguard Worker @interface RTC_OBJC_TYPE (RTCAudioSession)
246*d9f75844SAndroid Build Coastguard Worker (Configuration)
247*d9f75844SAndroid Build Coastguard Worker 
248*d9f75844SAndroid Build Coastguard Worker     /** Applies the configuration to the current session. Attempts to set all
249*d9f75844SAndroid Build Coastguard Worker      *  properties even if previous ones fail. Only the last error will be
250*d9f75844SAndroid Build Coastguard Worker      *  returned.
251*d9f75844SAndroid Build Coastguard Worker      *  `lockForConfiguration` must be called first.
252*d9f75844SAndroid Build Coastguard Worker      */
253*d9f75844SAndroid Build Coastguard Worker     - (BOOL)setConfiguration : (RTC_OBJC_TYPE(RTCAudioSessionConfiguration) *)configuration error
254*d9f75844SAndroid Build Coastguard Worker     : (NSError **)outError;
255*d9f75844SAndroid Build Coastguard Worker 
256*d9f75844SAndroid Build Coastguard Worker /** Convenience method that calls both setConfiguration and setActive.
257*d9f75844SAndroid Build Coastguard Worker  *  `lockForConfiguration` must be called first.
258*d9f75844SAndroid Build Coastguard Worker  */
259*d9f75844SAndroid Build Coastguard Worker - (BOOL)setConfiguration:(RTC_OBJC_TYPE(RTCAudioSessionConfiguration) *)configuration
260*d9f75844SAndroid Build Coastguard Worker                   active:(BOOL)active
261*d9f75844SAndroid Build Coastguard Worker                    error:(NSError **)outError;
262*d9f75844SAndroid Build Coastguard Worker 
263*d9f75844SAndroid Build Coastguard Worker @end
264*d9f75844SAndroid Build Coastguard Worker 
265*d9f75844SAndroid Build Coastguard Worker NS_ASSUME_NONNULL_END
266