diff --git a/extract-playlist.php b/extract-playlist.php index d326518..b539120 100644 --- a/extract-playlist.php +++ b/extract-playlist.php @@ -662,10 +662,10 @@ function consolidate( $target, $segments ) { $size = $segments[0]['size']; $timestamp = $segments[0]['timestamp']; $duration = $segments[0]['duration']; - $nextTarget = $timestamp + $target; + //$nextTarget = $timestamp + $target; $nextDuration = $target; $i = 1; - while ( $i < $n - 1 ) { + while ( $i < $n ) { // Append segments until we get close while ( $i < $n - 1 && $duration < $nextDuration ) { $total = $duration + $segments[$i]['duration']; @@ -689,8 +689,8 @@ function consolidate( $target, $segments ) { 'timestamp' => $timestamp, 'duration' => $duration, ]; - $nextTarget += $target; - $nextDuration = $nextTarget - $timestamp - $duration; + //$nextTarget += $target; + //$nextDuration = $nextTarget - $timestamp - $duration; if ( $i < $n ) { $segment = $segments[$i];