From 0f9355cf1b991e16821b333a1f4f8ccdf0585e25 Mon Sep 17 00:00:00 2001 From: David Reid Date: Thu, 3 Dec 2020 20:35:22 +1000 Subject: [PATCH] Fix a bug when an async data buffer fails to load. --- research/miniaudio_engine.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/research/miniaudio_engine.h b/research/miniaudio_engine.h index 7e8599c6..564e6c67 100644 --- a/research/miniaudio_engine.h +++ b/research/miniaudio_engine.h @@ -6714,12 +6714,14 @@ done: pDataBuffer->pNode->data.decoded.decodedFrameCount = 0; } - /* The job has been set up so it can now be posted. */ - result = ma_resource_manager_post_job(pResourceManager, &pageDataBufferJob); - - /* The result needs to be set to MA_BUSY to ensure the status of the data buffer is set properly in the next section. */ if (result == MA_SUCCESS) { - result = MA_BUSY; + /* The job has been set up so it can now be posted. */ + result = ma_resource_manager_post_job(pResourceManager, &pageDataBufferJob); + + /* The result needs to be set to MA_BUSY to ensure the status of the data buffer is set properly in the next section. */ + if (result == MA_SUCCESS) { + result = MA_BUSY; + } } /* We want to make sure we don't signal the event here. It needs to be delayed until the last page. */