This commit is contained in:
Brooke Vibber 2023-03-13 15:42:16 -07:00
parent 879832dbc9
commit aacd048f12

View file

@ -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];