shithub: mp3dec

Download patch

ref: 0a42a2e5a472aac1d58ddc2f4feb181a640d2457
parent: a5b658d1d7b26d5856f9f1a642550ae3ff75a084
author: lieff <lieff@users.noreply.github.com>
date: Thu Feb 13 15:02:18 EST 2020

mp3dec_ex: fix mp3dec_load_cb vbrtag parsing

--- a/minimp3_ex.h
+++ b/minimp3_ex.h
@@ -254,6 +254,7 @@
     {
         uint32_t frames;
         int i, delay, padding, free_format_bytes = 0, frame_size = 0;
+        const uint8_t *hdr;
         if (io)
         {
             if (!eof && filled - consumed < MINIMP3_BUF_SIZE)
@@ -270,17 +271,18 @@
             }
             i = mp3d_find_frame(buf + consumed, filled - consumed, &free_format_bytes, &frame_size);
             consumed += i;
+            hdr = buf + consumed;
         } else
         {
             i = mp3d_find_frame(buf, buf_size, &free_format_bytes, &frame_size);
             buf      += i;
             buf_size -= i;
+            hdr = buf;
         }
         if (i && !frame_size)
             continue;
         if (!frame_size)
             return 0;
-        const uint8_t *hdr = buf;
         frame_info.channels = HDR_IS_MONO(hdr) ? 1 : 2;
         frame_info.hz = hdr_sample_rate_hz(hdr);
         frame_info.layer = 4 - HDR_GET_LAYER(hdr);