hlsdemux: seek all streams

This commit is contained in:
Michael Olbrich 2016-07-28 14:22:02 +02:00 committed by Jan Schmidt
parent decafb5f4c
commit 89727ee9a3

View file

@ -299,7 +299,7 @@ gst_hls_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
GstSeekType start_type, stop_type;
gint64 start, stop;
gdouble rate, old_rate;
GList *walk;
GList *walk, *stream_walk;
GstClockTime current_pos, target_pos;
gint64 current_sequence;
GstM3U8MediaFile *file;
@ -349,6 +349,10 @@ gst_hls_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
/* TODO why not continue using the same? that was being used up to now? */
gst_hls_demux_change_playlist (hlsdemux, bitrate, NULL);
}
for (stream_walk = demux->streams; stream_walk != NULL;
stream_walk = stream_walk->next) {
GstHLSDemuxStream *hls_stream =
GST_HLS_DEMUX_STREAM_CAST (stream_walk->data);
current_sequence = 0;
current_pos = 0;
@ -364,7 +368,7 @@ gst_hls_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
GST_M3U8_CLIENT_LOCK (hlsdemux->client);
/* FIXME: Here we need proper discont handling */
for (walk = hlsdemux->current_variant->m3u8->files; walk; walk = walk->next) {
for (walk = hls_stream->playlist->files; walk; walk = walk->next) {
file = walk->data;
current_sequence = file->sequence;
@ -393,12 +397,12 @@ gst_hls_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
current_sequence++;
}
GST_DEBUG_OBJECT (demux, "seeking to sequence %u", (guint) current_sequence);
for (walk = demux->streams; walk != NULL; walk = walk->next)
GST_HLS_DEMUX_STREAM_CAST (walk->data)->reset_pts = TRUE;
hlsdemux->current_variant->m3u8->sequence = current_sequence;
hlsdemux->current_variant->m3u8->current_file = walk;
hlsdemux->current_variant->m3u8->sequence_position = current_pos;
GST_DEBUG_OBJECT (demux, "seeking to sequence %u",
(guint) current_sequence);
hls_stream->reset_pts = TRUE;
hls_stream->playlist->sequence = current_sequence;
hls_stream->playlist->current_file = walk;
hls_stream->playlist->sequence_position = current_pos;
GST_M3U8_CLIENT_UNLOCK (hlsdemux->client);
/* Play from the end of the current selected segment */
@ -413,6 +417,7 @@ gst_hls_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
gst_segment_do_seek (&demux->segment, rate, format, flags, start_type,
start, stop_type, current_pos, NULL);
}
}
return TRUE;
}