Fix a bug in ma_decoder_read_pcm_frames().

This will abort reading early if the underlying data source returns an
error.
This commit is contained in:
David Reid
2025-02-23 14:14:23 +10:00
parent e4363a90be
commit c3b0a7fbbc
+8
View File
@@ -65747,6 +65747,14 @@ MA_API ma_result ma_decoder_read_pcm_frames(ma_decoder* pDecoder, void* pFramesO
if (requiredInputFrameCount > 0) {
result = ma_data_source_read_pcm_frames(pDecoder->pBackend, pIntermediaryBuffer, framesToReadThisIterationIn, &framesReadThisIterationIn);
/*
Note here that even if we've reached the end, we don't want to abort because there might be more output frames needing to be
generated from cached input data, which might happen if resampling is being performed.
*/
if (result != MA_SUCCESS && result != MA_AT_END) {
break;
}
} else {
framesReadThisIterationIn = 0;
pIntermediaryBuffer[0] = 0; /* <-- This is just to silence a static analysis warning. */