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
This commit is contained in:
Thiago Santos 2014-04-28 19:10:02 -03:00
parent 2b73e86881
commit ff395a7565
2 changed files with 7 additions and 2 deletions

View file

@ -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;

View file

@ -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;