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 |
11 #import <AVFoundation/AVFoundation.h> | 11 #import <AVFoundation/AVFoundation.h> |
12 #import <Foundation/Foundation.h> | 12 #import <Foundation/Foundation.h> |
13 | 13 |
| 14 #import "WebRTC/RTCMacros.h" |
| 15 |
14 NS_ASSUME_NONNULL_BEGIN | 16 NS_ASSUME_NONNULL_BEGIN |
15 | 17 |
16 extern NSString * const kRTCAudioSessionErrorDomain; | 18 extern NSString * const kRTCAudioSessionErrorDomain; |
17 /** Method that requires lock was called without lock. */ | 19 /** Method that requires lock was called without lock. */ |
18 extern NSInteger const kRTCAudioSessionErrorLockRequired; | 20 extern NSInteger const kRTCAudioSessionErrorLockRequired; |
19 /** Unknown configuration error occurred. */ | 21 /** Unknown configuration error occurred. */ |
20 extern NSInteger const kRTCAudioSessionErrorConfiguration; | 22 extern NSInteger const kRTCAudioSessionErrorConfiguration; |
21 | 23 |
22 @class RTCAudioSession; | 24 @class RTCAudioSession; |
23 @class RTCAudioSessionConfiguration; | 25 @class RTCAudioSessionConfiguration; |
24 | 26 |
25 // Surfaces AVAudioSession events. WebRTC will listen directly for notifications | 27 // Surfaces AVAudioSession events. WebRTC will listen directly for notifications |
26 // from AVAudioSession and handle them before calling these delegate methods, | 28 // from AVAudioSession and handle them before calling these delegate methods, |
27 // at which point applications can perform additional processing if required. | 29 // at which point applications can perform additional processing if required. |
| 30 RTC_EXPORT |
28 @protocol RTCAudioSessionDelegate <NSObject> | 31 @protocol RTCAudioSessionDelegate <NSObject> |
29 | 32 |
30 @optional | 33 @optional |
31 /** Called on a system notification thread when AVAudioSession starts an | 34 /** Called on a system notification thread when AVAudioSession starts an |
32 * interruption event. | 35 * interruption event. |
33 */ | 36 */ |
34 - (void)audioSessionDidBeginInterruption:(RTCAudioSession *)session; | 37 - (void)audioSessionDidBeginInterruption:(RTCAudioSession *)session; |
35 | 38 |
36 /** Called on a system notification thread when AVAudioSession ends an | 39 /** Called on a system notification thread when AVAudioSession ends an |
37 * interruption event. | 40 * interruption event. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 76 |
74 @end | 77 @end |
75 | 78 |
76 /** Proxy class for AVAudioSession that adds a locking mechanism similar to | 79 /** Proxy class for AVAudioSession that adds a locking mechanism similar to |
77 * AVCaptureDevice. This is used to that interleaving configurations between | 80 * AVCaptureDevice. This is used to that interleaving configurations between |
78 * WebRTC and the application layer are avoided. | 81 * WebRTC and the application layer are avoided. |
79 * | 82 * |
80 * RTCAudioSession also coordinates activation so that the audio session is | 83 * RTCAudioSession also coordinates activation so that the audio session is |
81 * activated only once. See |setActive:error:|. | 84 * activated only once. See |setActive:error:|. |
82 */ | 85 */ |
| 86 RTC_EXPORT |
83 @interface RTCAudioSession : NSObject | 87 @interface RTCAudioSession : NSObject |
84 | 88 |
85 /** Convenience property to access the AVAudioSession singleton. Callers should | 89 /** Convenience property to access the AVAudioSession singleton. Callers should |
86 * not call setters on AVAudioSession directly, but other method invocations | 90 * not call setters on AVAudioSession directly, but other method invocations |
87 * are fine. | 91 * are fine. |
88 */ | 92 */ |
89 @property(nonatomic, readonly) AVAudioSession *session; | 93 @property(nonatomic, readonly) AVAudioSession *session; |
90 | 94 |
91 /** Our best guess at whether the session is active based on results of calls to | 95 /** Our best guess at whether the session is active based on results of calls to |
92 * AVAudioSession. | 96 * AVAudioSession. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 /** Convenience method that calls both setConfiguration and setActive. | 215 /** Convenience method that calls both setConfiguration and setActive. |
212 * |lockForConfiguration| must be called first. | 216 * |lockForConfiguration| must be called first. |
213 */ | 217 */ |
214 - (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration | 218 - (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration |
215 active:(BOOL)active | 219 active:(BOOL)active |
216 error:(NSError **)outError; | 220 error:(NSError **)outError; |
217 | 221 |
218 @end | 222 @end |
219 | 223 |
220 NS_ASSUME_NONNULL_END | 224 NS_ASSUME_NONNULL_END |
OLD | NEW |