flacparse: Properly propagate downstream flow returns upstream
authorSebastian Dröge <slomo@circular-chaos.org>
Mon, 2 Sep 2013 09:46:52 +0000 (11:46 +0200)
committerSebastian Dröge <slomo@circular-chaos.org>
Mon, 2 Sep 2013 09:56:33 +0000 (11:56 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=707229

gst/audioparsers/gstflacparse.c

index ddc686e..cddc62a 100644 (file)
@@ -1225,7 +1225,7 @@ _value_array_append_buffer (GValue * array_val, GstBuffer * buf)
   g_value_unset (&value);
 }
 
-static gboolean
+static GstFlowReturn
 gst_flac_parse_handle_headers (GstFlacParse * flacparse)
 {
   GstBuffer *vorbiscomment = NULL;
@@ -1234,7 +1234,7 @@ gst_flac_parse_handle_headers (GstFlacParse * flacparse)
   GValue array = { 0, };
   GstCaps *caps;
   GList *l;
-  gboolean res = TRUE;
+  GstFlowReturn res = GST_FLOW_OK;
 
   caps = gst_caps_new_simple ("audio/x-flac",
       "channels", G_TYPE_INT, flacparse->channels,
@@ -1336,7 +1336,6 @@ push_headers:
    * negotiated caps will change to caps that include the streamheader field */
   while (flacparse->headers) {
     GstBuffer *buf = GST_BUFFER (flacparse->headers->data);
-    GstFlowReturn ret;
     GstBaseParseFrame frame;
 
     flacparse->headers =
@@ -1347,11 +1346,9 @@ push_headers:
     gst_base_parse_frame_init (&frame);
     frame.buffer = buf;
     frame.overhead = -1;
-    ret = gst_base_parse_push_frame (GST_BASE_PARSE (flacparse), &frame);
-    if (ret != GST_FLOW_OK) {
-      res = FALSE;
+    res = gst_base_parse_push_frame (GST_BASE_PARSE (flacparse), &frame);
+    if (res != GST_FLOW_OK)
       break;
-    }
     gst_base_parse_frame_free (&frame);
   }
   g_list_foreach (flacparse->headers, (GFunc) gst_mini_object_unref, NULL);
@@ -1579,7 +1576,7 @@ gst_flac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame,
     }
 
     if (is_last) {
-      if (!gst_flac_parse_handle_headers (flacparse))
+      if ((res = gst_flac_parse_handle_headers (flacparse)) != GST_FLOW_OK)
         goto cleanup;
 
       /* Minimal size of a frame header */
@@ -1618,7 +1615,7 @@ gst_flac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame,
         GST_WARNING_OBJECT (flacparse,
             "Generating headers for variable blocksize streams not supported");
 
-        if (!gst_flac_parse_handle_headers (flacparse))
+        if ((res = gst_flac_parse_handle_headers (flacparse)) != GST_FLOW_OK)
           goto cleanup;
       } else {
         GST_DEBUG_OBJECT (flacparse, "Generating headers");
@@ -1626,7 +1623,7 @@ gst_flac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame,
         if (!gst_flac_parse_generate_headers (flacparse))
           goto cleanup;
 
-        if (!gst_flac_parse_handle_headers (flacparse))
+        if ((res = gst_flac_parse_handle_headers (flacparse)) != GST_FLOW_OK)
           goto cleanup;
       }
       flacparse->state = GST_FLAC_PARSE_STATE_DATA;