mpegtsparse: Queue buffers until we have enough to know the caps

https://bugzilla.gnome.org/show_bug.cgi?id=708222
This commit is contained in:
Sebastian Dröge 2013-09-27 16:10:54 +02:00
parent 467e0151d3
commit d7c7f54734
2 changed files with 29 additions and 0 deletions

View file

@ -190,6 +190,10 @@ mpegts_parse_reset (MpegTSBase * base)
GST_MPEGTS_PARSE (base)->first = TRUE;
GST_MPEGTS_PARSE (base)->have_group_id = FALSE;
GST_MPEGTS_PARSE (base)->group_id = G_MAXUINT;
g_list_free_full (GST_MPEGTS_PARSE (base)->pending_buffers,
(GDestroyNotify) gst_buffer_unref);
GST_MPEGTS_PARSE (base)->pending_buffers = NULL;;
}
static void
@ -559,10 +563,34 @@ static GstFlowReturn
mpegts_parse_input_done (MpegTSBase * base, GstBuffer * buffer)
{
MpegTSParse2 *parse = GST_MPEGTS_PARSE (base);
GstFlowReturn ret = GST_FLOW_OK;
if (G_UNLIKELY (parse->first))
prepare_src_pad (base, parse);
if (G_UNLIKELY (parse->first)) {
parse->pending_buffers = g_list_append (parse->pending_buffers, buffer);
return GST_FLOW_OK;
}
if (G_UNLIKELY (parse->pending_buffers)) {
GList *l;
for (l = parse->pending_buffers; l; l = l->next) {
if (ret == GST_FLOW_OK)
ret = gst_pad_push (parse->srcpad, l->data);
else
gst_buffer_unref (l->data);
}
g_list_free (parse->pending_buffers);
parse->pending_buffers = NULL;
if (ret != GST_FLOW_OK) {
gst_buffer_unref (buffer);
return ret;
}
}
return gst_pad_push (parse->srcpad, buffer);
}

View file

@ -58,6 +58,7 @@ struct _MpegTSParse2 {
/* state */
gboolean first;
GList *pending_buffers;
};
struct _MpegTSParse2Class {