From 5df30c1b905edce16f2258e414a0a4afb540d0f1 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Tue, 10 Jan 2012 14:35:31 +0000 Subject: [PATCH 01/17] oggmux: fix pad leak --- ext/ogg/gstoggmux.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index 7aeecc023e..862134700b 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -287,6 +287,8 @@ gst_ogg_mux_finalize (GObject * object) ogg_mux->collect = NULL; } + gst_object_unref (ogg_mux->srcpad); + G_OBJECT_CLASS (parent_class)->finalize (object); } From ef1469fc8b0652c07ad8359a17fdf871b1e1481d Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Tue, 10 Jan 2012 16:14:29 +0000 Subject: [PATCH 02/17] oggdemux: fix hang on small truncated files A first hang was happening when trying to locate a page backwards, where we'd sync forever on the same page. With that fixed, a second hang would happen after preparing an EOS event, but with no chain created yet to send it to, the pipeline would stay idle forever. An element error is now emitted for this case. --- ext/ogg/gstoggdemux.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index a06aec8f39..f54ab95f7d 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -2371,6 +2371,8 @@ gst_ogg_demux_get_prev_page (GstOggDemux * ogg, ogg_page * og, gint64 * offset) if (ret == GST_FLOW_UNEXPECTED) { new_offset = 0; GST_LOG_OBJECT (ogg, "got unexpected"); + /* We hit EOS. */ + goto beach; } else if (ret != GST_FLOW_OK) { GST_LOG_OBJECT (ogg, "got error %d", ret); return ret; @@ -2398,6 +2400,7 @@ gst_ogg_demux_get_prev_page (GstOggDemux * ogg, ogg_page * og, gint64 * offset) if (offset) *offset = cur_offset; +beach: return ret; } @@ -4466,8 +4469,17 @@ pause: * e.g. because of a flushing seek. */ if (event) { - gst_event_set_seqnum (event, ogg->seqnum); - gst_ogg_demux_send_event (ogg, event); + /* guard against corrupt/truncated files, where one can hit EOS + before prerolling is done and a chain created. If we have no + chain to send the event to, error out. */ + if (ogg->current_chain || ogg->building_chain) { + gst_event_set_seqnum (event, ogg->seqnum); + gst_ogg_demux_send_event (ogg, event); + } else { + gst_event_unref (event); + GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL), + ("EOS before finding a chain")); + } } return; } From a718b859a768452e35234658d2a74a2df1411fa2 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Tue, 10 Jan 2012 16:51:09 +0000 Subject: [PATCH 03/17] oggdemux: fix pad leak --- ext/ogg/gstoggdemux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index f54ab95f7d..6afcae6432 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -4593,6 +4593,7 @@ gst_ogg_demux_change_state (GstElement * element, GstStateChange transition) "Unable to determine stream size, assuming live, seeking disabled"); ogg->push_disable_seeking = TRUE; } + gst_object_unref (peer); } } From 35df9d2ad9b3787d4934041d66adbeee1ae4d152 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Tue, 10 Jan 2012 16:57:04 +0000 Subject: [PATCH 04/17] oggstream: fix tag list leak --- ext/ogg/gstoggstream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/ogg/gstoggstream.c b/ext/ogg/gstoggstream.c index 96cd581a92..7d0b39d82b 100644 --- a/ext/ogg/gstoggstream.c +++ b/ext/ogg/gstoggstream.c @@ -1844,6 +1844,7 @@ extract_tags_kate (GstOggStream * pad, ogg_packet * packet) /* ensure the comment packet cannot override the category/language from the identification header */ gst_tag_list_insert (pad->taglist, list, GST_TAG_MERGE_KEEP_ALL); + gst_tag_list_free (list); } else pad->taglist = list; } From b794f78d267737c3c4b8ce58370c3182d403a28a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 10 Jan 2012 17:48:44 +0000 Subject: [PATCH 05/17] discoverer: fix potential caps leak in last else chunk. --- gst-libs/gst/pbutils/gstdiscoverer.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index 581739e9a6..a7c49681b2 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -908,24 +908,21 @@ parse_stream_topology (GstDiscoverer * dc, const GstStructure * topology, /* We sometimes get an extra sub-stream from the parser. If this is * the case, we just replace the parent caps with this stream's caps * since they might contain more information */ - gst_caps_unref (parent->caps); - parent->caps = caps; + gst_caps_replace (&parent->caps, caps); parse_stream_topology (dc, st, parent); add_to_list = FALSE; - } else if (child_is_raw_stream (parent->caps, caps)) { /* This is the "raw" stream corresponding to the parent. This * contains more information than the parent, tags etc. */ parse_stream_topology (dc, st, parent); add_to_list = FALSE; - gst_caps_unref (caps); - } else { GstDiscovererStreamInfo *next = parse_stream_topology (dc, st, NULL); res->next = next; next->previous = res; } + gst_caps_unref (caps); } } From 5f20af6ce537c2b079ca866ccd5dea589ea1be5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 10 Jan 2012 18:07:19 +0000 Subject: [PATCH 06/17] discoverer: fix potential tag list leaks Not that I have ever seen these in practice, but if they can't happen we may just as well just assign the new tag list. Merge properly to be on the safe side, and also avoid a useless tag list copy in the normal case where there is no tag list yet. --- gst-libs/gst/pbutils/gstdiscoverer.c | 40 +++++++++++++++++----------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index a7c49681b2..6291cd7c94 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -607,6 +607,23 @@ collect_stream_information (GstDiscoverer * dc, PrivateStream * ps, guint idx) return st; } +/* takes ownership of new_tags, may replace *taglist with a new one */ +static void +gst_discoverer_merge_and_replace_tags (GstTagList ** taglist, + GstTagList * new_tags) +{ + if (new_tags == NULL) + return; + + if (*taglist == NULL) { + *taglist = new_tags; + return; + } + + gst_tag_list_insert (*taglist, new_tags, GST_TAG_MERGE_REPLACE); + gst_tag_list_free (new_tags); +} + /* Parses a set of caps and tags in st and populates a GstDiscovererStreamInfo * structure (parent, if !NULL, otherwise it allocates one) */ @@ -664,10 +681,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, info->max_bitrate = utmp; /* FIXME: Is it worth it to remove the tags we've parsed? */ - info->parent.tags = gst_tag_list_merge (info->parent.tags, - (GstTagList *) tags_st, GST_TAG_MERGE_REPLACE); - - gst_structure_free (tags_st); + gst_discoverer_merge_and_replace_tags (&info->parent.tags, + (GstTagList *) tags_st); } if (!info->language && ((GstDiscovererStreamInfo *) info)->tags) { @@ -728,9 +743,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, info->max_bitrate = utmp; /* FIXME: Is it worth it to remove the tags we've parsed? */ - info->parent.tags = gst_tag_list_merge (info->parent.tags, - (GstTagList *) tags_st, GST_TAG_MERGE_REPLACE); - gst_structure_free (tags_st); + gst_discoverer_merge_and_replace_tags (&info->parent.tags, + (GstTagList *) tags_st); } return (GstDiscovererStreamInfo *) info; @@ -757,10 +771,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, info->language = g_strdup (language); /* FIXME: Is it worth it to remove the tags we've parsed? */ - info->parent.tags = gst_tag_list_merge (info->parent.tags, - (GstTagList *) tags_st, GST_TAG_MERGE_REPLACE); - gst_structure_free (tags_st); - + gst_discoverer_merge_and_replace_tags (&info->parent.tags, + (GstTagList *) tags_st); } if (!info->language && ((GstDiscovererStreamInfo *) info)->tags) { @@ -787,9 +799,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, if (gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_STRUCTURE, &tags_st, NULL)) { - info->tags = gst_tag_list_merge (info->tags, (GstTagList *) tags_st, - GST_TAG_MERGE_REPLACE); - gst_structure_free (tags_st); + gst_discoverer_merge_and_replace_tags (&info->tags, + (GstTagList *) tags_st); } return info; @@ -1197,7 +1208,6 @@ handle_current_sync (GstDiscoverer * dc) done = handle_message (dc, msg); gst_message_unref (msg); } - } while (!done && (g_timer_elapsed (timer, NULL) < deadline)); /* return result */ From b155e094edd14c3763d1fdd1c6532d8f3ebeadc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 10 Jan 2012 18:27:19 +0000 Subject: [PATCH 07/17] discoverer: use GST_TYPE_TAG_LIST for tag lists They may not be structures in 0.11/1.0. --- gst-libs/gst/pbutils/gstdiscoverer.c | 31 ++++++++++++---------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index 6291cd7c94..bbbcad2802 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -602,7 +602,7 @@ collect_stream_information (GstDiscoverer * dc, PrivateStream * ps, guint idx) gst_caps_unref (caps); } if (ps->tags) - gst_structure_id_set (st, _TAGS_QUARK, GST_TYPE_STRUCTURE, ps->tags, NULL); + gst_structure_id_set (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, ps->tags, NULL); return st; } @@ -632,7 +632,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, GstDiscovererStreamInfo * parent) { GstCaps *caps; - GstStructure *caps_st, *tags_st; + GstStructure *caps_st; + GstTagList *tags_st; const gchar *name; int tmp, tmp2; guint utmp; @@ -671,8 +672,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, info->depth = (guint) tmp; if (gst_structure_id_has_field (st, _TAGS_QUARK)) { - gst_structure_id_get (st, _TAGS_QUARK, - GST_TYPE_STRUCTURE, &tags_st, NULL); + gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, NULL); if (gst_structure_get_uint (tags_st, GST_TAG_BITRATE, &utmp) || gst_structure_get_uint (tags_st, GST_TAG_NOMINAL_BITRATE, &utmp)) info->bitrate = utmp; @@ -681,8 +681,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, info->max_bitrate = utmp; /* FIXME: Is it worth it to remove the tags we've parsed? */ - gst_discoverer_merge_and_replace_tags (&info->parent.tags, - (GstTagList *) tags_st); + gst_discoverer_merge_and_replace_tags (&info->parent.tags, tags_st); } if (!info->language && ((GstDiscovererStreamInfo *) info)->tags) { @@ -733,8 +732,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, info->interlaced = FALSE; if (gst_structure_id_has_field (st, _TAGS_QUARK)) { - gst_structure_id_get (st, _TAGS_QUARK, - GST_TYPE_STRUCTURE, &tags_st, NULL); + gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, NULL); if (gst_structure_get_uint (tags_st, GST_TAG_BITRATE, &utmp) || gst_structure_get_uint (tags_st, GST_TAG_NOMINAL_BITRATE, &utmp)) info->bitrate = utmp; @@ -763,16 +761,14 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, if (gst_structure_id_has_field (st, _TAGS_QUARK)) { const gchar *language; - gst_structure_id_get (st, _TAGS_QUARK, - GST_TYPE_STRUCTURE, &tags_st, NULL); + gst_structure_id_get (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, &tags_st, NULL); language = gst_structure_get_string (caps_st, GST_TAG_LANGUAGE_CODE); if (language) info->language = g_strdup (language); /* FIXME: Is it worth it to remove the tags we've parsed? */ - gst_discoverer_merge_and_replace_tags (&info->parent.tags, - (GstTagList *) tags_st); + gst_discoverer_merge_and_replace_tags (&info->parent.tags, tags_st); } if (!info->language && ((GstDiscovererStreamInfo *) info)->tags) { @@ -798,9 +794,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, } if (gst_structure_id_get (st, _TAGS_QUARK, - GST_TYPE_STRUCTURE, &tags_st, NULL)) { - gst_discoverer_merge_and_replace_tags (&info->tags, - (GstTagList *) tags_st); + GST_TYPE_TAG_LIST, &tags_st, NULL)) { + gst_discoverer_merge_and_replace_tags (&info->tags, tags_st); } return info; @@ -963,7 +958,7 @@ parse_stream_topology (GstDiscoverer * dc, const GstStructure * topology, GstTagList *tmp; gst_structure_id_get (topology, _TAGS_QUARK, - GST_TYPE_STRUCTURE, &tags, NULL); + GST_TYPE_TAG_LIST, &tags, NULL); GST_DEBUG ("Merge tags %" GST_PTR_FORMAT, tags); @@ -1059,8 +1054,8 @@ discoverer_collect (GstDiscoverer * dc) gst_caps_get_structure (dc->priv->current_info->stream_info->caps, 0); if (g_str_has_prefix (gst_structure_get_name (st), "image/")) - ((GstDiscovererVideoInfo *) dc->priv->current_info->stream_info)-> - is_image = TRUE; + ((GstDiscovererVideoInfo *) dc->priv->current_info-> + stream_info)->is_image = TRUE; } } From 83c9396850bd1389553041b3d53d7ad3e539ad8b Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Tue, 10 Jan 2012 19:01:11 +0000 Subject: [PATCH 08/17] Revert "oggmux: fix pad leak" This reverts commit 5df30c1b905edce16f2258e414a0a4afb540d0f1. I must have dreamt the Valgrind logs, reverting this reintroduces no leak, and gets rid of the test failures it introduced :S --- ext/ogg/gstoggmux.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index 862134700b..7aeecc023e 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -287,8 +287,6 @@ gst_ogg_mux_finalize (GObject * object) ogg_mux->collect = NULL; } - gst_object_unref (ogg_mux->srcpad); - G_OBJECT_CLASS (parent_class)->finalize (object); } From 7ad64318376694048405efbeb720305b958474a6 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Wed, 11 Jan 2012 11:55:36 +0000 Subject: [PATCH 09/17] discoverer: fix pad leak --- gst-libs/gst/pbutils/gstdiscoverer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index bbbcad2802..140eb029b8 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -821,8 +821,10 @@ find_stream_for_node (GstDiscoverer * dc, const GstStructure * topology) gst_structure_id_get (topology, _TOPOLOGY_PAD_QUARK, GST_TYPE_PAD, &pad, NULL); - if (!dc->priv->streams) + if (!dc->priv->streams) { + gst_object_unref (pad); return NULL; + } for (i = 0, tmp = dc->priv->streams; tmp; tmp = tmp->next, i++) { ps = (PrivateStream *) tmp->data; From 9ab18d7a68398237a27c4226e4e2a967d1d31231 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Wed, 11 Jan 2012 11:55:59 +0000 Subject: [PATCH 10/17] discoverer: add a few consts where appropriate --- gst-libs/gst/pbutils/gstdiscoverer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index 140eb029b8..2c4fdf25e5 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -845,9 +845,9 @@ find_stream_for_node (GstDiscoverer * dc, const GstStructure * topology) } static gboolean -child_is_raw_stream (GstCaps * parent, GstCaps * child) +child_is_raw_stream (const GstCaps * parent, const GstCaps * child) { - GstStructure *st1, *st2; + const GstStructure *st1, *st2; const gchar *name1, *name2; st1 = gst_caps_get_structure (parent, 0); From 96e40584ce2bc4002244f5d0bcbc32d79e93b604 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Wed, 11 Jan 2012 12:16:28 +0000 Subject: [PATCH 11/17] discoverer: fix caps and discoverer object ref leaks --- gst-libs/gst/pbutils/gstdiscoverer.c | 29 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index 2c4fdf25e5..ce1cd0d3cb 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -641,7 +641,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, if (!st || !gst_structure_id_has_field (st, _CAPS_QUARK)) { GST_WARNING ("Couldn't find caps !"); if (parent) - return parent; + return gst_discoverer_stream_info_ref (parent); else return (GstDiscovererStreamInfo *) gst_mini_object_new (GST_TYPE_DISCOVERER_STREAM_INFO); @@ -655,11 +655,11 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, GstDiscovererAudioInfo *info; if (parent) - info = (GstDiscovererAudioInfo *) parent; + info = (GstDiscovererAudioInfo *) gst_discoverer_stream_info_ref (parent); else { info = (GstDiscovererAudioInfo *) gst_mini_object_new (GST_TYPE_DISCOVERER_AUDIO_INFO); - info->parent.caps = caps; + info->parent.caps = gst_caps_ref (caps); } if (gst_structure_get_int (caps_st, "rate", &tmp)) @@ -692,6 +692,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, } } + gst_caps_unref (caps); return (GstDiscovererStreamInfo *) info; } else if (g_str_has_prefix (name, "video/") || @@ -699,11 +700,11 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, GstDiscovererVideoInfo *info; if (parent) - info = (GstDiscovererVideoInfo *) parent; + info = (GstDiscovererVideoInfo *) gst_discoverer_stream_info_ref (parent); else { info = (GstDiscovererVideoInfo *) gst_mini_object_new (GST_TYPE_DISCOVERER_VIDEO_INFO); - info->parent.caps = caps; + info->parent.caps = gst_caps_ref (caps); } if (gst_structure_get_int (caps_st, "width", &tmp) && @@ -745,17 +746,19 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, (GstTagList *) tags_st); } + gst_caps_unref (caps); return (GstDiscovererStreamInfo *) info; } else if (is_subtitle_caps (caps)) { GstDiscovererSubtitleInfo *info; if (parent) - info = (GstDiscovererSubtitleInfo *) parent; + info = + (GstDiscovererSubtitleInfo *) gst_discoverer_stream_info_ref (parent); else { info = (GstDiscovererSubtitleInfo *) gst_mini_object_new (GST_TYPE_DISCOVERER_SUBTITLE_INFO); - info->parent.caps = caps; + info->parent.caps = gst_caps_ref (caps); } if (gst_structure_id_has_field (st, _TAGS_QUARK)) { @@ -779,6 +782,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, } } + gst_caps_unref (caps); return (GstDiscovererStreamInfo *) info; } else { @@ -786,11 +790,11 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, GstDiscovererStreamInfo *info; if (parent) - info = parent; + info = gst_discoverer_stream_info_ref (parent); else { info = (GstDiscovererStreamInfo *) gst_mini_object_new (GST_TYPE_DISCOVERER_STREAM_INFO); - info->caps = caps; + info->caps = gst_caps_ref (caps); } if (gst_structure_id_get (st, _TAGS_QUARK, @@ -798,6 +802,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, gst_discoverer_merge_and_replace_tags (&info->tags, tags_st); } + gst_caps_unref (caps); return info; } @@ -937,6 +942,8 @@ parse_stream_topology (GstDiscoverer * dc, const GstStructure * topology, if (add_to_list) { dc->priv->current_info->stream_list = g_list_append (dc->priv->current_info->stream_list, res); + } else { + gst_discoverer_stream_info_unref (res); } } else if (GST_VALUE_HOLDS_LIST (nval)) { @@ -1056,8 +1063,8 @@ discoverer_collect (GstDiscoverer * dc) gst_caps_get_structure (dc->priv->current_info->stream_info->caps, 0); if (g_str_has_prefix (gst_structure_get_name (st), "image/")) - ((GstDiscovererVideoInfo *) dc->priv->current_info-> - stream_info)->is_image = TRUE; + ((GstDiscovererVideoInfo *) dc->priv->current_info->stream_info)-> + is_image = TRUE; } } From 426f991b522e1fe63d30e3bf3e1a9b587bcaeca9 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Wed, 11 Jan 2012 12:52:17 +0000 Subject: [PATCH 12/17] discoverer: fix leaks caused by some base class dtors not being called --- gst-libs/gst/pbutils/gstdiscoverer-types.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gst-libs/gst/pbutils/gstdiscoverer-types.c b/gst-libs/gst/pbutils/gstdiscoverer-types.c index 1f658c97db..0cb9a1bde8 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer-types.c +++ b/gst-libs/gst/pbutils/gstdiscoverer-types.c @@ -210,6 +210,7 @@ static void gst_discoverer_audio_info_finalize (GstDiscovererAudioInfo * info) { g_free (info->language); + gst_discoverer_stream_info_finalize ((GstDiscovererStreamInfo *) info); } static void @@ -263,6 +264,7 @@ static void gst_discoverer_subtitle_info_finalize (GstDiscovererSubtitleInfo * info) { g_free (info->language); + gst_discoverer_stream_info_finalize ((GstDiscovererStreamInfo *) info); } static void From 9f4b71b2a71fd3f2b6c82ed74a6273dfbca5a3eb Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Wed, 11 Jan 2012 16:17:42 +0000 Subject: [PATCH 13/17] oggdemux: fix push mode chain leak When I first implemented push mode seeking, I removed the chain freeing there as it could be used later. The current code does not seem to do that though, so I'm restoring the previous freeing, which plugs the leak while apparently not reintroducing use of freed data with chained and normal files, both with gst-launch playbin2 and Totem. --- ext/ogg/gstoggdemux.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 6afcae6432..5baef83518 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -2436,10 +2436,12 @@ gst_ogg_demux_deactivate_current_chain (GstOggDemux * ogg) pad->added = FALSE; } - /* With push mode seeking implemented, we can now seek back to the chain, - so we do not destroy it */ - GST_DEBUG_OBJECT (ogg, "Resetting current chain"); - ogg->current_chain = NULL; + + /* if we cannot seek back to the chain, we can destroy the chain + * completely */ + if (!ogg->pullmode) { + gst_ogg_chain_free (chain); + } return TRUE; } From 1a8ee4536c4f99fab56ed9b4105312d64dc5e271 Mon Sep 17 00:00:00 2001 From: "Reynaldo H. Verdejo Pinochet" Date: Wed, 11 Jan 2012 20:47:00 -0300 Subject: [PATCH 14/17] Add missing DEFAULT_INCLUDES on androgenizer call Fix building of the libgstvideo module on Android by adding the missing and needed $(DEFAULT_INCLUDES) to CFLAGS for the androgenizer call on gst-libs/gst/video/Makefile.am Before this change, building was failing due to gst-plugins-base/ and gst-plugins-base/gst-libs/gst/video being left out of the include path. --- gst-libs/gst/video/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gst-libs/gst/video/Makefile.am b/gst-libs/gst/video/Makefile.am index 854b0b3db7..730699540e 100644 --- a/gst-libs/gst/video/Makefile.am +++ b/gst-libs/gst/video/Makefile.am @@ -107,7 +107,7 @@ Android.mk: Makefile.am $(BUILT_SOURCES) -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ -:SOURCES $(libgstvideo_@GST_MAJORMINOR@_la_SOURCES) \ $(nodist_libgstvideo_@GST_MAJORMINOR@_la_SOURCES) \ - -:CFLAGS $(DEFS) $(libgstvideo_@GST_MAJORMINOR@_la_CFLAGS) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstvideo_@GST_MAJORMINOR@_la_CFLAGS) \ -:LDFLAGS $(libgstvideo_@GST_MAJORMINOR@_la_LDFLAGS) \ $(libgstvideo_@GST_MAJORMINOR@_la_LIBADD) \ -ldl \ From ab7e72ad7069d54f23ddbea67f11984a4a93857a Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Thu, 12 Jan 2012 14:26:05 +0000 Subject: [PATCH 15/17] discoverer: fix structure leak I hit the 'misc' one, but let's also make sure the topology one get freed as well, though I do not know if this can happen twice. --- gst-libs/gst/pbutils/gstdiscoverer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index ce1cd0d3cb..8d2d03bbd5 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -1160,8 +1160,12 @@ handle_message (GstDiscoverer * dc, GstMessage * msg) GST_DEBUG_OBJECT (GST_MESSAGE_SRC (msg), "Setting result to MISSING_PLUGINS"); dc->priv->current_info->result = GST_DISCOVERER_MISSING_PLUGINS; + if (dc->priv->current_info->misc) + gst_structure_free (dc->priv->current_info->misc); dc->priv->current_info->misc = gst_structure_copy (msg->structure); } else if (sttype == _STREAM_TOPOLOGY_QUARK) { + if (dc->priv->current_topology) + gst_structure_free (dc->priv->current_topology); dc->priv->current_topology = gst_structure_copy (msg->structure); } } From 3fbd95d85ed293a43b9c76b2b21ad3b0eb634fc7 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Thu, 12 Jan 2012 16:24:01 +0000 Subject: [PATCH 16/17] theoraparse: fix array leak --- ext/theora/gsttheoraparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/theora/gsttheoraparse.c b/ext/theora/gsttheoraparse.c index da0d49cf2b..4e356c6613 100644 --- a/ext/theora/gsttheoraparse.c +++ b/ext/theora/gsttheoraparse.c @@ -241,7 +241,7 @@ theora_parse_get_property (GObject * object, guint prop_id, g_value_unset (&v); } - g_value_set_boxed (value, array); + g_value_take_boxed (value, array); } break; default: From 70c6c2ae0cfd9fe20e31f5dc9c340973645bb079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 12 Jan 2012 17:31:44 +0000 Subject: [PATCH 17/17] tests: discoverer test is now valgrind clean --- tests/check/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index ad9cafac44..3280ba3018 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -167,7 +167,6 @@ check_PROGRAMS = \ # ffmpegcolorspace takes too long, so disabled for now VALGRIND_TO_FIX = \ elements/ffmpegcolorspace \ - libs/discoverer \ libs/video # these tests don't even pass