ws-apifix: one bitrate unit: every encoder's bitrate option is bit/s (MP3 now too), values below 1000 are kbit/s (the old MP3 values keep working; Opus accepts them too); the MP3 Decoder's bitrate field is bit/s as the Decoder contract says (was kbit/s)

This commit is contained in:
4DBug committed 2026-10-31 14:06:51 -05:00
1 parent 3c2a646365
commit ac47545aa3
10 files changed
+35 -14

No files matched your search

+3
View File
@@ -85,6 +85,9 @@ do
t:check(again, "encode from a decoder: " .. tostring(err))
local back = Opus.decode(Bytes.reader(again :: buffer)) :: any
t:eq(back.frames, math.floor(c.seconds * 48000 + 0.5), "re-encoded length")
-- values below 1000 are kbit/s: the same file as the bit/s value
local kb = Opus.encode(Opus.open(Bytes.reader(files[1] :: buffer)) :: any, { bitrate = 64 })
t:check(kb ~= nil and buffer.tostring(kb :: buffer) == buffer.tostring(again :: buffer), "bitrate 64 = 64000 bit/s")
end
-- errors