flac: check command after flac_process_single() failure

When the MPD core sends the decoder a command while
flac_process_single() is executed, this function fails.  Abort the
decoder only if not seeking.  This fixes a seeking bug.
This commit is contained in:
Max Kellermann 2009-03-05 18:20:41 +01:00
parent 74a2813d78
commit efd606337e
1 changed files with 6 additions and 3 deletions

View File

@ -353,9 +353,6 @@ flac_decode_internal(struct decoder * decoder,
} else } else
cmd = decoder_get_command(decoder); cmd = decoder_get_command(decoder);
if (!flac_process_single(flac_dec))
break;
if (cmd == DECODE_COMMAND_SEEK) { if (cmd == DECODE_COMMAND_SEEK) {
FLAC__uint64 seek_sample = decoder_seek_where(decoder) * FLAC__uint64 seek_sample = decoder_seek_where(decoder) *
data.audio_format.sample_rate + 0.5; data.audio_format.sample_rate + 0.5;
@ -368,6 +365,12 @@ flac_decode_internal(struct decoder * decoder,
decoder_seek_error(decoder); decoder_seek_error(decoder);
} else if (flac_get_state(flac_dec) == flac_decoder_eof) } else if (flac_get_state(flac_dec) == flac_decoder_eof)
break; break;
if (!flac_process_single(flac_dec)) {
cmd = decoder_get_command(decoder);
if (cmd != DECODE_COMMAND_SEEK)
break;
}
} }
if (cmd != DECODE_COMMAND_STOP) { if (cmd != DECODE_COMMAND_STOP) {
flacPrintErroredState(flac_get_state(flac_dec)); flacPrintErroredState(flac_get_state(flac_dec));