From: Tim-Philipp Müller Date: Sun, 13 May 2012 22:11:20 +0000 (+0100) Subject: oggdemux: fix potential crash in SEEKING query handler X-Git-Tag: RELEASE-0.11.92~130 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5518dd69c7f1d28aab313f7c102090cc46547392;p=platform%2Fupstream%2Fgst-plugins-base.git oggdemux: fix potential crash in SEEKING query handler Take chain lock when accessing chains. Fall back gracefully when there's no current chain Hopefully fixes crash when seeking in Jamendo or Magnatune streams in Amarok. https://bugzilla.gnome.org/show_bug.cgi?id=675609 --- diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 0c1a9bb..cb8c2f7 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -301,11 +301,23 @@ gst_ogg_pad_src_query (GstPad * pad, GstObject * parent, GstQuery * query) gboolean seekable = FALSE; gint64 stop = -1; + GST_CHAIN_LOCK (ogg); if (ogg->pullmode) { seekable = TRUE; stop = ogg->total_time; } else if (ogg->push_disable_seeking) { seekable = FALSE; + } else if (ogg->current_chain == NULL) { + GstQuery *squery; + + /* assume we can seek if upstream is seekable in BYTES format */ + GST_LOG_OBJECT (ogg, "no current chain, check upstream seekability"); + squery = gst_query_new_seeking (GST_FORMAT_BYTES); + if (gst_pad_peer_query (ogg->sinkpad, squery)) + gst_query_parse_seeking (squery, NULL, &seekable, NULL, NULL); + else + seekable = FALSE; + gst_query_unref (squery); } else if (ogg->current_chain->streams->len) { gint i; @@ -334,6 +346,7 @@ gst_ogg_pad_src_query (GstPad * pad, GstObject * parent, GstQuery * query) } gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, 0, stop); + GST_CHAIN_UNLOCK (ogg); } else { res = FALSE; }