From cb042ee88b5f4cd6e5f55bada4d9d86807f1640b Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 13 Apr 2019 14:38:14 +0200 Subject: [PATCH] Fix an issue where HLS fragments would become too short when pts was low. --- stream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream.cpp b/stream.cpp index 7ea8a95..2c7c42e 100644 --- a/stream.cpp +++ b/stream.cpp @@ -394,7 +394,7 @@ bool Stream::add_fragment_boundary(size_t byte_position, const RationalPTS &pts) // (RFC 8216 4.3.3.1) and we get closer to the target by doing so. // Note that in particular, this means we'll always extend // as long as we don't exceed the target duration. - double current_duration = fragments[fragments.size() - 1].pts; + double current_duration = pts_double - fragments[fragments.size() - 1].pts; double candidate_duration = pts_double - fragments[fragments.size() - 2].pts; if (lrintf(candidate_duration) <= hls_frag_duration && fabs(candidate_duration - hls_frag_duration) < fabs(current_duration - hls_frag_duration)) { -- 2.39.2