mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-02 00:37:37 +00:00
* media: look up the track of each traf in a hash map * media: bound Matroska indexing by a file-wide frame budget Every indexed frame claims its stored bytes and at least one, so fixed-size laces of empty frames cannot describe more frames than the file has bytes. The frame count across tracks is capped at 2^26, the TrackEntry count at 2^16, and blocks find their track through a hash map. * media: keep the spec spellings of Colour, ColourSpace and colourPrimaries * media: PCM chunks stay bounded in MOV and MP4 The writer ends a PCM chunk at 1 MiB or half a second, and returns an error past 2^32 - 1 samples in a track instead of clamping the stsz count. The reader splits a PCM chunk above 16 MiB into several samples, so files from writers without chunk limits read whole past 4 GiB. A sparse output lets the tests write past 4 GiB, which also exercises the writer's co64 path. * media: clamp max_lace_frames to 256 and round BlockDuration * media: level-1 Matroska elements read at most the file's length in all SeekHead entries pointing at nested elements made each one read the rest of the file. * media: set_sample_entry rejects a codec change * media: the mux oracle compares stream counts before streams * ci: media checkout does not persist credentials * media: README lists the renames from FilmCraft and the output that differs on valid input * media: rustfmt * media: the stream count comparison leaves out timecode streams * media: PCM chunks end at 1 MiB only, as ffmpeg's do ffmpeg's PCM chunks run past half a second, so a duration limit split remuxed chunks the source kept whole. * media: frames and samples indexed scale with the file's length Matroska indexes at most one frame per 8 bytes of file and ISO BMFF at most one sample per 4 bytes, beyond the first 2^20 of each, so the sample tables stay within about ten times the file's size. Empty fixed-size laces and one-byte constant-size samples could make them 40 to 76 times its size. * media: clamp the frame and sample allowances
66 lines
2.6 KiB
YAML
66 lines
2.6 KiB
YAML
name: Shared media
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: ["crates/media/**", "Cargo.toml", "Cargo.lock", ".github/workflows/media.yml"]
|
|
pull_request:
|
|
paths: ["crates/media/**", "Cargo.toml", "Cargo.lock", ".github/workflows/media.yml"]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: shared-media-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint:
|
|
timeout-minutes: 10
|
|
name: Media lint, feature sets, WASM
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
targets: wasm32-unknown-unknown
|
|
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
|
|
with:
|
|
key: craft-media-lint
|
|
- run: cargo fmt -p craft-media --check
|
|
- run: cargo clippy -p craft-media --all-targets --locked --no-default-features -- -D warnings
|
|
- run: cargo clippy -p craft-media --all-targets --locked --no-default-features --features bitstream -- -D warnings
|
|
- run: cargo clippy -p craft-media --all-targets --locked -- -D warnings
|
|
- run: cargo clippy -p craft-media --all-targets --locked --no-default-features --features matroska -- -D warnings
|
|
- run: cargo clippy -p craft-media --all-targets --locked --all-features -- -D warnings
|
|
- run: cargo check -p craft-media --all-features --locked --target wasm32-unknown-unknown
|
|
test:
|
|
timeout-minutes: 15
|
|
name: Media tests with ffmpeg oracles
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
|
|
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
|
|
with:
|
|
key: craft-media-test
|
|
- name: Build tests while installing ffmpeg
|
|
run: |
|
|
# The man-db index rebuild after dpkg is slow on hosted runners.
|
|
sudo rm -f /var/lib/man-db/auto-update
|
|
(sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends ffmpeg) > "$RUNNER_TEMP/apt.log" 2>&1 &
|
|
apt=$!
|
|
cargo test -p craft-media --all-features --locked --no-run
|
|
wait "$apt" || { cat "$RUNNER_TEMP/apt.log"; exit 1; }
|
|
ffmpeg -hide_banner -version | sed -n 1p
|
|
- run: cargo test -p craft-media --all-features --locked
|
|
env:
|
|
CRAFT_MEDIA_REQUIRE_ORACLES: "1"
|
|
CRAFT_MEDIA_FIXTURES_DIR: ${{ runner.temp }}/media-fixtures
|