From 2abcd88b724e6e15ee66c30707387226d70c78bc Mon Sep 17 00:00:00 2001 From: David Reid Date: Mon, 26 Dec 2022 08:50:00 +1000 Subject: [PATCH] Fix a bug where loading a stream could incorrectly return successfully. This also makes a small change to Vorbis seeking which could potentially address an issue where seeking isn't quite accurate. --- miniaudio.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index 7894a895..625ec994 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -62586,6 +62586,7 @@ MA_API ma_result ma_stbvorbis_seek_to_pcm_frame(ma_stbvorbis* pVorbis, ma_uint64 } stb_vorbis_flush_pushdata(pVorbis->stb); + pVorbis->push.framesConsumed = 0; pVorbis->push.framesRemaining = 0; pVorbis->push.dataSize = 0; @@ -68083,6 +68084,14 @@ MA_API ma_result ma_resource_manager_data_stream_init_ex(ma_resource_manager* pR ma_async_notification_signal(notifications.init.pNotification); } + /* + If there was an error during initialization make sure we return that result here. We don't want to do this + if we're not waiting because it will most likely be in a busy state. + */ + if (pDataStream->result != MA_SUCCESS) { + return pDataStream->result; + } + /* NOTE: Do not release pInitFence here. That will be done by the job. */ }