Skip to content

Commit

Permalink
Revert "Reapply "clip: handle end segment offsets that are miniscule" (
Browse files Browse the repository at this point in the history
…#1325)"

This reverts commit 623f3fa.
  • Loading branch information
emranemran committed Jul 19, 2024
1 parent 623f3fa commit 53dd303
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3,179 deletions.
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

0 comments on commit 53dd303

Please sign in to comment.