From 4ffb9e80896226e4d230ef4e856edbd4f8fe85bd Mon Sep 17 00:00:00 2001 From: flyinghead Date: Mon, 19 Apr 2021 11:09:16 +0200 Subject: [PATCH] sdl audio: potential race condition with event. include in win32 build --- core/oslib/audiobackend_sdl2.cpp | 3 +-- shell/linux/Makefile | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/oslib/audiobackend_sdl2.cpp b/core/oslib/audiobackend_sdl2.cpp index 3d3efecb3..7a0244b05 100644 --- a/core/oslib/audiobackend_sdl2.cpp +++ b/core/oslib/audiobackend_sdl2.cpp @@ -111,10 +111,9 @@ static u32 sdl2_audio_push(const void* frame, u32 samples, bool wait) { // If wait, then wait for the buffer to be smaller than a certain size. stream_mutex.lock(); if (wait) { - while (sample_count + samples > config::AudioBufferSize) { + while (sample_count + samples > (u32)config::AudioBufferSize) { stream_mutex.unlock(); read_wait.Wait(); - read_wait.Reset(); stream_mutex.lock(); } } diff --git a/shell/linux/Makefile b/shell/linux/Makefile index 59f5eef05..e1a82e9bf 100644 --- a/shell/linux/Makefile +++ b/shell/linux/Makefile @@ -277,6 +277,7 @@ else ifneq (,$(findstring win32,$(platform))) CC = gcc CXX = g++ USE_SDL = 1 + USE_SDLAUDIO = 1 STATIC_LIBZIP = 1 ifeq ($(WITH_DYNAREC), x86) X86_REC := 1