Skip to content

Commit 9cb7092

Browse files
committed
Fix an error in drmp3_decode_next_frame_ex__memory().
This is related to the previous commit. There is a case where the stream cursor is not incremented correctly in the memory decoding path.
1 parent f55f4f2 commit 9cb7092

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dr_mp3.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2875,6 +2875,7 @@ static drmp3_uint32 drmp3_decode_next_frame_ex__memory(drmp3* pMP3, drmp3d_sampl
28752875
} else if (info.frame_bytes > 0) {
28762876
/* No frames were read, but it looks like we skipped past one. Read the next MP3 frame. */
28772877
pMP3->memory.currentReadPos += (size_t)info.frame_bytes;
2878+
pMP3->streamCursor += (size_t)info.frame_bytes;
28782879
} else {
28792880
/* Nothing at all was read. Abort. */
28802881
break;
@@ -2883,7 +2884,7 @@ static drmp3_uint32 drmp3_decode_next_frame_ex__memory(drmp3* pMP3, drmp3d_sampl
28832884

28842885
/* Consume the data. */
28852886
pMP3->memory.currentReadPos += (size_t)info.frame_bytes;
2886-
pMP3->streamCursor += (size_t)info.frame_bytes;
2887+
pMP3->streamCursor += (size_t)info.frame_bytes;
28872888

28882889
return pcmFramesRead;
28892890
}

0 commit comments

Comments
 (0)