diff options
author | Thiago Santos <ts.santos@sisa.samsung.com> | 2014-04-28 19:10:02 -0300 |
---|---|---|
committer | Thiago Santos <ts.santos@sisa.samsung.com> | 2014-04-29 18:49:15 -0300 |
commit | ff395a75655e2664601aeee029f615b73ee4fe29 (patch) | |
tree | e410f5dbbd5dee37cec59b3245355b721f939677 | |
parent | 2b73e86881881a78c6e40ed65e5ae6c5e1250e12 (diff) | |
download | gstreamer-plugins-bad-ff395a75655e2664601aeee029f615b73ee4fe29.tar.gz |
hlsdemux: Track fragments duration
When receving EOS from the internal src, increase the current positon
by the fragment duration to allow correct restoring of download position
if the bitrate changes
-rw-r--r-- | ext/hls/gsthlsdemux.c | 8 | ||||
-rw-r--r-- | ext/hls/gsthlsdemux.h | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c index 86db8bd5b..450d2739e 100644 --- a/ext/hls/gsthlsdemux.c +++ b/ext/hls/gsthlsdemux.c @@ -912,6 +912,8 @@ _src_event (GstPad * pad, GstObject * parent, GstEvent * event) demux->pending_buffer = NULL; } + if (demux->segment.rate > 0) + demux->segment.position += demux->current_duration; g_cond_signal (&demux->fragment_download_cond); break; default: @@ -1815,11 +1817,13 @@ gst_hls_demux_get_next_fragment (GstHLSDemux * demux, g_mutex_lock (&demux->fragment_download_lock); GST_DEBUG_OBJECT (demux, - "Fetching next fragment %s (range=%" G_GINT64_FORMAT "-%" G_GINT64_FORMAT - ")", next_fragment_uri, range_start, range_end); + "Fetching next fragment %s %" GST_TIME_FORMAT "(range=%" G_GINT64_FORMAT + "-%" G_GINT64_FORMAT ")", next_fragment_uri, GST_TIME_ARGS (timestamp), + range_start, range_end); /* set up our source for download */ demux->current_timestamp = timestamp; + demux->current_duration = duration; demux->starting_fragment = TRUE; demux->current_key = key; demux->current_iv = iv; diff --git a/ext/hls/gsthlsdemux.h b/ext/hls/gsthlsdemux.h index f6c425be4..9e0a796ed 100644 --- a/ext/hls/gsthlsdemux.h +++ b/ext/hls/gsthlsdemux.h @@ -115,6 +115,7 @@ struct _GstHLSDemux GMutex fragment_download_lock; GCond fragment_download_cond; GstClockTime current_timestamp; + GstClockTime current_duration; gboolean starting_fragment; gint64 download_start_time; gint64 download_total_time; |