flacparse: Properly propagate downstream flow returns upstream

https://bugzilla.gnome.org/show_bug.cgi?id=707229
This commit is contained in:
Sebastian Dröge 2013-09-02 11:46:52 +02:00
parent 1dfc1f2686
commit 1971c43279

View file

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