mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 00:26:30 +00:00
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
2 changed files with 14 additions and 8 deletions
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,6 +40,7 @@ defmodule Pleroma.Helpers.QtFastStart do
|
||||||
got_mdat,
|
got_mdat,
|
||||||
acc
|
acc
|
||||||
) do
|
) do
|
||||||
|
try do
|
||||||
full_size = (size - 8) * 8
|
full_size = (size - 8) * 8
|
||||||
<<data::bits-size(full_size), rest::bits>> = rest
|
<<data::bits-size(full_size), rest::bits>> = rest
|
||||||
|
|
||||||
|
@ -50,6 +51,10 @@ defmodule Pleroma.Helpers.QtFastStart do
|
||||||
]
|
]
|
||||||
|
|
||||||
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
|
end
|
||||||
|
|
||||||
defp fix(<<>>, _pos, _, _, acc) do
|
defp fix(<<>>, _pos, _, _, acc) do
|
||||||
|
|
Loading…
Reference in a new issue