diff --git a/include/FLAC/stream_decoder.h b/include/FLAC/stream_decoder.h index 0f544eebe7..7232802a56 100644 --- a/include/FLAC/stream_decoder.h +++ b/include/FLAC/stream_decoder.h @@ -455,9 +455,21 @@ typedef enum { FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM, /**< The decoder encountered reserved fields in use in the stream. */ - FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA + FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA, /**< The decoder encountered a corrupted metadata block. */ + FLAC__STREAM_DECODER_ERROR_STATUS_OUT_OF_BOUNDS, + /**< The decoder encountered a otherwise valid frame in which + * the decoded samples exceeded the range offered by the stated + * bit depth. */ + + FLAC__STREAM_DECODER_ERROR_STATUS_MISSING_FRAME + /**< Two adjacent frames had frame numbers increasing by more than + * 1 or sample numbers increasing by more than the blocksize, + * indicating that one or more frame/frames was missing between + * them. The decoder will sent out one or more ´fake' constant + * subframes to fill up the gap. */ + } FLAC__StreamDecoderErrorStatus; /** Maps a FLAC__StreamDecoderErrorStatus to a C string. diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index c4651606e7..2b17179e7a 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -236,7 +236,9 @@ FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[] = { "FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER", "FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH", "FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM", - "FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA" + "FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA", + "FLAC__STREAM_DECODER_ERROR_STATUS_OUT_OF_BOUNDS", + "FLAC__STREAM_DECODER_ERROR_STATUS_MISSING_FRAME" }; /*********************************************************************** @@ -2282,7 +2284,7 @@ FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FL if((decoder->private_->output[channel][i] < (INT32_MIN >> shift_bits)) || (decoder->private_->output[channel][i] > (INT32_MAX >> shift_bits))) { /* Bad frame, emit error */ - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH); + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_OUT_OF_BOUNDS); decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; break; } @@ -2309,7 +2311,7 @@ FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FL * frames are missing, and the frames before and after it * are complete */ if(!decoder->private_->error_has_been_sent) - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_MISSING_FRAME); /* Do some extra validation to assure last frame an current frame * header are both valid before adding silence inbetween * Technically both frames could be valid with differing sample_rates, diff --git a/test/abi/abi-libFLAC++-1.5.0.dump.xz b/test/abi/abi-libFLAC++-1.5.0.dump.xz index 78a66c6163..9fcae358fa 100644 Binary files a/test/abi/abi-libFLAC++-1.5.0.dump.xz and b/test/abi/abi-libFLAC++-1.5.0.dump.xz differ diff --git a/test/abi/abi-libFLAC-1.5.0.dump.xz b/test/abi/abi-libFLAC-1.5.0.dump.xz index 74e76fcfbc..e2dd6e0705 100644 Binary files a/test/abi/abi-libFLAC-1.5.0.dump.xz and b/test/abi/abi-libFLAC-1.5.0.dump.xz differ