ws-video: merge ws/video-vp8 (final); F.open wraps images as videos only for category video (F.video.open); F.video.fromFrames for image sequences
This commit is contained in:
commit
5161fb3371
5 files changed
+92
-10
No files matched your search
@@ -60,7 +60,7 @@ for _, c in Cases do
|
||||
if string.sub(c.name, 1, 5) == "vp80-" then
|
||||
vectors += 1
|
||||
end
|
||||
if #samples < 6 and #c.ivf < 40000 then
|
||||
if #samples < 6 and #c.ivf < 20000 then
|
||||
table.insert(samples, b)
|
||||
end
|
||||
end
|
||||
@@ -123,7 +123,41 @@ local function feed(b: buffer)
|
||||
end
|
||||
return any, nil
|
||||
end
|
||||
t:fuzz("stream", feed, samples, { mutations = 6, keepHeader = 32 })
|
||||
t:fuzz("stream (more damage)", feed, samples, { mutations = 30, keepHeader = 32, garbage = 20 })
|
||||
-- damage aimed at inter frames: one frame truncated, or bytes changed in its headers / modes (first 48 bytes)
|
||||
local damaged: { buffer } = {}
|
||||
local rand = T.rng(8)
|
||||
for _, b in samples do
|
||||
local fr = ivfFrames(b)
|
||||
for _ = 1, 12 do
|
||||
local k = 2 + rand(#fr - 1)
|
||||
local parts = {}
|
||||
for i, f in fr do
|
||||
local data = buffer.readstring(b, f[1], f[2])
|
||||
if i == k then
|
||||
if rand(2) == 0 then
|
||||
data = string.sub(data, 1, rand(#data))
|
||||
else
|
||||
for _ = 1, 1 + rand(3) do
|
||||
local at = 1 + rand(math.min(48, #data))
|
||||
data = string.sub(data, 1, at - 1) .. string.char(rand(256)) .. string.sub(data, at + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
local hdr = buffer.create(12)
|
||||
buffer.writeu32(hdr, 0, #data)
|
||||
table.insert(parts, buffer.tostring(hdr) .. data)
|
||||
end
|
||||
table.insert(damaged, buffer.fromstring(buffer.readstring(b, 0, 32) .. table.concat(parts)))
|
||||
end
|
||||
end
|
||||
local throws = 0
|
||||
for _, b in damaged do
|
||||
if not pcall(feed, b) then
|
||||
throws += 1
|
||||
end
|
||||
end
|
||||
t:eq(throws, 0, #damaged .. " streams with one damaged inter frame: no throw")
|
||||
t:fuzz("stream", feed, samples, { mutations = 5, keepHeader = 32 })
|
||||
t:fuzz("stream (more damage)", feed, samples, { mutations = 15, keepHeader = 32, garbage = 20 })
|
||||
|
||||
t:done()
|
||||
Reference in new issue
Block a user