From 034120ea7060b93aeed96ff5e8476f20d07d4e7a Mon Sep 17 00:00:00 2001 From: Abby Yeh Date: Thu, 30 Nov 2023 15:59:25 +0100 Subject: [PATCH] Set isActive to false only when AVAudioSession is set. bug: webrtc:15697 Change-Id: I364fa1f3a444fce70607e7d9338636f720d86aff Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329342 Commit-Queue: Abby Yeh Reviewed-by: Peter Hanspers Cr-Commit-Position: refs/heads/main@{#41296} --- sdk/objc/components/audio/RTCAudioSession.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/objc/components/audio/RTCAudioSession.mm b/sdk/objc/components/audio/RTCAudioSession.mm index f6b91d5409..641d2ed8c7 100644 --- a/sdk/objc/components/audio/RTCAudioSession.mm +++ b/sdk/objc/components/audio/RTCAudioSession.mm @@ -399,8 +399,10 @@ ABSL_CONST_INIT thread_local bool mutex_locked = false; // Set isActive and decrement activation count on deactivation // whether or not it succeeded. if (!active) { - self.isActive = active; - [self notifyDidSetActive:active]; + if (shouldSetActive) { + self.isActive = active; + [self notifyDidSetActive:active]; + } [self decrementActivationCount]; } RTCLog(@"Number of current activations: %d", _activationCount.load());