flacenc/dec: Don't use GST_FLOW_IS_FATAL()
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 27 Aug 2010 16:02:57 +0000 (18:02 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sat, 4 Sep 2010 12:52:10 +0000 (14:52 +0200)
And properly handle UNEXPECTED and WRONG_STATE.

ext/flac/gstflacdec.c
ext/flac/gstflacenc.c

index ae11f27..b879ec1 100644 (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 */
index 60406fe..cce96f3 100644 (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;