libFLAC: Set decoding status if write callback failed

Previously, it the write callback failed the error status
would be set to `FLAC__STREAM_DECODER_READ_FRAME`. Now it
gets set to `FLAC__STREAM_DECODER_WRITE_STATUS_ABORT`.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
This commit is contained in:
Erik de Castro Lopo 2016-07-13 19:41:14 +10:00
parent 293acefe77
commit 74e751c421
2 changed files with 4 additions and 2 deletions

View File

@ -228,7 +228,7 @@ typedef enum {
*/
FLAC__STREAM_DECODER_ABORTED,
/**< The decoder was aborted by the read callback. */
/**< The decoder was aborted by the read or write callback. */
FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
/**< An error occurred allocating memory. The decoder is in an invalid

View File

@ -2147,8 +2147,10 @@ FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FL
/* write it */
if(do_full_decode) {
if(write_audio_frame_to_client_(decoder, &decoder->private_->frame, (const FLAC__int32 * const *)decoder->private_->output) != FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE)
if(write_audio_frame_to_client_(decoder, &decoder->private_->frame, (const FLAC__int32 * const *)decoder->private_->output) != FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE) {
decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED;
return false;
}
}
decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;