Skip to content

Commit

Permalink
clip: add more logging to debug failed clips
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
emranemran committed Jul 14, 2024
1 parent ca7f48f commit 8204cc3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
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

0 comments on commit 8204cc3

Please sign in to comment.