Skip to content

Commit

Permalink
Merge pull request #8716 from kaltura/anatolkaltura-patch-31
Browse files Browse the repository at this point in the history
Adjust chunkDuration to 4K contents
  • Loading branch information
anatolkaltura committed Aug 21, 2019
2 parents adc388a + 8c8c116 commit 870e2fc
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions infra/chunkedEncode/KChunkedEncodeUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ class KChunkedEncodeReturnStatus {
* Session setup values
*/
class KChunkedEncodeSetup {

const DefaultChunkDuration = 60; // secs
// DefaultChunkDuration for frame height>1280 (basically 4K and QHD).
// Chunk dur's for smaller frames evaluated from that value.
const DefaultChunkDuration = 30; // secs
const DefaultChunkOverlap = 0.5; // secs
const DefaultConcurrentChunks = 1;// secs

Expand Down Expand Up @@ -82,17 +83,28 @@ public function Update($params)
}

if(!isset($this->chunkDuration)) {
if($params->height>480)
$this->chunkDuration = self::DefaultChunkDuration;
else if($params->height>360)
$this->chunkDuration = 2*self::DefaultChunkDuration;
else
$this->chunkDuration = 3*self::DefaultChunkDuration;
$this->chunkDuration = self::calculateChunkDuration($params->height);
}

if($this->concurrentMin>$this->concurrent)
$this->concurrentMin = $this->concurrent;
}

/********************
* calculateChunkDuration
*/
public static function calculateChunkDuration($height)
{
if($height>1280)
return self::DefaultChunkDuration;
else if($height>480)
return self::DefaultChunkDuration*2;
else if($height>360)
return self::DefaultChunkDuration*4;
else
return self::DefaultChunkDuration*6;
}

}

/********************
Expand Down

0 comments on commit 870e2fc

Please sign in to comment.