flacparse: mind gst_buffer_unref not liking NULL

Fixes #639950.
This commit is contained in:
Mark Nauwelaerts 2011-01-19 18:26:30 +01:00
parent cbbdfee98a
commit 289cd65abd

View file

@ -961,6 +961,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;
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,
@ -1040,23 +1041,27 @@ push_headers:
/* push header buffers; update caps, so when we push the first buffer the /* push header buffers; update caps, so when we push the first buffer the
* negotiated caps will change to caps that include the streamheader field */ * negotiated caps will change to caps that include the streamheader field */
for (l = flacparse->headers; l != NULL; l = l->next) { while (flacparse->headers) {
GstBuffer *buf = GST_BUFFER (l->data); GstBuffer *buf = GST_BUFFER (flacparse->headers->data);
GstFlowReturn ret; GstFlowReturn ret;
l->data = NULL; flacparse->headers =
g_list_delete_link (flacparse->headers, flacparse->headers);
buf = gst_buffer_make_metadata_writable (buf); buf = gst_buffer_make_metadata_writable (buf);
gst_buffer_set_caps (buf, gst_buffer_set_caps (buf,
GST_PAD_CAPS (GST_BASE_PARSE_SRC_PAD (GST_BASE_PARSE (flacparse)))); GST_PAD_CAPS (GST_BASE_PARSE_SRC_PAD (GST_BASE_PARSE (flacparse))));
ret = gst_base_parse_push_buffer (GST_BASE_PARSE (flacparse), buf); ret = gst_base_parse_push_buffer (GST_BASE_PARSE (flacparse), buf);
if (ret != GST_FLOW_OK) if (ret != GST_FLOW_OK) {
return FALSE; res = FALSE;
break;
}
} }
g_list_foreach (flacparse->headers, (GFunc) gst_mini_object_unref, NULL);
g_list_free (flacparse->headers); g_list_free (flacparse->headers);
flacparse->headers = NULL; flacparse->headers = NULL;
return TRUE; return res;
} }
static gboolean static gboolean