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 "webrtc/modules/audio_device/ios/objc/RTCAudioSession.h" | 11 #import "webrtc/modules/audio_device/ios/objc/RTCAudioSession.h" |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 NS_ASSUME_NONNULL_BEGIN | 15 NS_ASSUME_NONNULL_BEGIN |
16 | 16 |
| 17 @class RTCAudioSessionConfiguration; |
| 18 |
17 @interface RTCAudioSession () | 19 @interface RTCAudioSession () |
18 | 20 |
19 /** Number of times setActive:YES has succeeded without a balanced call to | 21 /** Number of times setActive:YES has succeeded without a balanced call to |
20 * setActive:NO. | 22 * setActive:NO. |
21 */ | 23 */ |
22 @property(nonatomic, readonly) NSInteger activationCount; | 24 @property(nonatomic, readonly) int activationCount; |
| 25 |
| 26 /** The number of times |beginWebRTCSession| was called without a balanced call |
| 27 * to |endWebRTCSession|. |
| 28 */ |
| 29 @property(nonatomic, readonly) int webRTCSessionCount; |
| 30 |
| 31 /** The configuration of the audio session before configureWebRTCSession |
| 32 * was first called. |
| 33 */ |
| 34 @property(nonatomic, strong, nullable) |
| 35 RTCAudioSessionConfiguration *savedConfiguration; |
23 | 36 |
24 - (BOOL)checkLock:(NSError **)outError; | 37 - (BOOL)checkLock:(NSError **)outError; |
25 | 38 |
26 /** Adds the delegate to the list of delegates, and places it at the front of | 39 /** Adds the delegate to the list of delegates, and places it at the front of |
27 * the list. This delegate will be notified before other delegates of | 40 * the list. This delegate will be notified before other delegates of |
28 * audio events. | 41 * audio events. |
29 */ | 42 */ |
30 - (void)pushDelegate:(id<RTCAudioSessionDelegate>)delegate; | 43 - (void)pushDelegate:(id<RTCAudioSessionDelegate>)delegate; |
31 | 44 |
| 45 /** Signals RTCAudioSession that a WebRTC session is about to begin and |
| 46 * audio configuration is needed. Will configure the audio session for WebRTC |
| 47 * if not already configured and if configuration is not delayed. |
| 48 * Successful calls must be balanced by a call to endWebRTCSession. |
| 49 */ |
| 50 - (BOOL)beginWebRTCSession:(NSError **)outError; |
| 51 |
| 52 /** Signals RTCAudioSession that a WebRTC session is about to end and audio |
| 53 * unconfiguration is needed. Will unconfigure the audio session for WebRTC |
| 54 * if this is the last unmatched call and if configuration is not delayed. |
| 55 */ |
| 56 - (BOOL)endWebRTCSession:(NSError **)outError; |
| 57 |
| 58 /** Returns a configuration error with the given description. */ |
| 59 - (NSError *)configurationErrorWithDescription:(NSString *)description; |
| 60 |
32 // Properties and methods for tests. | 61 // Properties and methods for tests. |
33 @property(nonatomic, readonly) | 62 @property(nonatomic, readonly) |
34 std::vector<__weak id<RTCAudioSessionDelegate> > delegates; | 63 std::vector<__weak id<RTCAudioSessionDelegate> > delegates; |
| 64 |
35 - (void)notifyDidBeginInterruption; | 65 - (void)notifyDidBeginInterruption; |
36 - (void)notifyDidEndInterruptionWithShouldResumeSession: | 66 - (void)notifyDidEndInterruptionWithShouldResumeSession: |
37 (BOOL)shouldResumeSession; | 67 (BOOL)shouldResumeSession; |
38 - (void)notifyDidChangeRouteWithReason:(AVAudioSessionRouteChangeReason)reason | 68 - (void)notifyDidChangeRouteWithReason:(AVAudioSessionRouteChangeReason)reason |
39 previousRoute:(AVAudioSessionRouteDescription *)previousRoute; | 69 previousRoute:(AVAudioSessionRouteDescription *)previousRoute; |
40 - (void)notifyMediaServicesWereLost; | 70 - (void)notifyMediaServicesWereLost; |
41 - (void)notifyMediaServicesWereReset; | 71 - (void)notifyMediaServicesWereReset; |
| 72 - (void)notifyShouldConfigure; |
| 73 - (void)notifyShouldUnconfigure; |
| 74 - (void)notifyDidConfigure; |
| 75 - (void)notifyDidUnconfigure; |
42 | 76 |
43 @end | 77 @end |
44 | 78 |
45 NS_ASSUME_NONNULL_END | 79 NS_ASSUME_NONNULL_END |
OLD | NEW |