Fixed an issue where the audio device was accessed after it had been closed.

This commit is contained in:
Leon Styhre 2022-01-05 00:08:50 +01:00
parent f8e201d347
commit c62a069448
3 changed files with 4 additions and 3 deletions

View file

@ -529,10 +529,8 @@ int main(int argc, char* argv[])
} }
Window* window = Window::getInstance(); Window* window = Window::getInstance();
ViewController::getInstance(); ViewController::getInstance();
CollectionSystemsManager::getInstance(); CollectionSystemsManager::getInstance();
SystemScreensaver screensaver; SystemScreensaver screensaver;
MediaViewer mediaViewer; MediaViewer mediaViewer;
GuiLaunchScreen guiLaunchScreen; GuiLaunchScreen guiLaunchScreen;

View file

@ -119,6 +119,8 @@ void AudioManager::deinit()
SDL_CloseAudio(); SDL_CloseAudio();
SDL_QuitSubSystem(SDL_INIT_AUDIO); SDL_QuitSubSystem(SDL_INIT_AUDIO);
sAudioDevice = 0;
} }
void AudioManager::mixAudio(void* /*unused*/, Uint8* stream, int len) void AudioManager::mixAudio(void* /*unused*/, Uint8* stream, int len)

View file

@ -1412,6 +1412,7 @@ void VideoFFmpegComponent::stopVideo()
std::queue<AudioFrame>().swap(mAudioFrameQueue); std::queue<AudioFrame>().swap(mAudioFrameQueue);
// Clear the audio buffer. // Clear the audio buffer.
if (AudioManager::sAudioDevice != 0)
AudioManager::getInstance().clearStream(); AudioManager::getInstance().clearStream();
if (mFormatContext) { if (mFormatContext) {