Changed setActive of RTCAudio Session, and it's working

Bug: webrtc:12018
Change-Id: I7ee5cf2df406e7a6d0edf1a95a3665c4b1d6958b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/210720
Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org>
Commit-Queue: Abby Yeh <abbyyeh@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33429}
This commit is contained in:
Abby Yeh 2021-03-09 01:55:31 +08:00 committed by Commit Bot
parent fbb2dcfe38
commit 3135772326

View File

@ -363,24 +363,27 @@ NSString * const kRTCAudioSessionOutputVolumeSelector = @"outputVolume";
}
}
if (success) {
if (shouldSetActive) {
self.isActive = active;
if (active && self.isInterrupted) {
self.isInterrupted = NO;
[self notifyDidEndInterruptionWithShouldResumeSession:YES];
}
}
if (active) {
if (shouldSetActive) {
self.isActive = active;
if (self.isInterrupted) {
self.isInterrupted = NO;
[self notifyDidEndInterruptionWithShouldResumeSession:YES];
}
}
[self incrementActivationCount];
[self notifyDidSetActive:active];
}
[self notifyDidSetActive:active];
} else {
RTCLogError(@"Failed to setActive:%d. Error: %@",
active, error.localizedDescription);
[self notifyFailedToSetActive:active error:error];
}
// Decrement activation count on deactivation whether or not it succeeded.
// Set isActive and decrement activation count on deactivation
// whether or not it succeeded.
if (!active) {
self.isActive = active;
[self notifyDidSetActive:active];
[self decrementActivationCount];
}
RTCLog(@"Number of current activations: %d", _activationCount);