Commit Graph

1137 Commits

Author SHA1 Message Date
Joey Parrish 01e7f3bd19
ci: Refactor release workflows (#1309)
This adopts release-please to manage releases and changelogs, similar to
other shaka-project repos.

All release workflows can be run by forks by configuring repo secrets.
See docs in .github/workflows/ for details.

 - Use release-please for releases, changelogs
 - Convert publication jobs (docs, docker, npm) into reusable workflows
 - Update workflow documentation
 - Modernize docker commands
 - Fix doc permissions for publication
 - Update artifact handling in build workflow
 - Fix paths in Dockerfile
 - Fix paths and arm64 support in NPM package
 - Fix install paths for PSSH tools
 - Fix warnings in NPM & Docker actions
 - Delete custom changelog tooling
2023-11-30 13:17:01 -08:00
Joey Parrish 2038339926
build: Separate shared and static library targets (#1293)
This splits the target so that we always build static libraries, but
optionally also build shared libraries. This also tweaks the
installation so that the static library is never installed, because it
is not usable without the other internal static library deps. The
headers and pkgconfig will only be installed if we have a shared library
to use them with.
2023-10-22 17:46:33 -07:00
Joey Parrish 562473c57e
build: Use the standard BUILD_SHARED_LIBS variable (#1292)
Use the standard BUILD_SHARED_LIBS variable instead of the custom
LIBPACKAGER_SHARED variable
2023-10-19 10:05:35 -07:00
Joey Parrish 168e74c4c9
fix: Fix dependency on system zlib (#1291) 2023-10-19 10:05:23 -07:00
Joey Parrish bcc275454d
fix: Fix clang build (#1288)
Issue #561
2023-10-18 16:47:09 -07:00
Joey Parrish 1e9b251be8
fix: Fix UdpFile build on FreeBSD (#1287)
Issue #561
2023-10-18 16:46:25 -07:00
Joey Parrish fac8acf5dd
feat: Build c-ares locally (#1285)
c-ares (used on Linux only) was an exception to the rule of only linking
against internally-built libraries. This fixes that, to support a truly
static build of packager.
2023-10-18 16:44:43 -07:00
Cosmin Stejerean e516608c5e
feat: copy packager_test.py in CMake (#1284)
This is used to run a fairly large number of integrations tests (which are exposing some failures on the CMake branch). Let's copy these over first to enable the integration tests workflow.

Actually running integration tests in CTest is off by default (gated by `SKIP_INTEGRATION_TESTS` while we fix the tests).
2023-10-18 16:06:10 -07:00
Joey Parrish 985abb23d6
fix: Fix internal libraries built as dynamic by default (#1283)
This caused issues with some shared library link tests when I tried to
split the library target into shared and static targets.
2023-10-18 11:31:29 -07:00
Joey Parrish 32723f81bc
build: Fix pssh-box.py targets, installation, and docs (#1279)
pssh-box.py needs Python protos, which we were not building. It also
needs to have those protos installed properly.

This fixes generation of Python proto interfaces and fixes the install
targets to put those protos where they are needed. This also updates the
documentation to match.
2023-10-17 12:52:40 -07:00
Cosmin Stejerean 4cedb7ca98
docs: update docs for CMake (#1270)
Updated the build docs for Linux, Mac and Windows.

Updated the Linux profiling docs to remove references to things that don't work anymore. 


---------

Co-authored-by: Joey Parrish <joeyparrish@google.com>
2023-10-17 09:39:11 -07:00
Cosmin Stejerean b224fb6e57
feat: add install target for cmake (#1269)
this adds an install target which will install binaries, libraries, pkg-config and headers, along with a simple link-test program to verify the installed library and headers work.

---------

Co-authored-by: Joey Parrish <joeyparrish@google.com>
2023-10-16 13:08:48 -07:00
Joey Parrish 0295ef182b
chore: Refactor public headers and macros (#1275)
This organizes all public headers for the library into
include/  and makes sure then don't rely on any headers from
other folders.

To accomplish this, this change also refactors macros.h,
media/base/macros.h, and status/status_macros.h into macros/classes.h,
macros/compiler.h, macros/crypto.h, macros/logging.h, macros/status.h,
and public/export.h.  Now the export macros from macros.h live in
include/ to keep include/ from requiring anything else.

This refactor enables an install target that includes public headers
only.

---------

Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
2023-10-14 09:36:01 -07:00
Joey Parrish 7653e1e02f
feat: Replace glog with absl::log (#1274)
This deprecates --vmodule (not available in absl, mapping it to --v for
a very minimal sort of compatibility) and adds the absl::log flags
--minloglevel, --stderrthreshold, --log_backtrace_at, and --log_prefix.
2023-10-13 12:42:47 -07:00
Joey Parrish 3b3e267221
style: Sort headers to comply with the style guide (#1273)
Reorder headers to follow the Google C++ Style Guide:

> In dir/foo.cc or dir/foo_test.cc:
>
> 1. dir2/foo2.h.
> 2. A blank line
> 3. C system headers (more precisely: headers in angle brackets with
the .h extension), e.g., <unistd.h>, <stdlib.h>.
> 4. A blank line
> 5. C++ standard library headers (without file extension), e.g.,
<algorithm>, <cstddef>.
> 6. A blank line
> 7. Other libraries' .h files.
> 8. A blank line
> 9. Your project's .h files.


https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes
2023-10-11 16:49:50 +08:00
Joey Parrish 4e310f03bf
style: Use angle-brackets for all internal headers (#1271)
This feeds into efforts to create a working install target.

The order of headers is still funky, and was "fixed" by clang-format,
but in a way that doesn't exactly align with the style guide. Further
cleanup of header order is coming in a follow-up PR.
2023-10-11 07:51:11 +08:00
Cosmin Stejerean 1337e86597
style: cleanup unused includes and use consistent <> for external code (#1267) 2023-10-09 16:21:41 -07:00
Cosmin Stejerean 72117f85ad
feat: add verbose logging flags for CMake branch (#1266)
Co-authored-by: Joey Parrish <joeyparrish@google.com>
2023-10-09 11:08:08 -07:00
Cosmin Stejerean 8b87804c57
fix: apply cmake fixes after merge of #1210 (#1264)
build in CMake branch is broken at least locally on OS X after #1210 was
merged which introduced some new warnings and reintroduced
base::nullopt.
2023-09-19 09:03:32 +01:00
Joey Parrish 5557e76c2b Merge remote-tracking branch 'upstream/main' into cmake 2023-09-13 11:22:35 -07:00
Cosmin Stejerean 6b68c138cc
feat: port demuxer and app to cmake (#1260)
Related to issue #1047

After this it should be possible to build a working `packager` application from the `cmake` branch. Some further logging improvements may be needed to get full parity with the `main` branch in terms of ability to do verbose debug logging, but other than that everything is expected to work.
2023-09-08 17:44:17 -07:00
sr90 8465f5f020
feat(DASH): Add video transfer characteristics. (#1210)
This PR is related to https://github.com/shaka-project/shaka-packager/issues/1035
2023-09-08 14:41:41 -07:00
Cosmin Stejerean 274c885253 Merge branch 'main' into cmake 2023-09-03 10:01:08 -07:00
Cosmin Stejerean 3afe761637
feat: port media/formats/* to cmake (#1258)
Issue #1047
2023-08-31 16:59:46 -07:00
Caitlin O'Callaghan f264befe86
feat: Write colr atom to muxed mp4 (#1261)
This PR is an extension of the full AV1 codec string feature: [PR
1205](https://github.com/shaka-project/shaka-packager/pull/1205) and
relates to [Issue
1007](https://github.com/shaka-project/shaka-packager/issues/1007) and
[Issue
1202](https://github.com/shaka-project/shaka-packager/issues/1202).

As per the AV1 spec, the codec string may contain optional color values.
These color values are critical for detecting HDR video streams - see
[Issue
1007](https://github.com/shaka-project/shaka-packager/issues/1007).
Color information is extracted from the input mp4's `colr` atom and used
to generate the full AV1 codec string. This PR preserves the color
information by writing the `colr` atom to the muxed mp4.

**References**:
- [AV1 Codec ISO Media File Format
Binding](https://aomediacodec.github.io/av1-isobmff/#codecsparam)
- [AV1 Bitstream & Decoding Process
Specification - Section 6.4.2 Color config semantics (page
117)](https://aomediacodec.github.io/av1-spec/av1-spec.pdf)
- [QuickTime File Format
Specification](https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-125526)
2023-08-29 18:46:19 -07:00
Cosmin Stejerean ab8485c5b7
feat: port HLS module to CMake (#1238)
related to issue #1047
2023-08-21 18:41:18 -07:00
Cosmin Stejerean 682ac3c990 Merge branch 'main' into cmake 2023-08-21 17:22:35 -07:00
Prakash Duggaraju dcf32258ff
fix: Fix handling of non-interleaved multi track FMP4 files (#1214)
Do not assume that each fragment contains all tracks. 
Use track id instead of index to pick the correct timestamp.

Fixes #1213
2023-08-21 16:34:32 -07:00
Cosmin Stejerean 793518c73d Merge branch 'main' into cmake 2023-08-04 22:23:26 -07:00
Cosmin Stejerean 96acd1ecfd
feat: convert mpd module to cmake (#1234)
Related to issue #1047
2023-08-04 20:45:21 -07:00
Caitlin O'Callaghan cc9a691aef
feat: Generate the entire AV1 codec string when the colr atom is present (#1205)
As per the AV1 spec, the codec string may contain optional color values.

This extracts the missing color information from the mp4 `colr` atom, if
present, and generates the full AV1 codec string. 

Closes #1007
2023-08-04 09:00:59 -07:00
Cosmin Stejerean 97cf7c0a5b Merge branch 'main' into cmake 2023-08-02 12:38:01 -07:00
Joey Parrish ba51270b0e
feat: Port app/job_manager to cmake and absl (#1249)
Issue #1047 (cmake)
Issue #346 (absl)
2023-07-21 12:41:49 +02:00
sr90 520926c27a
fix(MP4): Add compatible brand dby1 for Dolby content. (#1211)
This PR adds dby1 compatible brand to dolby content as per
https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf
2023-07-18 19:50:33 -07:00
Joey Parrish 4515a9834d Merge branch 'main' into cmake 2023-07-18 16:20:45 -07:00
Joey Parrish 86a183a847
test: Use a random HTTP port for web server tests (#1248)
This will pick a random HTTP port for the test web server, and retry up
to 10 times if the chosen port number is in use.
2023-07-18 16:19:52 -07:00
Joey Parrish 5a2571b9bc
fix: Fix local files with UTF8 names (#1246)
This fixes our use of std::filesystem to interpret all paths names as
UTF8. Before this, UTF8 paths did not work correctly in all cases.

This also adds a new unit test to cover this case.

On Windows, it is critical that a UTF8 locale be set at runtime.
Applications linking with Packager as a library should call setlocale(),
and the Packager frontends now do this automatically after converting
wide character arguments into narrow strings.

Closes #652
2023-07-18 11:59:21 -07:00
Joey Parrish c29c03c6e3
test: Fix bad assertions in formats/mp4 and formats/mp2t tests (#1247)
PR #1242 introduced some bad assertions that went unnoticed because we
are not yet building those modules in the cmake branch. This fixes those
so that ASSERT_ macros are not used in non-void functions, and so that
assumptions about a successful parse are always after an ASSERT_ that
the data was loaded properly.

All ASSERT_ macros from #1242 were audited, and the others were all
fine.
2023-07-18 11:30:05 -07:00
Joey Parrish 137e692406
fix: Fix libpng include directories (#1245) 2023-07-18 10:30:41 +02:00
Joey Parrish 868a8c5d8e
ci: Collect and report test results (#1244)
All gtest-based tests should now use add_gtest. Results from these tests
will be surfaced more prominently in GitHub Actions. Before this, it was
hard to find test failures in the log.
2023-07-17 16:11:41 -07:00
Joey Parrish 60fb057f1a
test: Avoid crashing a test executable (#1242)
LOG(FATAL) aborts the executable, which means gtest can't write any
reports it might be configured to write when tests are complete. This
will interfere with reporting.

This converts the only use of LOG(FATAL), which was in
ReadTestDataFile(), to LOG(ERROR). This also updates test cases to avoid
crashing when ReadTestDataFile() returns an empty buffer.
2023-07-17 13:16:22 -07:00
Joey Parrish 052fb64068
ci: Enable parallel builds (#1241)
Our workflows and Dockerfiles now use Ninja on Linux & Mac, which
enables safe parallel builds. This significantly speeds up our
workflows.

GitHub Actions typical compilation times (build step only):
 - Linux 19m => 9m
 - macOS 23m => 8m
 - Windows 12m => 10m
 - Linux arm64 (self-hosted) 72m => 29m
 - Docker build 25m => 14m

Overall workflow time: 84m => 33m

Compilation time on my workstation (12 CPUs @3.3GHz): 15m => 3m

This also adds a new environment variable "PACKAGER_LOW_MEMORY_BUILD".
If defined when CMake is first run, this will configure the build to
disable parallel linking to reduce memory usage. This helps us avoid
failures on our self-hosted arm64 machines, where 6 CPUs share 4GB of
RAM.

NOTE: Parallel builds are **NOT** recommended with Unix Makefiles due to
the use of excessive RAM during parallel linking. Unix Makefiles, unlike
Ninja, cannot be configured to restrict parallel linking during a
parallel build. Anecdotally, parallel builds with Makefiles have
exhausted a system with 32GB RAM. (My workstation.)

In a follow-up, I will update the build documentation to refer to CMake
and recommend all of the flags now used in our workflows.
2023-07-17 13:16:03 -07:00
Joey Parrish 362d98ae62
test: Move CentOS 8 tests to CentOS 9 Stream (#1240)
CentOS 8 is EOL, and the official docker images will not be updated. See
https://www.centos.org/centos-linux-eol/

This switches to the latest release (CentOS 9 Stream). Since CentOS no
longer provides official images, this uses a third-party image provider
(https://hub.docker.com/u/tgagor)

This change also exposed a warning in absl that needed to be silenced in
the default version of GCC in CentOS 9 Stream (GCC 11.4).
2023-07-17 11:10:28 -07:00
Joey Parrish 899f763dd7
test: Fix data directory computation (#1239)
The `__FILE__` macro does not always get you an absolute path, so our
assumptions about it in test_data_util.cc were flawed.

If `foo.c` references `__FILE__`, something like `gcc -c foo.c`, will
define `__FILE__` as `"foo.c"`. If you use `gcc -c /path/to/foo.c`, then
`__FILE__` will be `"/path/to/foo.c"`.

The Ninja generator for CMake only generates absolute paths for source
files in certain CMake versions. (Exact range unknown.) Rather than
require newer CMake versions and depend on CMake's Ninja generator
maintaining the latest behavior forever, set the macro TEST_DATA_DIR to
point to the test data folder. This is consistent and never depends on
unspecified behavior.

This change will allow the use of the Ninja generator with older
versions of CMake, as found in most of our Docker builds.
2023-07-17 10:06:10 -07:00
Joey Parrish 53982dbab4
chore: Split out CMake policies into package/policies.cmake (#1236) 2023-07-17 06:41:23 -07:00
Joey Parrish 4b868de9f1
chore: Revert to upstream mongoose (#1235)
Since https://github.com/cesanta/mongoose/issues/2300 was closed, revert
to upstream mongoose, specifically the most recent tag "7.11"
2023-07-16 16:49:29 -07:00
Joey Parrish 8bf2d45424
fix: Fix compilation on Arch Linux (#1233)
- Update protobuf to v23.4, to fix the cstdint error on Arch Linux, and
  make some related changes:
   - Silence additional compiler warnings for the new protobuf
- Update absl to 20230125.3, to support the protobuf update, and make
  some related changes:
   - Silence additional compiler warnings for the new protobuf
   - Replace GOOGLE_CHECK_OK with ABSL_CHECK_OK
   - Replace GUARDED_BY with ABSL_GUARDED_BY
 - Update other instances of cstdint missing in our own code
- Always pull the latest docker images, to avoid stale results when your
  workstation has pulled an older image at the same label
2023-07-14 12:40:12 -07:00
Cosmin Stejerean 86bf6cf3cd
feat: Cmake port of Media crypto (#1221)
Rebasing #1148 on top of current cmake branch

Related to #1047

---------

Co-authored-by: Bartek Zdanowski <bartek.zdanowski@gmail.com>
Co-authored-by: Joey Parrish <joeyparrish@google.com>
2023-07-14 08:19:01 -07:00
Joey Parrish af98d48726
fix: Fix flush/close semantics for HTTP files, improve testing (#1232)
All HTTP-based tests now use an embedded test server instead of
httpbin.org, which makes them much faster and more reliable.

These more reliable tests also exposed some issues that began recently
with PR #1201.  HttpFile's Flush() semantics were different than those
documented for files in general.  Flush() used to close the file for
uploading, so that no further writes were allowed, but the documentation
stated that it would only flush data to its destination.  PR #1201
brought HttpFile's Flush() in line with the docs, but gave us no way to
terminate a chunked upload.

This adds a new method to File called CloseForWriting(), which
terminates a chunked upload for HttpFile.  The only other implementation
that does anything is UdpFile, which uses the socket library function
shutdown() to terminate writes while allowing reads.

This also tweaks HttpFile::CloseWithStatus() so that it will not
generate an error if the file is closed before the HTTP response is
written to the download cache.

This modifies the test HttpFileTest.MultipleWrites so that the file is
Flushed after each chunk.  This adds test coverage for the changes
introduced in PR #1201.

Fixes #1224 (missing test coverage for HttpFile::Flush)
2023-07-13 18:55:48 -07:00
Joey Parrish d4fcfb2f4f
test: Add Mongoose embedded HTTP server (#1231)
This adds Mongoose as a third-party library, and builds on top of that
an embedded HTTP server for our unit tests.

We are using a fork of Mongoose pending the merging of this PR:
https://github.com/cesanta/mongoose/pull/2301

The embedded web server will make our HTTP-based tests independent of
httpbin.org, which will make them quick and reliable.
2023-07-13 16:36:42 -07:00