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

Revert "clip: handle end segment offsets that are miniscule" #1325

Merged
merged 1 commit into from
Jul 18, 2024
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
14 changes: 4 additions & 10 deletions video/clip.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import (
"bytes"
"context"
"fmt"
"math"
"os/exec"
"time"

"github.com/grafov/m3u8"
"github.com/livepeer/catalyst-api/log"
"os/exec"
"time"
)

type ClipStrategy struct {
Expand Down Expand Up @@ -61,12 +59,8 @@ func getRelevantSegment(allSegments []*m3u8.MediaSegment, playHeadTime float64,
}
// Check if the playhead is within the current segment and skip to
// the next segment if it's not. Also update the play head by referencing
// the starting time of the next segment. Rounding ensures the -ss and -to
// parameters used by ffmpeg fit within 3 decimal places -- otherwise we
// run the risk of an end segment with a very small offset that will get
// rounded to 0 and cause the ffmpeg pipeline to fail since both -ss and
// -to will be set to 0.
playHeadDiff = math.Round((playHeadTime-segment.Duration)*1000) / 1000
// the starting time of the next segment.
playHeadDiff = playHeadTime - segment.Duration
if playHeadDiff > 0.0 {
playHeadTime = playHeadDiff
continue
Expand Down
Loading
Loading