mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 08:44:04 +02:00
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:
@@ -65747,6 +65747,14 @@ MA_API ma_result ma_decoder_read_pcm_frames(ma_decoder* pDecoder, void* pFramesO
|
|||||||
|
|
||||||
if (requiredInputFrameCount > 0) {
|
if (requiredInputFrameCount > 0) {
|
||||||
result = ma_data_source_read_pcm_frames(pDecoder->pBackend, pIntermediaryBuffer, framesToReadThisIterationIn, &framesReadThisIterationIn);
|
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 {
|
} else {
|
||||||
framesReadThisIterationIn = 0;
|
framesReadThisIterationIn = 0;
|
||||||
pIntermediaryBuffer[0] = 0; /* <-- This is just to silence a static analysis warning. */
|
pIntermediaryBuffer[0] = 0; /* <-- This is just to silence a static analysis warning. */
|
||||||
|
|||||||
Reference in New Issue
Block a user