From 6223a1953f9e63e2d04834585c92eb892b6448de Mon Sep 17 00:00:00 2001 From: Norbert Schlia Date: Sun, 22 Sep 2024 16:38:32 +0200 Subject: [PATCH] Closes #164: Allow jumping back in time to lower HLS segments --- src/ffmpeg_transcoder.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ffmpeg_transcoder.cc b/src/ffmpeg_transcoder.cc index c22dfdba..9eeb23e1 100644 --- a/src/ffmpeg_transcoder.cc +++ b/src/ffmpeg_transcoder.cc @@ -5535,7 +5535,8 @@ int FFmpeg_Transcoder::start_new_segment() // No check if m_segment_duration == 0, values <= 0 not accepted // Cast is OK here, the result will always be small enough for an int32. uint32_t min_seek_segments = static_cast(params.m_min_seek_time_diff / params.m_segment_duration); - if (min_seek_segments && next_segment + min_seek_segments >= segment_no) + + if (min_seek_segments && segment_no >= next_segment && segment_no <= next_segment + min_seek_segments) { Logging::info(virtname(), "Discarding seek request to HLS segment no. %1, less than %2 seconds (%3 segments) away.", segment_no, params.m_min_seek_time_diff / AV_TIME_BASE, min_seek_segments); continue;