| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 */ | 69 */ |
| 70 - (void)audioSessionDidStartPlayOrRecord:(RTCAudioSession *)session; | 70 - (void)audioSessionDidStartPlayOrRecord:(RTCAudioSession *)session; |
| 71 | 71 |
| 72 /** Called on a WebRTC thread when the audio device is notified to stop | 72 /** Called on a WebRTC thread when the audio device is notified to stop |
| 73 * playback or recording. | 73 * playback or recording. |
| 74 */ | 74 */ |
| 75 - (void)audioSessionDidStopPlayOrRecord:(RTCAudioSession *)session; | 75 - (void)audioSessionDidStopPlayOrRecord:(RTCAudioSession *)session; |
| 76 | 76 |
| 77 @end | 77 @end |
| 78 | 78 |
| 79 /** This is a protocol used to inform RTCAudioSession when the audio session |
| 80 * activation state has changed outside of RTCAudioSession. The current known u
se |
| 81 * case of this is when CallKit activates the audio session for the application |
| 82 */ |
| 83 RTC_EXPORT |
| 84 @protocol RTCAudioSessionActivationDelegate <NSObject> |
| 85 |
| 86 /** Called when the audio session is activated outside of the app by iOS. */ |
| 87 - (void)audioSessionDidActivate:(AVAudioSession *)session; |
| 88 |
| 89 /** Called when the audio session is deactivated outside of the app by iOS. */ |
| 90 - (void)audioSessionDidDeactivate:(AVAudioSession *)session; |
| 91 |
| 92 @end |
| 93 |
| 79 /** Proxy class for AVAudioSession that adds a locking mechanism similar to | 94 /** Proxy class for AVAudioSession that adds a locking mechanism similar to |
| 80 * AVCaptureDevice. This is used to that interleaving configurations between | 95 * AVCaptureDevice. This is used to that interleaving configurations between |
| 81 * WebRTC and the application layer are avoided. | 96 * WebRTC and the application layer are avoided. |
| 82 * | 97 * |
| 83 * RTCAudioSession also coordinates activation so that the audio session is | 98 * RTCAudioSession also coordinates activation so that the audio session is |
| 84 * activated only once. See |setActive:error:|. | 99 * activated only once. See |setActive:error:|. |
| 85 */ | 100 */ |
| 86 RTC_EXPORT | 101 RTC_EXPORT |
| 87 @interface RTCAudioSession : NSObject | 102 @interface RTCAudioSession : NSObject <RTCAudioSessionActivationDelegate> |
| 88 | 103 |
| 89 /** Convenience property to access the AVAudioSession singleton. Callers should | 104 /** Convenience property to access the AVAudioSession singleton. Callers should |
| 90 * not call setters on AVAudioSession directly, but other method invocations | 105 * not call setters on AVAudioSession directly, but other method invocations |
| 91 * are fine. | 106 * are fine. |
| 92 */ | 107 */ |
| 93 @property(nonatomic, readonly) AVAudioSession *session; | 108 @property(nonatomic, readonly) AVAudioSession *session; |
| 94 | 109 |
| 95 /** Our best guess at whether the session is active based on results of calls to | 110 /** Our best guess at whether the session is active based on results of calls to |
| 96 * AVAudioSession. | 111 * AVAudioSession. |
| 97 */ | 112 */ |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 - (BOOL)setPreferredOutputNumberOfChannels:(NSInteger)count | 207 - (BOOL)setPreferredOutputNumberOfChannels:(NSInteger)count |
| 193 error:(NSError **)outError; | 208 error:(NSError **)outError; |
| 194 - (BOOL)overrideOutputAudioPort:(AVAudioSessionPortOverride)portOverride | 209 - (BOOL)overrideOutputAudioPort:(AVAudioSessionPortOverride)portOverride |
| 195 error:(NSError **)outError; | 210 error:(NSError **)outError; |
| 196 - (BOOL)setPreferredInput:(AVAudioSessionPortDescription *)inPort | 211 - (BOOL)setPreferredInput:(AVAudioSessionPortDescription *)inPort |
| 197 error:(NSError **)outError; | 212 error:(NSError **)outError; |
| 198 - (BOOL)setInputDataSource:(AVAudioSessionDataSourceDescription *)dataSource | 213 - (BOOL)setInputDataSource:(AVAudioSessionDataSourceDescription *)dataSource |
| 199 error:(NSError **)outError; | 214 error:(NSError **)outError; |
| 200 - (BOOL)setOutputDataSource:(AVAudioSessionDataSourceDescription *)dataSource | 215 - (BOOL)setOutputDataSource:(AVAudioSessionDataSourceDescription *)dataSource |
| 201 error:(NSError **)outError; | 216 error:(NSError **)outError; |
| 202 | |
| 203 @end | 217 @end |
| 204 | 218 |
| 205 @interface RTCAudioSession (Configuration) | 219 @interface RTCAudioSession (Configuration) |
| 206 | 220 |
| 207 /** Applies the configuration to the current session. Attempts to set all | 221 /** Applies the configuration to the current session. Attempts to set all |
| 208 * properties even if previous ones fail. Only the last error will be | 222 * properties even if previous ones fail. Only the last error will be |
| 209 * returned. | 223 * returned. |
| 210 * |lockForConfiguration| must be called first. | 224 * |lockForConfiguration| must be called first. |
| 211 */ | 225 */ |
| 212 - (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration | 226 - (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration |
| 213 error:(NSError **)outError; | 227 error:(NSError **)outError; |
| 214 | 228 |
| 215 /** Convenience method that calls both setConfiguration and setActive. | 229 /** Convenience method that calls both setConfiguration and setActive. |
| 216 * |lockForConfiguration| must be called first. | 230 * |lockForConfiguration| must be called first. |
| 217 */ | 231 */ |
| 218 - (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration | 232 - (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration |
| 219 active:(BOOL)active | 233 active:(BOOL)active |
| 220 error:(NSError **)outError; | 234 error:(NSError **)outError; |
| 221 | 235 |
| 222 @end | 236 @end |
| 223 | 237 |
| 224 NS_ASSUME_NONNULL_END | 238 NS_ASSUME_NONNULL_END |
| OLD | NEW |