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

Eyevinn / mp4ff / 37008910290
83%
master: 83%

Build:
Build:
LAST BUILD BRANCH: fix/segmenter-last-sample
DEFAULT BRANCH: master
Ran 02 Oct 2026 12:48PM UTC
Jobs 1
Files 217
Run time 2min
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

02 Oct 2026 12:48PM UTC coverage: 82.588% (+0.02%) from 82.565%
37008910290

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

Uncovered Changes

Lines Coverage ∆ File
5
81.33
0.68% mp4/crypto.go
Jobs
ID Job ID Ran Files Coverage
1 37008910290.1 02 Oct 2026 12:48PM UTC 217
82.59
GitHub Action Run
Source Files on build 37008910290
  • Tree
  • List 217
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #616
  • PR Base - master (#37003905289)
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