Skip to content

Commit fa6cd2b

Browse files
committed
Woops, / should be * in seeking.
This problem is caused because time base is a fraction.
1 parent c774724 commit fa6cd2b

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

video/private/ffmpeg-pipeline.rkt

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -365,19 +365,19 @@
365365
(match bundle
366366
[(struct* stream-bundle ([start-offset start-offset]
367367
[file file]))
368-
(when (and start-offset (not (= start-offset +inf.0)))
369-
(with-handlers ([exn:fail?
370-
(λ (e)
371-
(log-video-warning "Cannot seek from ~a, starting from beginning"
372-
file))])
373-
(define seek-point
374-
(exact-floor (/ (max 0 (- start-offset 1))
375-
AV-TIME-BASE)))
376-
(av-seek-frame avformat
377-
-1
378-
seek-point
379-
'(backwards))))]))
380-
368+
(when (and start-offset (not (= start-offset +inf.0)))
369+
(with-handlers ([exn:fail?
370+
(λ (e)
371+
(log-video-warning "Cannot seek from ~a, starting from beginning"
372+
file))])
373+
(define seek-point
374+
(exact-floor (* (max 0 (- start-offset 1))
375+
AV-TIME-BASE)))
376+
(av-seek-frame avformat
377+
-1
378+
seek-point
379+
'(backwards))))]))
380+
381381
;; #t - More to read
382382
;; #f - Done reading
383383
(define/public (read-packet)
@@ -1245,8 +1245,10 @@
12451245
(log-video-debug "Video Graph Created: ~a" (graphviz g))
12461246
(log-video-debug "Filter Graph Created: ~a" g-str)
12471247
(define seek-points (get-seek-point g 0))
1248-
(log-video-info "Starting Streams at points: ~a" (for/hash ([(k v) (in-hash seek-points)])
1249-
(values (stream-bundle-file k) v)))
1248+
(if seek?
1249+
(log-video-info "Starting Streams at points: ~a" (for/hash ([(k v) (in-hash seek-points)])
1250+
(values (stream-bundle-file k) v)))
1251+
(log-video-info "Seeking disabled, starting from beginning of stream"))
12501252
(define graph (avfilter-graph-alloc))
12511253
(define outputs
12521254
(for/fold ([ins '()])

0 commit comments

Comments
 (0)