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

Eyevinn / mp4ff / 37443141564
83%

Build:
DEFAULT BRANCH: master
Ran 06 Oct 2026 09:28AM 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

06 Oct 2026 09:27AM UTC coverage: 82.685% (+0.03%) from 82.653%
37443141564

push

github

tobbee
feat(mp4): add Fragment.Reset to build fragment after fragment without allocating

CreateFragment makes 16 allocations: eight boxes and the child lists of the fragment, moof and traf. A caller that builds one fragment per chunk, such as a live packager, pays them for every chunk, together with the trun sample list and the mdat data-part list. Encrypting a fragment adds senc, saiz and saio boxes and the arrays for their IVs and subsample patterns, and copying sample data with AddFullSample regrows the payload for every fragment.

Reset puts a single-track fragment back in the state CreateFragment returns, with a new sequence number and the same EncOptimize setting. It keeps the boxes and the storage of the trun samples and the data-part list, and drops everything added since: samples, emsg and prft boxes, and the senc, saiz and saio boxes from encryption. It clears the data parts, so that the sample buffers they referenced can be collected. It refuses any fragment that is not single-track, and leaves it unchanged.

Reset also keeps what was allocated for the content of the previous fragment:
- the senc, saiz and saio boxes, with the arrays their IVs and subsample patterns were stored in, which FragmentEncryptor takes back instead of making new ones;
- the payload, if AddSampleData allocated it. MdatBox records whether it owns Data, so a buffer given to SetData or the input of a decoded fragment is still dropped rather than written into.

AddSampleDataPart now reuses a data-part list with spare capacity instead of only a non-empty one, and the mdat decoders use keyed struct literals.

In BenchmarkBuildAndEncodeFragment, building and encoding 96 samples with Reset takes 1 allocation, against 19 with AddFullSamples into a new fragment, and copying them with AddFullSample after Reset takes 26 us and 140 bytes instead of 230 us and 3.5 MB. Building, cbcs-encrypting and encoding one-sample fragments with Reset makes no allocations (7 before), and cenc makes ... (continued)

73 of 75 new or added lines in 3 files covered. (97.33%)

23390 of 28288 relevant lines covered (82.69%)

0.83 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
86.29
1.12% mp4/fragment.go
Jobs
ID Job ID Ran Files Coverage
1 37443141564.1 06 Oct 2026 09:28AM UTC 217
82.69
GitHub Action Run
Source Files on build 37443141564
  • Tree
  • List 217
  • Changed 4
  • Source Changed 0
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • cbcfb13b on github
  • Prev Build on master (#37211701157)
  • Next Build on master (#37462882771)
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