]> git.sesse.net Git - cubemap/commitdiff
Fix an issue where HLS fragments would become too short when pts was low.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Apr 2019 12:38:14 +0000 (14:38 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Apr 2019 12:38:14 +0000 (14:38 +0200)
stream.cpp

index 7ea8a956ee7addf099bb586ef41686decd91dbfc..2c7c42ed75154fbff911fcdcf53421c7dd7500e3 100644 (file)
@@ -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)) {