audio/mp3: a Xing/Info frame count of 0 (ffmpeg writing to a pipe) no longer caps the length to 0; the frames found are the length, as ffmpeg does
This commit is contained in:
1 parent
200d7a58f3
commit
01c044805f
6 files changed
+1010
-988
No files matched your search
@@ -50,15 +50,19 @@ function Stream.new(b: buffer, idx: any, tags: { [string]: string }, id3: any):
|
||||
local total = idx.outTotal
|
||||
if idx.vbrTag > 0 then
|
||||
delay = idx.delay
|
||||
local detected = spf * idx.tagFrames
|
||||
if detected >= delay then
|
||||
detected -= delay
|
||||
end
|
||||
if idx.padding > 0 and detected >= idx.padding then
|
||||
detected -= idx.padding
|
||||
end
|
||||
total = max(0, total - delay)
|
||||
total = min(total, detected)
|
||||
-- (a frame count of 0: written by an encoder that couldn't seek back to fill it in, e.g. ffmpeg writing to a
|
||||
-- pipe; ffmpeg ignores it too. The frames found in the file are the length.)
|
||||
if idx.tagFrames > 0 then
|
||||
local detected = spf * idx.tagFrames
|
||||
if detected >= delay then
|
||||
detected -= delay
|
||||
end
|
||||
if idx.padding > 0 and detected >= idx.padding then
|
||||
detected -= idx.padding
|
||||
end
|
||||
total = min(total, detected)
|
||||
end
|
||||
end
|
||||
delay = min(delay, idx.outTotal)
|
||||
local self = setmetatable({
|
||||
|
||||
Reference in new issue
Block a user