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

clip: add more logging to debug failed clips #1318

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions clients/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"github.com/cenkalti/backoff/v4"
"github.com/grafov/m3u8"
"github.com/livepeer/catalyst-api/log"
"github.com/livepeer/catalyst-api/video"
)

Expand Down Expand Up @@ -223,6 +224,7 @@ func ClipInputManifest(requestID, sourceURL, clipTargetUrl string, startTimeUnix
if err != nil {
return nil, fmt.Errorf("error clipping: failed to download original manifest: %w", err)
}
log.Log(requestID, "Downloaded manifest to clip", "segments", origManifest.Count())

// Generate the absolute path URLS for segmens from the manifest's relative path
// TODO: optimize later and only get absolute path URLs for the start/end segments
Expand Down
2 changes: 1 addition & 1 deletion video/clip.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func ClipManifest(requestID string, manifest *m3u8.MediaPlaylist, startTime, end
// Find the segment index that correlates with the specified startTime
// but error out it exceeds the manifest's duration.
if startTime > manifestDuration {
return nil, []ClipSegmentInfo{}, fmt.Errorf("error clipping: start time specified exceeds duration of manifest")
return nil, []ClipSegmentInfo{}, fmt.Errorf("error clipping: start time (%f) specified exceeds duration of manifest (%f)", startTime, manifestDuration)
} else {
clipStartSegmentInfo, err = getRelevantSegment(manifest.Segments, startTime, 0)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion video/clip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func TestClippingSucceedsWhenValidManifestIsUsed(t *testing.T) {

// start exceeds the duration of playlist: ensure no segments are returned
segs, _, err = ClipManifest("1234", plB, 30, 20.78)
require.ErrorContains(t, err, "start time specified exceeds duration of manifest")
require.ErrorContains(t, err, "exceeds duration of manifest")
require.Equal(t, segs, []*m3u8.MediaSegment(nil))

// end exceeds the duration of playlist: ensure only 0.ts is returned
Expand Down
Loading