ws-video: Vorbis granules from the block sizes (exact Ogg pages for Matroska Vorbis), ADTS AAC from TS passed through, audio checks read until filled

This commit is contained in:
4DBug committed 2026-10-31 09:53:16 -05:00
1 parent e044209ab1
commit 242ba7e5dc
2 files changed
+87 -2

No files matched your search

+10 -1
View File
@@ -144,7 +144,16 @@ function C.audio(t: any, v: any, c: any, label: string, exact: boolean?, minSnr:
local a = v.audio
a:seek(0)
local want = #c.pcm // 4
local out, got = a:read(want // a.channels)
local out = buffer.create(want * 4)
local got = 0
while got * a.channels < want do
local chunk, k = a:read(want // a.channels - got)
if not chunk or k <= 0 then
break
end
buffer.copy(out, got * a.channels * 4, chunk, 0, k * a.channels * 4)
got += k
end
local n = got * a.channels
t:check(n == want or n * 4 == c.pcmBytes, label .. ": " .. n .. " samples read of " .. want)
n = math.min(n, want)