Commit 30bf8f89 authored by J. Alexander Treuman's avatar J. Alexander Treuman

If a frame header decode loses sync, just try again instead of trying to decode…

If a frame header decode loses sync, just try again instead of trying to decode a frame (which will automatically decode the next header without allowing us to do some checks on it). git-svn-id: https://svn.musicpd.org/mpd/trunk@4670 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 103dd654
...@@ -629,25 +629,21 @@ static int decodeFirstFrame(mp3DecodeData * data, DecoderControl * dc, ...@@ -629,25 +629,21 @@ static int decodeFirstFrame(mp3DecodeData * data, DecoderControl * dc,
struct mad_bitptr ptr; struct mad_bitptr ptr;
int bitlen; int bitlen;
int ret; int ret;
int skip;
/* stfu gcc */ /* stfu gcc */
memset(&xing, 0, sizeof(struct xing)); memset(&xing, 0, sizeof(struct xing));
xing.flags = 0; xing.flags = 0;
while (1) { while (1) {
skip = 0;
while ((ret = decodeNextFrameHeader(data, tag, replayGainInfo)) == DECODE_CONT && while ((ret = decodeNextFrameHeader(data, tag, replayGainInfo)) == DECODE_CONT &&
(!dc || !dc->stop)); (!dc || !dc->stop));
if (ret == DECODE_BREAK || (dc && dc->stop)) return -1;
if (ret == DECODE_SKIP) skip = 1; if (ret == DECODE_SKIP) continue;
else if (ret == DECODE_BREAK || (dc && dc->stop)) return -1;
while ((ret = decodeNextFrame(data)) == DECODE_CONT && while ((ret = decodeNextFrame(data)) == DECODE_CONT &&
(!dc || !dc->stop)); (!dc || !dc->stop));
if (ret == DECODE_BREAK || (dc && dc->stop)) return -1; if (ret == DECODE_BREAK || (dc && dc->stop)) return -1;
if (!skip && ret == DECODE_OK) break; if (ret == DECODE_OK) break;
} }
ptr = data->stream.anc_ptr; ptr = data->stream.anc_ptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment