Fix lock behavior on RTCAudioSession.
In addition: - Introduces RTCAudioSessionTest - iOS/Mac gtests now have an autoreleasepool - Moves ScopedAutoreleasePool to rtc_base_approved - Introduces route change button in AppRTCDemo BUG=webrtc:5649 Review URL: https://codereview.webrtc.org/1782363002 Cr-Commit-Position: refs/heads/master@{#11971}
This commit is contained in:
@ -10,6 +10,9 @@
|
||||
|
||||
#import "ARDVideoCallViewController.h"
|
||||
|
||||
#import "webrtc/base/objc/RTCDispatcher.h"
|
||||
#import "webrtc/modules/audio_device/ios/objc/RTCAudioSession.h"
|
||||
|
||||
#import "RTCAVFoundationVideoSource.h"
|
||||
#import "RTCLogging.h"
|
||||
|
||||
@ -27,6 +30,7 @@
|
||||
ARDAppClient *_client;
|
||||
RTCVideoTrack *_remoteVideoTrack;
|
||||
RTCVideoTrack *_localVideoTrack;
|
||||
AVAudioSessionPortOverride _portOverride;
|
||||
}
|
||||
|
||||
@synthesize videoCallView = _videoCallView;
|
||||
@ -117,6 +121,26 @@
|
||||
[self switchCamera];
|
||||
}
|
||||
|
||||
- (void)videoCallViewDidChangeRoute:(ARDVideoCallView *)view {
|
||||
AVAudioSessionPortOverride override = AVAudioSessionPortOverrideNone;
|
||||
if (_portOverride == AVAudioSessionPortOverrideNone) {
|
||||
override = AVAudioSessionPortOverrideSpeaker;
|
||||
}
|
||||
[RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeAudioSession
|
||||
block:^{
|
||||
RTCAudioSession *session = [RTCAudioSession sharedInstance];
|
||||
[session lockForConfiguration];
|
||||
NSError *error = nil;
|
||||
if ([session overrideOutputAudioPort:override error:&error]) {
|
||||
_portOverride = override;
|
||||
} else {
|
||||
RTCLogError(@"Error overriding output port: %@",
|
||||
error.localizedDescription);
|
||||
}
|
||||
[session unlockForConfiguration];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)videoCallViewDidEnableStats:(ARDVideoCallView *)view {
|
||||
_client.shouldGetStats = YES;
|
||||
_videoCallView.statsView.hidden = NO;
|
||||
|
||||
Reference in New Issue
Block a user