decoder/flac: evaluate all possible FLAC__stream_decoder_get_state() values
Stop after all fatal errors. This fixes assertion failures in libFLAC.
This commit is contained in:
parent
1c7de0b4ac
commit
faf2eeaa99
2
NEWS
2
NEWS
|
@ -1,4 +1,6 @@
|
||||||
ver 0.19.17 (not yet released)
|
ver 0.19.17 (not yet released)
|
||||||
|
* decoder
|
||||||
|
- flac: fix assertion failure while seeking
|
||||||
* fix spurious seek error "Failed to allocate silence buffer"
|
* fix spurious seek error "Failed to allocate silence buffer"
|
||||||
* replay gain: fix "replay_gain_handler mixer" setting
|
* replay gain: fix "replay_gain_handler mixer" setting
|
||||||
* DSD: use 0x69 as silence pattern
|
* DSD: use 0x69 as silence pattern
|
||||||
|
|
|
@ -194,10 +194,34 @@ flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec,
|
||||||
decoder_command_finished(decoder);
|
decoder_command_finished(decoder);
|
||||||
} else
|
} else
|
||||||
decoder_seek_error(decoder);
|
decoder_seek_error(decoder);
|
||||||
} else if (cmd == DecoderCommand::STOP ||
|
} else if (cmd == DecoderCommand::STOP)
|
||||||
FLAC__stream_decoder_get_state(flac_dec) == FLAC__STREAM_DECODER_END_OF_STREAM)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
switch (FLAC__stream_decoder_get_state(flac_dec)) {
|
||||||
|
case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
|
||||||
|
case FLAC__STREAM_DECODER_READ_METADATA:
|
||||||
|
case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
|
||||||
|
case FLAC__STREAM_DECODER_READ_FRAME:
|
||||||
|
/* continue decoding */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLAC__STREAM_DECODER_END_OF_STREAM:
|
||||||
|
/* regular end of stream */
|
||||||
|
return;
|
||||||
|
|
||||||
|
case FLAC__STREAM_DECODER_OGG_ERROR:
|
||||||
|
case FLAC__STREAM_DECODER_SEEK_ERROR:
|
||||||
|
case FLAC__STREAM_DECODER_ABORTED:
|
||||||
|
case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
|
||||||
|
/* an error, fatal enough for us to abort the
|
||||||
|
decoder */
|
||||||
|
return;
|
||||||
|
|
||||||
|
case FLAC__STREAM_DECODER_UNINITIALIZED:
|
||||||
|
/* we shouldn't see this, ever - bail out */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (t_end != 0 && data->next_frame >= t_end)
|
if (t_end != 0 && data->next_frame >= t_end)
|
||||||
/* end of this sub track */
|
/* end of this sub track */
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue