From 6c0983d77cb3a8c5cb28de8d2025f010fe626109 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 5 Mar 2022 16:50:06 -0600 Subject: [PATCH] Reset the audio device if it enters a failed state Fixes #734 --- app/streaming/audio/renderers/sdlaud.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/streaming/audio/renderers/sdlaud.cpp b/app/streaming/audio/renderers/sdlaud.cpp index a279665d..0d931a43 100644 --- a/app/streaming/audio/renderers/sdlaud.cpp +++ b/app/streaming/audio/renderers/sdlaud.cpp @@ -88,6 +88,12 @@ void* SdlAudioRenderer::getAudioBuffer(int*) bool SdlAudioRenderer::submitAudio(int bytesWritten) { + // Our device may enter a permanent error status upon removal, so we need + // to recreate the audio device to pick up the new default audio device. + if (SDL_GetAudioDeviceStatus(m_AudioDevice) == SDL_AUDIO_STOPPED) { + return false; + } + if (bytesWritten == 0) { // Nothing to do return true;