Change QTFastStart to recover gracefully if it encounters an error during bitstring matching
This fixes issues with internal errors when trying to serve the video
This commit is contained in:
parent
8ac4458630
commit
50edef5bc1
1
changelog.d/qtfaststart.fix
Normal file
1
changelog.d/qtfaststart.fix
Normal file
@ -0,0 +1 @@
|
||||
MediaProxy Preview failures prevented when encountering certain video files
|
@ -40,16 +40,21 @@ defmodule Pleroma.Helpers.QtFastStart do
|
||||
got_mdat,
|
||||
acc
|
||||
) do
|
||||
full_size = (size - 8) * 8
|
||||
<<data::bits-size(full_size), rest::bits>> = rest
|
||||
try do
|
||||
full_size = (size - 8) * 8
|
||||
<<data::bits-size(full_size), rest::bits>> = rest
|
||||
|
||||
acc = [
|
||||
{fourcc, pos, pos + size, size,
|
||||
<<size::integer-big-size(32), fourcc::bits-size(32), data::bits>>}
|
||||
| acc
|
||||
]
|
||||
acc = [
|
||||
{fourcc, pos, pos + size, size,
|
||||
<<size::integer-big-size(32), fourcc::bits-size(32), data::bits>>}
|
||||
| acc
|
||||
]
|
||||
|
||||
fix(rest, pos + size, got_moov || fourcc == "moov", got_mdat || fourcc == "mdat", acc)
|
||||
fix(rest, pos + size, got_moov || fourcc == "moov", got_mdat || fourcc == "mdat", acc)
|
||||
rescue
|
||||
_ ->
|
||||
:abort
|
||||
end
|
||||
end
|
||||
|
||||
defp fix(<<>>, _pos, _, _, acc) do
|
||||
|
Loading…
Reference in New Issue
Block a user