flacenc/dec: Don't use GST_FLOW_IS_FATAL()

And properly handle UNEXPECTED and WRONG_STATE.
This commit is contained in:
Sebastian Dröge 2010-08-27 18:02:57 +02:00
parent 0753d9fee3
commit 2f7c0d21b6
2 changed files with 5 additions and 3 deletions

View file

@ -1111,13 +1111,15 @@ analyze_state:
{
GST_DEBUG_OBJECT (flacdec, "everything ok");
if (GST_FLOW_IS_FATAL (flacdec->last_flow) ||
if (flacdec->last_flow < GST_FLOW_UNEXPECTED ||
flacdec->last_flow == GST_FLOW_NOT_LINKED) {
GST_ELEMENT_ERROR (flacdec, STREAM, FAILED,
(_("Internal data stream error.")),
("stream stopped, reason %s",
gst_flow_get_name (flacdec->last_flow)));
goto eos_and_pause;
} else if (flacdec->last_flow == GST_FLOW_UNEXPECTED) {
goto eos_and_pause;
} else if (flacdec->last_flow != GST_FLOW_OK) {
goto pause;
}
@ -1161,7 +1163,7 @@ analyze_state:
{
GST_INFO_OBJECT (flacdec, "read aborted: last pull_range flow = %s",
gst_flow_get_name (flacdec->pull_flow));
if (!GST_FLOW_IS_FATAL (flacdec->pull_flow)) {
if (flacdec->pull_flow == GST_FLOW_WRONG_STATE) {
/* it seems we need to flush the decoder here to reset the decoder
* state after the abort for FLAC__stream_decoder_seek_absolute()
* to work properly */

View file

@ -1026,7 +1026,7 @@ out:
flacenc->offset += bytes;
flacenc->samples_written += samples;
if (GST_FLOW_IS_FATAL (ret) || ret == GST_FLOW_NOT_LINKED)
if (ret != GST_FLOW_OK)
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;