Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transcode completion % should reflect that there's now a DTSH generation stage after transcoding #164

Merged
merged 3 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions clients/callback_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ func overallCompletionRatio(status TranscodeStatus, currentStageCompletionRatio
switch status {
case TranscodeStatusPreparing, TranscodeStatusPreparingCompleted:
return scaleProgress(currentStageCompletionRatio, 0, 0.4)
case TranscodeStatusTranscoding, TranscodeStatusCompleted:
return scaleProgress(currentStageCompletionRatio, 0.4, 1)
case TranscodeStatusTranscoding:
return scaleProgress(currentStageCompletionRatio, 0.4, 0.9)
case TranscodeStatusCompleted:
return scaleProgress(currentStageCompletionRatio, 0.9, 1)
}

// Either unhandled or an error
Expand Down
2 changes: 1 addition & 1 deletion clients/callback_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestItCalculatesTheOverallCompletionRatioCorrectly(t *testing.T) {
}{
{TranscodeStatusPreparing, 0.5, 0.2}, // Half complete in the Preparing stage (i.e half way between 0 and 0.4)
{TranscodeStatusPreparingCompleted, 1234, 0.4}, // Preparing Completed should always == 0.4 for now, regardless of what's reported as the stage ratio
{TranscodeStatusTranscoding, 0.5, 0.7}, // Half complete in the Transcoding stage (i.e half way between 0.4 and 1)
{TranscodeStatusTranscoding, 0.5, 0.65}, // Half complete in the Transcoding stage (i.e half way between 0.4 and 0.9)
{TranscodeStatusCompleted, 5678, 1}, // Completed should always == 1, regardless of what's reported as the stage ratio
}
for _, tc := range testCases {
Expand Down
4 changes: 2 additions & 2 deletions transcode/transcode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ low-bitrate/index.m3u8

// Check we received a progress callback for each segment
require.Equal(t, 2, len(callbacks))
require.Equal(t, 0.7, callbacks[0]["completion_ratio"])
require.Equal(t, 1.0, callbacks[1]["completion_ratio"])
require.Equal(t, 0.65, callbacks[0]["completion_ratio"])
require.Equal(t, 0.9, callbacks[1]["completion_ratio"])

// Check we received a final Transcode Completed callback
require.Equal(t, 1, len(outputs))
Expand Down