Skip to content

Commit e2d1702

Browse files
authored
Simplify code since playerNode_ will not be nil (#639)
1 parent 7a1c2d7 commit e2d1702

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Sources/CSFBAudioEngine/Player/AudioPlayer.mm

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ void AVAudioSessionInterruptionNotificationCallback(CFNotificationCenterRef cent
668668
[engine_ stop];
669669
flags_.fetch_and(~static_cast<unsigned int>(Flags::engineIsRunning), std::memory_order_acq_rel);
670670

671-
if(playerNode_ && playerNode_->_node->IsPlaying())
671+
if(playerNode_->_node->IsPlaying())
672672
playerNode_->_node->Stop();
673673

674674
// Avoid creating a new AudioPlayerNode if not necessary
@@ -699,11 +699,8 @@ void AVAudioSessionInterruptionNotificationCallback(CFNotificationCenterRef cent
699699
}
700700

701701
if(playerNode) {
702-
AVAudioConnectionPoint *playerNodeOutputConnectionPoint = nil;
703-
if(playerNode_) {
704-
playerNodeOutputConnectionPoint = [[engine_ outputConnectionPointsForNode:playerNode_ outputBus:0] firstObject];
705-
[engine_ detachNode:playerNode_];
706-
}
702+
AVAudioConnectionPoint *playerNodeOutputConnectionPoint = [[engine_ outputConnectionPointsForNode:playerNode_ outputBus:0] firstObject];
703+
[engine_ detachNode:playerNode_];
707704

708705
// When an audio player node is deallocated the destructor synchronously waits
709706
// for decoder cancelation (if there is an active decoder) and then for any

0 commit comments

Comments
 (0)