merge master (ws/apifix) into ws/video2
This commit is contained in:
commit
7a67812d31
39 files changed
+1158
-73
No files matched your search
@@ -425,6 +425,11 @@ function Video.open(demuxer: Types.Demuxer, opts: OpenOptions?): (Types.VideoDec
|
||||
if img then
|
||||
local t = (pts or 0) / scale - start
|
||||
if t + 1e-9 >= skipUntil then
|
||||
if index < 0 then
|
||||
-- the first frame after a seek: its position in the stream (constant-rate: round(pts * fps);
|
||||
-- without a frame rate, counted from the seek)
|
||||
index = if v.frameRate > 0 then math.max(0, math.floor(t * v.frameRate + 0.5)) else 0
|
||||
end
|
||||
index += 1
|
||||
local d = defaultDur
|
||||
if lastPts and t > (lastPts :: number) and defaultDur == 0 then
|
||||
@@ -461,6 +466,7 @@ function Video.open(demuxer: Types.Demuxer, opts: OpenOptions?): (Types.VideoDec
|
||||
flushed = false
|
||||
skipUntil = seconds
|
||||
lastPts = nil
|
||||
index = -1 -- recomputed from the first frame's time
|
||||
if self.audio then
|
||||
pcall(self.audio.seek, self.audio, seconds)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user