Skip to content

Commit 5169c4e

Browse files
committed
clip: add more logging to debug failed clips
Clips are failing reporting 'start time specified exceeds duration of manifest'. This may happen for webrtc streams where the clip request comes in but the segments and manifest hasn't been written yet to S3. I n this case, the start time would fall past the latest segment and this error case would be hit -- however, we have several retries for this exact scenario. Based on logs, there are 10 retries every 5 seconds in addition to 3 studio retries - this should be sufficient for the latest segments to be written to S3 and the clip request would eventually succeed. This is not happening so we're adding the additional logging to ensure latest manifests are being downloaded on retry attempts.
1 parent ca7f48f commit 5169c4e

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

clients/manifest.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515

1616
"github.com/cenkalti/backoff/v4"
1717
"github.com/grafov/m3u8"
18+
"github.com/livepeer/catalyst-api/log"
1819
"github.com/livepeer/catalyst-api/video"
1920
)
2021

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

227229
// Generate the absolute path URLS for segmens from the manifest's relative path
228230
// TODO: optimize later and only get absolute path URLs for the start/end segments

video/clip.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func ClipManifest(requestID string, manifest *m3u8.MediaPlaylist, startTime, end
113113
// Find the segment index that correlates with the specified startTime
114114
// but error out it exceeds the manifest's duration.
115115
if startTime > manifestDuration {
116-
return nil, []ClipSegmentInfo{}, fmt.Errorf("error clipping: start time specified exceeds duration of manifest")
116+
return nil, []ClipSegmentInfo{}, fmt.Errorf("error clipping: start time (%f) specified exceeds duration of manifest (%f)", startTime, manifestDuration)
117117
} else {
118118
clipStartSegmentInfo, err = getRelevantSegment(manifest.Segments, startTime, 0)
119119
if err != nil {

video/clip_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func TestClippingSucceedsWhenValidManifestIsUsed(t *testing.T) {
150150

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

156156
// end exceeds the duration of playlist: ensure only 0.ts is returned

0 commit comments

Comments
 (0)