X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=stream.cpp;h=2c7c42ed75154fbff911fcdcf53421c7dd7500e3;hp=7ea8a956ee7addf099bb586ef41686decd91dbfc;hb=cb042ee88b5f4cd6e5f55bada4d9d86807f1640b;hpb=5ee2e95320160f0d01a9af5cea5c799c3ce1eaa9 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)) {