Chromium Code Reviews| Index: webrtc/modules/audio_device/ios/objc/RTCAudioSession.h |
| diff --git a/webrtc/modules/audio_device/ios/objc/RTCAudioSession.h b/webrtc/modules/audio_device/ios/objc/RTCAudioSession.h |
| index ab8dbc8859e64bebc404ffebc52e5950a11e07e9..9bf9ba24e2a5472a4f270d59e31a02eb78e52857 100644 |
| --- a/webrtc/modules/audio_device/ios/objc/RTCAudioSession.h |
| +++ b/webrtc/modules/audio_device/ios/objc/RTCAudioSession.h |
| @@ -58,29 +58,18 @@ extern NSInteger const kRTCAudioSessionErrorConfiguration; |
| // TODO(tkchin): Maybe handle SilenceSecondaryAudioHintNotification. |
| -/** Called on a WebRTC thread when WebRTC needs to take over audio. Applications |
| - * should call -[RTCAudioSession configureWebRTCSession] to allow WebRTC to |
| - * play and record audio. Will only occur if shouldDelayAudioConfiguration is |
| - * set to YES. |
| - */ |
| -- (void)audioSessionShouldConfigure:(RTCAudioSession *)session; |
| - |
| -/** Called on a WebRTC thread when WebRTC no longer requires audio. Applications |
| - * should call -[RTCAudioSession unconfigureWebRTCSession] to restore their |
| - * audio session settings. Will only occur if shouldDelayAudioConfiguration is |
| - * set to YES. |
| - */ |
| -- (void)audioSessionShouldUnconfigure:(RTCAudioSession *)session; |
| +- (void)audioSession:(RTCAudioSession *)session |
| + didChangeCanPlayOrRecord:(BOOL)canPlayOrRecord; |
| -/** Called on a WebRTC thread when WebRTC has configured the audio session for |
| - * WebRTC audio. |
| +/** Called on a WebRTC thread when the audio device is notified to begin |
| + * playback or recording. |
| */ |
| -- (void)audioSessionDidConfigure:(RTCAudioSession *)session; |
| +- (void)audioSessionDidStartPlayOrRecord:(RTCAudioSession *)session; |
| -/** Called on a WebRTC thread when WebRTC has unconfigured the audio session for |
| - * WebRTC audio. |
| +/** Called on a WebRTC thread when the audio device is notified to stop |
| + * playback or recording. |
| */ |
| -- (void)audioSessionDidUnconfigure:(RTCAudioSession *)session; |
| +- (void)audioSessionDidStopPlayOrRecord:(RTCAudioSession *)session; |
| @end |
| @@ -108,11 +97,16 @@ extern NSInteger const kRTCAudioSessionErrorConfiguration; |
| /** If YES, WebRTC will not initialize the audio unit automatically when an |
| * audio track is ready for playout or recording. Instead, applications should |
| - * listen to the delegate method |audioSessionShouldConfigure| and configure |
| - * the session manually. This should be set before making WebRTC media calls |
| - * and should not be changed while a call is active. |
| + * call setIsWebRTCAudioEnabled. If NO, WebRTC will initialize the audio unit |
| + * as soon as an audio track is ready for playout or recording. |
| + */ |
| +@property(nonatomic, assign) BOOL useManualAudio; |
| +/** Setting this to YES will cause the audio session to be configured for WebRTC |
|
henrika_webrtc
2016/05/04 12:33:07
Rather tricky to read IMHO. Can you add an example
tkchin_webrtc
2016/05/05 23:23:28
Better?
henrika_webrtc
2016/05/06 11:22:16
Perfect ;-)
|
| + * and activated, and the audio unit to be initialized and started, provided |
| + * an audio track is active. Likewise, setting this to NO will terminate any |
| + * current audio. This property is ignored if useManualAudio is NO. |
| */ |
| -@property(nonatomic, assign) BOOL shouldDelayAudioConfiguration; |
| +@property(nonatomic, assign) BOOL isAudioEnabled; |
| // Proxy properties. |
| @property(readonly) NSString *category; |
| @@ -134,12 +128,14 @@ extern NSInteger const kRTCAudioSessionErrorConfiguration; |
| @property(readonly, nullable) |
| AVAudioSessionDataSourceDescription *outputDataSource; |
| @property(readonly) double sampleRate; |
| +@property(readonly) double preferredSampleRate; |
| @property(readonly) NSInteger inputNumberOfChannels; |
| @property(readonly) NSInteger outputNumberOfChannels; |
| @property(readonly) float outputVolume; |
| @property(readonly) NSTimeInterval inputLatency; |
| @property(readonly) NSTimeInterval outputLatency; |
| @property(readonly) NSTimeInterval IOBufferDuration; |
| +@property(readonly) NSTimeInterval preferredIOBufferDuration; |
| /** Default constructor. */ |
| + (instancetype)sharedInstance; |
| @@ -196,36 +192,20 @@ extern NSInteger const kRTCAudioSessionErrorConfiguration; |
| @interface RTCAudioSession (Configuration) |
| -/** Whether or not |configureWebRTCSession| has been called without a balanced |
| - * call to |unconfigureWebRTCSession|. This is not an indication of whether the |
| - * audio session has the right settings. |
| - */ |
| -@property(readonly) BOOL isConfiguredForWebRTC; |
| - |
| /** Applies the configuration to the current session. Attempts to set all |
| * properties even if previous ones fail. Only the last error will be |
| - * returned. Also calls setActive with |active|. |
| + * returned. |
| * |lockForConfiguration| must be called first. |
| */ |
| - (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration |
| - active:(BOOL)active |
| error:(NSError **)outError; |
| -/** Configure the audio session for WebRTC. This call will fail if the session |
| - * is already configured. On other failures, we will attempt to restore the |
| - * previously used audio session configuration. |
| +/** Convenience method that calls both setConfiguration and setActive. |
| * |lockForConfiguration| must be called first. |
| - * Successful calls to configureWebRTCSession must be matched by calls to |
| - * |unconfigureWebRTCSession|. |
| */ |
| -- (BOOL)configureWebRTCSession:(NSError **)outError; |
| - |
| -/** Unconfigures the session for WebRTC. This will attempt to restore the |
| - * audio session to the settings used before |configureWebRTCSession| was |
| - * called. |
| - * |lockForConfiguration| must be called first. |
| - */ |
| -- (BOOL)unconfigureWebRTCSession:(NSError **)outError; |
| +- (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration |
| + active:(BOOL)active |
| + error:(NSError **)outError; |
| @end |