| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #import "webrtc/modules/audio_device/ios/objc/RTCAudioSession.h" | |
| 12 | |
| 13 #include <vector> | |
| 14 | |
| 15 NS_ASSUME_NONNULL_BEGIN | |
| 16 | |
| 17 @class RTCAudioSessionConfiguration; | |
| 18 | |
| 19 @interface RTCAudioSession () | |
| 20 | |
| 21 /** Number of times setActive:YES has succeeded without a balanced call to | |
| 22 * setActive:NO. | |
| 23 */ | |
| 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 /** Convenience BOOL that checks useManualAudio and isAudioEnebled. */ | |
| 32 @property(readonly) BOOL canPlayOrRecord; | |
| 33 | |
| 34 /** Tracks whether we have been sent an interruption event that hasn't been matc
hed by either an | |
| 35 * interrupted end event or a foreground event. | |
| 36 */ | |
| 37 @property(nonatomic, assign) BOOL isInterrupted; | |
| 38 | |
| 39 - (BOOL)checkLock:(NSError **)outError; | |
| 40 | |
| 41 /** Adds the delegate to the list of delegates, and places it at the front of | |
| 42 * the list. This delegate will be notified before other delegates of | |
| 43 * audio events. | |
| 44 */ | |
| 45 - (void)pushDelegate:(id<RTCAudioSessionDelegate>)delegate; | |
| 46 | |
| 47 /** Signals RTCAudioSession that a WebRTC session is about to begin and | |
| 48 * audio configuration is needed. Will configure the audio session for WebRTC | |
| 49 * if not already configured and if configuration is not delayed. | |
| 50 * Successful calls must be balanced by a call to endWebRTCSession. | |
| 51 */ | |
| 52 - (BOOL)beginWebRTCSession:(NSError **)outError; | |
| 53 | |
| 54 /** Signals RTCAudioSession that a WebRTC session is about to end and audio | |
| 55 * unconfiguration is needed. Will unconfigure the audio session for WebRTC | |
| 56 * if this is the last unmatched call and if configuration is not delayed. | |
| 57 */ | |
| 58 - (BOOL)endWebRTCSession:(NSError **)outError; | |
| 59 | |
| 60 /** Configure the audio session for WebRTC. This call will fail if the session | |
| 61 * is already configured. On other failures, we will attempt to restore the | |
| 62 * previously used audio session configuration. | |
| 63 * |lockForConfiguration| must be called first. | |
| 64 * Successful calls to configureWebRTCSession must be matched by calls to | |
| 65 * |unconfigureWebRTCSession|. | |
| 66 */ | |
| 67 - (BOOL)configureWebRTCSession:(NSError **)outError; | |
| 68 | |
| 69 /** Unconfigures the session for WebRTC. This will attempt to restore the | |
| 70 * audio session to the settings used before |configureWebRTCSession| was | |
| 71 * called. | |
| 72 * |lockForConfiguration| must be called first. | |
| 73 */ | |
| 74 - (BOOL)unconfigureWebRTCSession:(NSError **)outError; | |
| 75 | |
| 76 /** Returns a configuration error with the given description. */ | |
| 77 - (NSError *)configurationErrorWithDescription:(NSString *)description; | |
| 78 | |
| 79 // Properties and methods for tests. | |
| 80 @property(nonatomic, readonly) | |
| 81 std::vector<__weak id<RTCAudioSessionDelegate> > delegates; | |
| 82 | |
| 83 - (void)notifyDidBeginInterruption; | |
| 84 - (void)notifyDidEndInterruptionWithShouldResumeSession: | |
| 85 (BOOL)shouldResumeSession; | |
| 86 - (void)notifyDidChangeRouteWithReason:(AVAudioSessionRouteChangeReason)reason | |
| 87 previousRoute:(AVAudioSessionRouteDescription *)previousRoute; | |
| 88 - (void)notifyMediaServicesWereLost; | |
| 89 - (void)notifyMediaServicesWereReset; | |
| 90 - (void)notifyDidChangeCanPlayOrRecord:(BOOL)canPlayOrRecord; | |
| 91 - (void)notifyDidStartPlayOrRecord; | |
| 92 - (void)notifyDidStopPlayOrRecord; | |
| 93 | |
| 94 @end | |
| 95 | |
| 96 NS_ASSUME_NONNULL_END | |
| OLD | NEW |