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

Eyevinn / mp4ff / 37001471578
83%
master: 83%

Build:
Build:
LAST BUILD BRANCH: fix/segmenter-last-sample
DEFAULT BRANCH: master
Ran 02 Oct 2026 11:31AM UTC
Jobs 1
Files 217
Run time 1min
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 11:30AM UTC coverage: 82.533% (+0.004%) from 82.529%
37001471578

Pull #613

github

tobbee
perf(mp4): encode fragments without allocating

Fragment.Encode called Encode on every top-level box, and each box's Encode made a slice writer and a buffer of its own size, encoded into it and wrote it out: 13 allocations for a fragment of one sample. Encode now sizes everything but the mdat payloads, assembles those bytes with EncodeSW in one buffer from a sync.Pool, and writes the buffer up to each mdat header followed by the mdat data parts directly, so media data is still never copied. The FixedSliceWriter lives in the pooled struct too, since it would otherwise escape to the heap as a bits.SliceWriter.

SetTrunDataOffsets collected the truns in a new slice and sorted them with sort.Slice. It now uses an 8-element array on the stack and slices.SortFunc, and skips sorting a single trun, which also takes allocations off EncodeSW.

BenchmarkEncodeFragments (testdata/1.m4s as 60 one-sample fragments, Apple M4 Pro, n=8):
- Encode: 11.4 µs -> 6.1 µs, 13 -> 0 allocations per fragment
- EncodeSW: 8.1 µs -> 6.7 µs, 3 -> 1 allocation per fragment (the remaining one is the benchmark's own writer)

TestFragmentEncodeMatchesEncodeSW checks that Encode and EncodeSW write the same bytes for every fragment of the fragmented test files, also with lazily decoded mdat. TestFragmentEncodeTopLevelBoxes covers emsg and prft before moof and 12 interleaved truns, more than the stack array holds. TestFragmentEncodeAllocations fails on master with 13 allocations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pull Request #613: perf(mp4): encode fragments without allocating

39 of 49 new or added lines in 1 file covered. (79.59%)

23025 of 27898 relevant lines covered (82.53%)

0.83 hits per line

Uncovered Changes

Lines Coverage ∆ File
10
84.84
-0.94% mp4/fragment.go
Jobs
ID Job ID Ran Files Coverage
1 37001471578.1 02 Oct 2026 11:31AM UTC 217
82.53
GitHub Action Run
Source Files on build 37001471578
  • Tree
  • List 217
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #613
  • PR Base - master (#37000739564)
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