basevideodecoder: fix weird event list handling

Get rid of weird code that copies a list manually, taking
ownership of the elements and then frees the old list. Instead,
just take over the old list entirely. (If the intent was to
reverse the list, one could use g_list_reverse() instead).

Then, push events in the list out from last to first (since they
were prepended as they came in) instead of just pushing out the
last in the list and leaking the others.
This commit is contained in:
Tim-Philipp Müller 2011-11-22 19:57:07 +00:00
parent ff7375f2e6
commit c75922b96b

View file

@ -1405,11 +1405,7 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder,
GstVideoFrame *tmp = l->data;
if (tmp->events) {
GList *k;
for (k = g_list_last (tmp->events); k; k = k->prev)
events = g_list_prepend (events, k->data);
g_list_free (tmp->events);
events = tmp->events;
tmp->events = NULL;
}
@ -1417,7 +1413,7 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder,
break;
}
for (l = g_list_last (events); l; l = l->next)
for (l = g_list_last (events); l; l = l->prev)
gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder),
l->data);
g_list_free (events);