diff options
author | Matthieu Bouron <matthieu.bouron@collabora.com> | 2014-09-10 15:39:44 -0300 |
---|---|---|
committer | Thiago Santos <thiagoss@osg.samsung.com> | 2014-09-11 18:25:19 -0300 |
commit | bce21e73982ed476a1d4ecd73007ba382a4510f3 (patch) | |
tree | 26b1f6c1f002fda9535cba2184e8c5943ff242c3 /ext/smoothstreaming | |
parent | 4ed7c7919a2659d24e5450d2dd8cc927dd47bb2e (diff) | |
download | gstreamer-plugins-bad-bce21e73982ed476a1d4ecd73007ba382a4510f3.tar.gz |
mssdemux: improve position detection when a download restart
Query other src pads before falling back to the position of the last
known pushed segment (which can be far ahead in time).
https://bugzilla.gnome.org/show_bug.cgi?id=736421
Diffstat (limited to 'ext/smoothstreaming')
-rw-r--r-- | ext/smoothstreaming/gstmssdemux.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/ext/smoothstreaming/gstmssdemux.c b/ext/smoothstreaming/gstmssdemux.c index 428618015..e7c4fe6c0 100644 --- a/ext/smoothstreaming/gstmssdemux.c +++ b/ext/smoothstreaming/gstmssdemux.c @@ -1472,9 +1472,31 @@ gst_mss_demux_download_loop (GstMssDemuxStream * stream) GST_DEBUG_OBJECT (mssdemux, "Downstream position: %" GST_TIME_FORMAT, GST_TIME_ARGS (ts)); } else { - GST_DEBUG_OBJECT (mssdemux, "Downstream position query failed, " - "failling back to segment position"); - ts = stream->segment.position; + gboolean have_pos = FALSE; + + /* query other pads as some faulty element in the pad's branch might + * reject position queries. This should be better than using the + * demux segment position that can be much ahead */ + for (GSList * iter = mssdemux->streams; iter != NULL; + iter = g_slist_next (iter)) { + GstMssDemuxStream *cur_stream = iter->data; + + have_pos = + gst_pad_peer_query_position (cur_stream->pad, GST_FORMAT_TIME, + &pos); + if (have_pos) { + ts = (GstClockTime) pos; + GST_DEBUG_OBJECT (stream->pad, "Downstream position: %" + GST_TIME_FORMAT, GST_TIME_ARGS (ts)); + break; + } + } + + if (!have_pos) { + ts = stream->segment.position; + GST_DEBUG_OBJECT (stream->pad, "Downstream position query failed, " + "failling back to looking at other pads"); + } } /* we might have already pushed this data */ |