From 2c82fdf2762a2ffeb83d5d311ba612d2c9da53f0 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sun, 7 Aug 2022 14:26:45 +1000 Subject: [PATCH] hlsdemux2: Use gst_hls_media_playlist_recalculate_stream_time() Instead of recalculating stream times manually in a playlist, let the playlist do it, so that it fixes up partial segment stream times too. Part-of: --- .../ext/adaptivedemux2/hls/gsthlsdemux.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c index a3f37699c5..a826fc9f28 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c @@ -2186,21 +2186,17 @@ gst_hls_update_time_mappings (GstHLSDemux * demux, static void setup_initial_playlist (GstHLSDemux * demux, GstHLSMediaPlaylist * playlist) { - guint idx, len = playlist->segments->len; GstM3U8MediaSegment *segment; - GstClockTimeDiff pos = 0; GST_DEBUG_OBJECT (demux, "Setting up initial variant segment and time mapping"); /* This is the initial variant playlist. We will use it to base all our timing * from. */ - - for (idx = 0; idx < len; idx++) { - segment = g_ptr_array_index (playlist->segments, idx); - - segment->stream_time = pos; - pos += segment->duration; + segment = g_ptr_array_index (playlist->segments, 0); + if (segment) { + segment->stream_time = 0; + gst_hls_media_playlist_recalculate_stream_time (playlist, segment); } }