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
@@ -99,6 +99,16 @@ for _, c in Cases do
|
||||
end
|
||||
t:eq(dec.frames, c.ffFrames, name .. ": frames vs ffmpeg")
|
||||
t:check(dec.bitrate > 0, name .. ": bitrate")
|
||||
-- the same file with its Xing / Info frame count zeroed (an encoder that never filled it in): the frames found
|
||||
-- are the length (it used to be 0: nothing played)
|
||||
local at = string.find(c.data, "Xing", 1, true) or string.find(c.data, "Info", 1, true)
|
||||
if at and at < 400 and bit32.band(string.byte(c.data, at + 7), 1) ~= 0 then
|
||||
local z = buffer.fromstring(c.data)
|
||||
buffer.writeu32(z, at - 1 + 8, 0)
|
||||
local zd = open(z)
|
||||
t:check(zd and zd.frames >= dec.frames and zd.frames <= dec.frames + 2304,
|
||||
("%s: a Xing frame count of 0 is ignored (%s frames)"):format(name, tostring(zd and zd.frames)))
|
||||
end
|
||||
|
||||
local all = buffer.create(dec.frames * ch * 4)
|
||||
local total = 0
|
||||
|
||||
Reference in new issue
Block a user