Skip to content

Commit

Permalink
Don't try to send partial result / source playback for transcode API (#…
Browse files Browse the repository at this point in the history
…219)

* Don't try to send partial result / source playback for transcode API

* fix tests
  • Loading branch information
mjh1 authored Sep 28, 2023
1 parent 7cd9df1 commit 29b8cd9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions task/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ func handleUploadVOD(p handleUploadVODParams) (*TaskHandlerOutput, error) {
if err := json.Unmarshal(tctx.StepInput, &sourcePlayback); err != nil {
return nil, fmt.Errorf("error parsing step input: %w", err)
}
if (tctx.Task != nil && tctx.Task.Type == "transcode-file") || tctx.OutputAsset == nil {
glog.Infof("not sending partial result. taskId=%s type=%s outputAssetNil=%t", tctx.Task.ID, tctx.Task.Type, tctx.OutputAsset == nil)
return ContinueAsync, nil
}
manifestPath, err := extractOSUriFilePath(sourcePlayback.Manifest, tctx.OutputAsset.PlaybackID)
if err != nil {
return nil, fmt.Errorf("error extracting file path from output manifest: %w", err)
Expand Down
24 changes: 24 additions & 0 deletions task/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ func Test_handleUploadVOD(t *testing.T) {
OutputAsset: &api.Asset{
PlaybackID: "playbackID",
},
Task: &api.Task{
Type: "upload",
},
},
},
manifest: "/hls/playbackID/master.m3u8",
Expand All @@ -318,6 +321,27 @@ func Test_handleUploadVOD(t *testing.T) {
Continue: true,
},
},
{
name: "happy transcode api",
args: handleUploadVODParams{
tctx: &TaskContext{
Context: context.Background(),
TaskInfo: data.TaskInfo{
Step: "resultPartial",
},
OutputAsset: &api.Asset{
PlaybackID: "playbackID",
},
Task: &api.Task{
Type: "transcode-file",
},
},
},
manifest: "/hls/playbackID/master.m3u8",
want: &TaskHandlerOutput{
Continue: true,
},
},
{
name: "parsing error",
args: handleUploadVODParams{
Expand Down

0 comments on commit 29b8cd9

Please sign in to comment.