Check for uninitialized audio unit in HandleInterruptionEnd.

This fixes a potential crash if interrupted before the audio unit has been initialized.

Bug: None
Change-Id: Ib9f5ea305c98a172f8df52af5767c8543e59701c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136800
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27937}
This commit is contained in:
Kári Tristan Helgason 2019-05-14 08:46:57 +02:00 committed by Commit Bot
parent 90d9feb8c8
commit f11c8d1e2c

View file

@ -518,6 +518,7 @@ void AudioDeviceIOS::HandleInterruptionEnd() {
"Updating audio unit state.",
is_interrupted_);
is_interrupted_ = false;
if (!audio_unit_) return;
if (webrtc::field_trial::IsEnabled("WebRTC-Audio-iOS-Holding")) {
// Work around an issue where audio does not restart properly after an interruption
// by restarting the audio unit when the interruption ends.