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 10 matching lines...) Expand all Loading... |
21 /** 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 |
22 * setActive:NO. | 22 * setActive:NO. |
23 */ | 23 */ |
24 @property(nonatomic, readonly) int activationCount; | 24 @property(nonatomic, readonly) int activationCount; |
25 | 25 |
26 /** The number of times |beginWebRTCSession| was called without a balanced call | 26 /** The number of times |beginWebRTCSession| was called without a balanced call |
27 * to |endWebRTCSession|. | 27 * to |endWebRTCSession|. |
28 */ | 28 */ |
29 @property(nonatomic, readonly) int webRTCSessionCount; | 29 @property(nonatomic, readonly) int webRTCSessionCount; |
30 | 30 |
31 /** The configuration of the audio session before configureWebRTCSession | 31 /** Convenience BOOL that checks useManualAudio and isAudioEnebled. */ |
32 * was first called. | 32 @property(readonly) BOOL canPlayOrRecord; |
33 */ | |
34 @property(nonatomic, strong, nullable) | |
35 RTCAudioSessionConfiguration *savedConfiguration; | |
36 | 33 |
37 - (BOOL)checkLock:(NSError **)outError; | 34 - (BOOL)checkLock:(NSError **)outError; |
38 | 35 |
39 /** Adds the delegate to the list of delegates, and places it at the front of | 36 /** Adds the delegate to the list of delegates, and places it at the front of |
40 * the list. This delegate will be notified before other delegates of | 37 * the list. This delegate will be notified before other delegates of |
41 * audio events. | 38 * audio events. |
42 */ | 39 */ |
43 - (void)pushDelegate:(id<RTCAudioSessionDelegate>)delegate; | 40 - (void)pushDelegate:(id<RTCAudioSessionDelegate>)delegate; |
44 | 41 |
45 /** Signals RTCAudioSession that a WebRTC session is about to begin and | 42 /** Signals RTCAudioSession that a WebRTC session is about to begin and |
46 * audio configuration is needed. Will configure the audio session for WebRTC | 43 * audio configuration is needed. Will configure the audio session for WebRTC |
47 * if not already configured and if configuration is not delayed. | 44 * if not already configured and if configuration is not delayed. |
48 * Successful calls must be balanced by a call to endWebRTCSession. | 45 * Successful calls must be balanced by a call to endWebRTCSession. |
49 */ | 46 */ |
50 - (BOOL)beginWebRTCSession:(NSError **)outError; | 47 - (BOOL)beginWebRTCSession:(NSError **)outError; |
51 | 48 |
52 /** Signals RTCAudioSession that a WebRTC session is about to end and audio | 49 /** Signals RTCAudioSession that a WebRTC session is about to end and audio |
53 * unconfiguration is needed. Will unconfigure the audio session for WebRTC | 50 * unconfiguration is needed. Will unconfigure the audio session for WebRTC |
54 * if this is the last unmatched call and if configuration is not delayed. | 51 * if this is the last unmatched call and if configuration is not delayed. |
55 */ | 52 */ |
56 - (BOOL)endWebRTCSession:(NSError **)outError; | 53 - (BOOL)endWebRTCSession:(NSError **)outError; |
57 | 54 |
| 55 /** Configure the audio session for WebRTC. This call will fail if the session |
| 56 * is already configured. On other failures, we will attempt to restore the |
| 57 * previously used audio session configuration. |
| 58 * |lockForConfiguration| must be called first. |
| 59 * Successful calls to configureWebRTCSession must be matched by calls to |
| 60 * |unconfigureWebRTCSession|. |
| 61 */ |
| 62 - (BOOL)configureWebRTCSession:(NSError **)outError; |
| 63 |
| 64 /** Unconfigures the session for WebRTC. This will attempt to restore the |
| 65 * audio session to the settings used before |configureWebRTCSession| was |
| 66 * called. |
| 67 * |lockForConfiguration| must be called first. |
| 68 */ |
| 69 - (BOOL)unconfigureWebRTCSession:(NSError **)outError; |
| 70 |
58 /** Returns a configuration error with the given description. */ | 71 /** Returns a configuration error with the given description. */ |
59 - (NSError *)configurationErrorWithDescription:(NSString *)description; | 72 - (NSError *)configurationErrorWithDescription:(NSString *)description; |
60 | 73 |
61 // Properties and methods for tests. | 74 // Properties and methods for tests. |
62 @property(nonatomic, readonly) | 75 @property(nonatomic, readonly) |
63 std::vector<__weak id<RTCAudioSessionDelegate> > delegates; | 76 std::vector<__weak id<RTCAudioSessionDelegate> > delegates; |
64 | 77 |
65 - (void)notifyDidBeginInterruption; | 78 - (void)notifyDidBeginInterruption; |
66 - (void)notifyDidEndInterruptionWithShouldResumeSession: | 79 - (void)notifyDidEndInterruptionWithShouldResumeSession: |
67 (BOOL)shouldResumeSession; | 80 (BOOL)shouldResumeSession; |
68 - (void)notifyDidChangeRouteWithReason:(AVAudioSessionRouteChangeReason)reason | 81 - (void)notifyDidChangeRouteWithReason:(AVAudioSessionRouteChangeReason)reason |
69 previousRoute:(AVAudioSessionRouteDescription *)previousRoute; | 82 previousRoute:(AVAudioSessionRouteDescription *)previousRoute; |
70 - (void)notifyMediaServicesWereLost; | 83 - (void)notifyMediaServicesWereLost; |
71 - (void)notifyMediaServicesWereReset; | 84 - (void)notifyMediaServicesWereReset; |
72 - (void)notifyShouldConfigure; | 85 - (void)notifyDidChangeCanPlayOrRecord:(BOOL)canPlayOrRecord; |
73 - (void)notifyShouldUnconfigure; | 86 - (void)notifyDidStartPlayOrRecord; |
74 - (void)notifyDidConfigure; | 87 - (void)notifyDidStopPlayOrRecord; |
75 - (void)notifyDidUnconfigure; | |
76 | 88 |
77 @end | 89 @end |
78 | 90 |
79 NS_ASSUME_NONNULL_END | 91 NS_ASSUME_NONNULL_END |
OLD | NEW |