Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull in latest libass/JavascriptSubtitlesOctopus #5

Open
wants to merge 165 commits into
base: master
Choose a base branch
from

Conversation

armands-malejevs
Copy link

No description provided.

zoriya and others added 30 commits October 26, 2020 02:24
Removing the arguments.callee to support strict JS
Add ready event upon worker-init
This moves all intermediate build files to build/lib/*.
This means that the original submodules are no longer modified,
which makes the build process substantially more robust.
These made it more difficult to manage branches, and their purpose
is better-served by github releases, the npm package, and simplified local builds
This works with any shell and the directory path may contain spaces.
Also, do no longer require this to be run from the project root.
Make it clear, that JSO is not an indepentend ASS-implementation; so
there are less compatability concerns.

libass doesn't actually support _all_ SSA (AlphaLevel),
ASS (fadeaway{width,height}, WrapStyle) and v4++ (\kt) features.

JSO doesn't actually support eg Graphite fonts, due to not including
libgraphite in its HarfBuzz builds.
Minor and Cosmetic Improvements
But restrict artificat creation to commits on master, to prevent the
possibility of someone accidentally downloading artificats containing a
malicious patch.
- Pin all uses-steps to the currently newest major version of the
  action, to avoid sudden breakages on major updates.
- Quote ${PWD}
- Give all steps descriptive names
Removed duplicate `timeupdate` event listener
The existing brotli submodule already provides an almost drop-in
replacement, though in the future we might want to replace it such that
only the C implementation is used, instead of needing both a C and JS
implementation of the brotli-decompressor.
Previously changing patchfiles did not trigger a rebuild of the
associated projects.
TheOneric and others added 30 commits June 21, 2022 18:33
With emscripten, LLVM is translated to JS during linking
and the optimisation level also has an effect here.
This was a regression from 9b1fc2e
and apart from performance also brings the total size of the distributed
files back down to ~7MiB from ~19MiB after the options were split.
This will make some types of bugs easier to detect
and avoid accidental additions of code not working
inside Modules, which always use strict mode.

Performance measurements show no relevant performance
difference between strict and non-strict mode, so this
won't cause regressions in this regard.
Do link-time optimizations and pre-evaluate code.

-s EVAL_CTORS=1 has no change in output currently.
-flto increases output size after optimizations
When -flto is enabled emscripten will generate "system libraries" cache, for all available libraries, including non-used ones.
This includes libGL.a, libal.a, libhtml5.a, which are not used in the project.
Disabling AUTONATIVE_LIBRARIES decreases compile time with -flto enabled.
Removes brotli.js and polyfills used to decode .br files.
Instead, use existing libbrotlidec on C++ code, using adapted source from https://github.com/google/brotli/blob/7f740f1308336e9ec0afdb9434896307859f5dc9/go/cbrotli/reader.go (which we depend on).

This saves about 100 KiB or so, mostly extra dictionary size.
pkg-config sets up the necessary lookup paths.
ASS subtitles can embed fonts with a custom encoding in
their [Fonts] section. For historic reasons ass_set_extract_fonts
defaults to disabled, so we need to explicitly opt-in.
There’s currently also an issue, with embedded fonts outliving
their track, which can lead to indefinitely growing memory consumption
if not all memory fonts are cleared on track reinit.

However, ass_clear_fonts can only be safely called if the renderer
also has been released first. At this point it is simpler to just
reinit the whole library-renderer-track triplet and library inits
are not that costly anyway.

JSO never uses (non-embedded) memory fonts itself and does not expose
any way to add them so this does not constitute a user-visible change.
Even oct_add_font cannot be used by consumers of upstream JSO binaries.

Note: the JS pointers of the libass handles are updated in this patch,
      but it appears they are actually never used.
This reverts commit 128be61.
It caused issues with complex brotli-compressed subtitles like the
Railgun or Attack on Titan opening, with only parts of the beginning
being rendered.
May be reapplied later on after it has been fixed.
EVAL_CTORS now errors when used without WASM,
previosuly it was likely just silently disabled.
Thus, only set it when linking with WASM.

There's now a new warning when closure isn't set explicitly
for non-WASM builds. Currently, there are errors concerning
redeclaration of the variable screen with closure enabled,
so explicitly disable it.
For the future, we probably want to remove the redeclaration
and enable closure.
This speeds up builds significantly.
If there are any changes affecting cached files
but not updating the hash used as a key, increase
the prefix before the hash.

The uncoditional checkout of submodules even if they'll be replaced by
the cached version is necessary to generate .git/modules/lib/*/HEAD
used as a dependency for license generation.
We cannot just use the non-cached checkouts, since autoconf VPATH builds
do need to generate the configure script inside lib/*. The fresh
checkout doesn't have it, which will tirgger a rebuild.
libass is bumped to current master,
everything else to its latest release.
It doesn't have much benefit but comes with
a maintenance cost as we either need to keep
patching upstream's js implementation for use in
JSO — which also bloats binary size by including
two copies of brotli and its default dict — or
use the C implemntation from JS which requires boilerplate
in both C and JS and also additional JS polyfills to keep
e.g. the fontname extraction working.

The browser's in-built support for Content-Encoding
is more felxible, faster and simpler to use.
Extracts default.woff2 from binary, embeds fonts.conf,
removes .data files on output.
Use --memory-init-file=0 to remove .mem files on output.
Specify fallbackFont to override default.woff2.
If lazyFileLoading is set to true, use FS.createLazyFile(). This is
off by default, as it depends on correct HTTP headers sent back.
checkouts@v2, [email protected] and
download-artifact@v2 use the deprecated Node.js v12.
set-output as an stdout command was replaced
with writing to a special file.
And upload-artifact also needs to be updated to v3
to avoid deprecated features.
New features and fixes:
 - LayoutRes{X,Y}
 - handle anamorphic blur correctly
 - support v4++’s \kt
 - support SSA’s AlphaLevel
 - parse integer headers like VSFilter
 - parse ScriptType header
libexpat:   R_2_4_9  ->  R_2_5_0
fontconfig: 2.14.0  ->  2.14.1
harfbuzz:   5.2.0  ->  5.3.1
libass:     git-1a533e5d  ->  0.17.0

For libass nothing relevant changed except the logged version number.
It is the only project actually recognising this option.
Apparently licensecheck has a high startup cost, so merging invocations
promises a neat speedup. However, currently some "\x{....} cannot be
represented as ascii" error messages appear in our logs. If that happens
licensecheck exits with 255, which omits all following files of the
same invocation and also prompts `find -exec .. {} +` or `xargs` to not
spwan any more invocations. If we were to simply merge invocations by
one of those means it would result in an incomplete COPYRIGHT file.

Those encoding errors appear to be due to an ASCII locale being set in
the container, so override LC_ALL to an UTF-8 one. To further make this
bit more resilient ensure licensecheck errors are no longer ignored by
capturing and processing its exit code.
It doesn't have much benefit but comes with a maintenance cost.
Instead the browser-inbuilt support for HTTP's Content-Encoding: header
can beu sed instead to let the browser handle decompression. This will
also work for more formats than just brotli.
The portable mkfifo approach works fine locally and worked fine in
initial GHA testing, but now it started to run into various stalling
issues on GHA. Presumably depending on whether the pipe is firt written
to or read from and attempts to find a simple workaround for it failed.
Sometimes (but not always!) this is accompanied by an error like this:
  cannot open ./__LICENSE_EXTRACT_QUEUE.tmp: Interrupted system call

So convert the script to bash and just use set -o pipefail.
Fixes omission in e3e0003

Cherry picked from: dmitrylyzo@57e6d98
It exists in the toplevel Makefile.

Cherry picked from: dmitrylyzo@eef75b7
PREPARE_SRC_VPATH is supposed to prepare the source, so leave
the creation of the 'configured' file to the actual Makefile target.

Cherry picked from: jellyfin@6fb7311
In /.github/workflows:
- styfle/cancel-workflow-action: 0.11.0 to 0.12.1
- actions/checkout: v3 to v4
- actions/cache: v3 to v4
- actions/upload-artifact: v3 to v4
- actions/download-artifact: v3 to v4

Signed-off-by: dependabot[bot] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants