• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Eyevinn / mp4ff
83%
master: 83%

Build:
Build:
LAST BUILD BRANCH: fix/segmenter-last-sample
DEFAULT BRANCH: master
Repo Added 01 Nov 2024 09:40PM UTC
Files 221
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH perf/encrypt-allocs
branch: perf/encrypt-allocs
CHANGE BRANCH
x
Reset
  • perf/encrypt-allocs
  • aac-asc-header
  • av1-crypto-rap
  • av1-update
  • avcc-encode-trailing-info
  • avcc-preserve-trailing-bytes
  • avs3
  • chore-bump-min-go-1.18
  • chore-bump-min-go-1.19
  • chore/changelog-union-merge
  • chore/codespell
  • chore/go-1.24-build-version
  • chore/prepare-v0.53.0
  • chore/prepare-v0.56.0
  • chore/prepare-v0.57.0
  • chore/prepare-v0.58.0
  • chore/remove-goreportcard-badge
  • ci/checkout-v7
  • codespell
  • colr-icc-decode
  • compressorname-length-clamp
  • dac4
  • decode-box-body-sr
  • defragment-core
  • defragment-hybrid
  • defragment-overlaps
  • docs/benchmarks
  • docs/changelog-dec3-joc
  • docs/claude-md-history
  • docs/defragment-wording
  • docs/encoding-and-changelog
  • docs/fix-doc-comment-drift
  • docs/fix-misleading-doc-comments
  • docs/install-instructions
  • docs/osc-badge-utm-2026-10-09
  • docs/trim-claude-md
  • elst-media-rate
  • esds-vocabulary
  • feat-coll-box
  • feat-create-sei-nalu
  • feat-hevc-encrypt
  • feat-ivf
  • feat-lbli-sample-group
  • feat-lhvc-box
  • feat-linf-oinf-sample-groups
  • feat-mvhevc-builders
  • feat-mvhevc-cli
  • feat-trgr-track-group
  • feat-vexu-spatial-video
  • feat-vp-codec-sample-box
  • feat-vps-multilayer-extension
  • feat/av1-metadata-obu-cea608
  • feat/brands-check
  • feat/brands-defragmenter
  • feat/brands-general-type-box
  • feat/brands-generate
  • feat/caller-provided-memory
  • feat/clone-box
  • feat/dolby-vision-dvh1-dvhe
  • feat/dref-resolver
  • feat/fragment-reset
  • feat/hevc-hdr-boxes
  • feat/mdat-payload
  • feat/motion-jpeg
  • feat/mov-decoder
  • feat/paint-model-subtitle-boxes
  • feat/piff
  • feat/rsot-box
  • feat/saiz-v1-v2
  • feat/stream-read-mdat-data
  • feat/ttma-box
  • feature-encryption-boxes
  • feature/exporttfhd
  • fix-611-dataparts
  • fix-avcdecoderconfig
  • fix-bound-more-bitstream-counts
  • fix-co64-size-overflow
  • fix-container-children-bounds
  • fix-ftyp-styp-short-payload
  • fix-goreleaser-brew
  • fix-hevc-ps-dos
  • fix-interleaved-sidx-boxes
  • fix-mime-box
  • fix-senc-panic
  • fix-senc-robustness
  • fix-short-esds-issue-393
  • fix-sliceheader-spsid
  • fix-sps-num-ref-frames-overflow
  • fix-ssix-box
  • fix-stsc
  • fix-subs-box
  • fix-trailing-avc1-bytes
  • fix-typos
  • fix-vps-ols0-necessary-layers
  • fix/annexb-trailing-zeros
  • fix/avc-deblock-offsets
  • fix/avc-hrd-cpb-cnt
  • fix/avc-param-set-ranges
  • fix/avc-pps-scaling-lists
  • fix/box-versions-above-1
  • fix/cenc-encrypt-conformance
  • fix/cenc-increment
  • fix/container-error-bounded
  • fix/container-size-underflow
  • fix/decoders-exact-box-size
  • fix/empty-trak-subtitle-header
  • fix/external-data-references
  • fix/get-sample-data-indexing
  • fix/hevc-multilayer-ext-sps
  • fix/hevc-slice-deblocking-inference
  • fix/issyncsampleflags
  • fix/leva-grouping-type
  • fix/mdat-mixed-data
  • fix/moov-decode-linear
  • fix/nalu-length-size-checks
  • fix/oob-panics
  • fix/prft-decode
  • fix/sample-data-inverted-interval
  • fix/sdtp-entry-depends-on
  • fix/segmenter-last-sample
  • fix/sei-nalu-short-panic
  • fix/sgpd-description-length-bound
  • fix/stsc-containing-chunks
  • fix/stsc-sample-description-id
  • fix/stts-decode-time-bounds
  • fix/top-level-box-attribution
  • fix/trun-mdat-bounds
  • flac
  • fuzz-box
  • go-releaser
  • golangci-lint-v2
  • handle-trailing-avc1-bytes
  • hevc-ref-idx-255
  • hevc-vps
  • iMro0t-feature-encryption-boxes
  • iMro0t-fix-avcdecoderconfig
  • improve-av1
  • improved-crypt-tools
  • issue-492
  • labl-box
  • lpcm-format-flags
  • master
  • mdat-header-size
  • mdhd-dur-info
  • minimal-ac4
  • more-robust-decode
  • mp4-blackbox-test
  • mpeg-h
  • nalu-length-size
  • nalu-length-size-helpers
  • new-pssh-func
  • normalize-quicktime
  • opus
  • parse-joc-dolby-atmos
  • patch-1
  • perf/add-full-samples
  • perf/addfullsamples-always-parts
  • perf/bits-av1-allocs
  • perf/buffer-cmd-writers
  • perf/buffer-writetofile
  • perf/built-fragment-offsets
  • perf/bulk-table-decode
  • perf/cipher-hoist
  • perf/decode-allocs
  • perf/ebsp-allocs
  • perf/encode-allocs
  • perf/fragment-decoder
  • qt-legacy-audio-entries
  • qt-sound-descriptions
  • refactor/styp-delegate
  • release-v0.59.0
  • release/v0.51.0
  • release/v0.52.0
  • release/v0.54.0
  • release/v0.55.0
  • remove-homebrew-cask
  • return-partial-files
  • sampleflags-test
  • sei-recovery-point
  • spherical-v1-no-xml
  • sphericalv1
  • stream-process
  • test-header-parsing
  • test-visualsampleentry
  • tkhd-preserve-matrix
  • update-changelog
  • update-coverage-job
  • update-docs
  • update-make
  • v0.48.0
  • v0.49.0
  • v0.50.0
  • vtpl1-master
  • vvc
  • vvc-nal-headers
  • wave-box
  • wave-box-followups
  • weird-dac3

02 Oct 2026 01:04PM UTC coverage: 82.588% (+0.02%) from 82.565%
37010599950

Pull #616

github

tobbee
perf(mp4): encrypt fragments without per-sample allocations in cbcs

FragmentEncryptor.EncryptFragment allocated for every sample: a slice of subsample patterns, a new CBC encrypter for every subsample in cbcs, a new IV slice for every sample in cenc, and a parsed avc.SliceHeader for every cbcs slice.

Now the encryptor creates one CBC encrypter and resets it with SetIV at the start of every protected range, which the encrypters of the standard library support, including the FIPS 140 AES one that Go 1.24 and later return; another cipher.Block falls back to the previous code. The per-sample IVs and subsample patterns, which senc and saiz keep until the fragment is encoded, get one array each per fragment, and every sample's entry is capped with a full slice expression so that later appends cannot overwrite it. The IV is advanced in scratch arrays in the encryptor, the full samples are collected with AppendFullSamples into a reused slice, and cbcs AVC ranges use avc.SliceHeaderSize. The unexported sampleProtector interface appends ranges to a slice, and HEVC and AV1 append the result of their existing functions.

FragmentEncryptor.IV now returns a copy. It returned the encryptor's own slice, so a caller that changed the returned IV changed the IV of the next fragment, and since the IV is now updated in place, a returned IV would also have changed after the next fragment.

The output is byte-for-byte the same as before for AVC, HEVC, AV1 and AAC, with cenc and 8- and 16-byte IVs and with cbcs, for the test segments as they are and as one-sample fragments, both with one FragmentEncryptor and with chained EncryptFragment calls (36 outputs, compared with a throwaway test).

BenchmarkEncryptFragments (testdata/1.m4s, Apple M4 Pro, n=8):
- cbcs, one 60-sample fragment: 22.3 µs -> 18.0 µs, 190 -> 12 allocations
- cbcs, 60 one-sample fragments: 27.7 µs -> 23.8 µs, 603 -> 425 allocations
- cenc, one 60-sample fragment: 10.5 µs -> 10.0 µs, 192 -> 73 allocations
-... (continued)
Pull Request #616: perf(mp4): encrypt fragments without per-sample allocations in cbcs

80 of 85 new or added lines in 1 file covered. (94.12%)

23104 of 27975 relevant lines covered (82.59%)

0.83 hits per line

Relevant lines Covered
Build:
Build:
27975 RELEVANT LINES 23104 COVERED LINES
0.83 HITS PER LINE
Source Files on perf/encrypt-allocs
  • Tree
  • List 217
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
37010599950 perf/encrypt-allocs perf(mp4): encrypt fragments without per-sample allocations in cbcs FragmentEncryptor.EncryptFragment allocated for every sample: a slice of subsample patterns, a new CBC encrypter for every subsample in cbcs, a new IV slice for every sample in c... Pull #616 02 Oct 2026 01:04PM UTC tobbee github
82.59
37008910290 perf/encrypt-allocs perf(mp4): encrypt fragments without per-sample allocations in cbcs FragmentEncryptor.EncryptFragment allocated for every sample: a slice of subsample patterns, a new CBC encrypter for every subsample in cbcs, a new IV slice for every sample in c... Pull #616 02 Oct 2026 12:48PM UTC tobbee github
82.59
37008873014 perf/encrypt-allocs perf(mp4): encrypt fragments without per-sample allocations in cbcs FragmentEncryptor.EncryptFragment allocated for every sample: a slice of subsample patterns, a new CBC encrypter for every subsample in cbcs, a new IV slice for every sample in c... Pull #616 02 Oct 2026 12:48PM UTC tobbee github
82.59
See All Builds (624)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc