feat(cmcd): CTA-5004 v1 spec completion - #1
Closed
bbetter173 wants to merge 7 commits into
Closed
Conversation
Add a dependency-free CMCDSerializer that converts structured CMCDEntry records into conformant CTA-5004 §3 header values: nearest-100 rounding for integer keys (br/tb/bl/dl/mtp/rtp), quoted-string encoding (sid/cid/nor/nrr), bare boolean tokens (bs/su), alphabetical key ordering within each group, and omission of unavailable keys. Same-group serialize calls merge and re-sort rather than overwrite. Extend CMCDHeaders with the remaining v1 session/object/request keys (sf, st, cid, pr, d, mtp, su). Header assembly is a template method on the base class: subclasses customise only the object type token (ot) and whether segment metrics are reported, so the per-media-type classes are header-only and the segment-metric entry building is shared rather than duplicated. bs is latched rather than level-triggered: a starvation seen since the prior request is sticky and is reported once on the resumption request, then cleared (CTA-5004 §3: bs marks the buffer being starved at some point since the prior request).
Add collector setters for the session and per-request keys (sf/cid/st/pr, d/mtp/su) and source them from the engine: session format and content id at tune (query/fragment stripped from cid to avoid leaking auth tokens), live/VOD status after manifest parse, playback rate per request (level-triggered so pr is correct on the initial tune), measured throughput from the ABR estimator, object duration per media segment, and the startup-urgent flag during tune/rebuffer.
Add GoogleTest L1 coverage for the serializer primitives (rounding, quoting, group key names, alphabetical ordering, same-group merge) and for the end-to-end CTA-5004 serialization rules across every CMCDHeaders subclass, including omit-when-unavailable, the nor/pr regression guards, and the bs latch behaviour (latched across a non-starving sample, then consumed on report). Repoint the per-media-type test targets at the real CMCDHeaders base and serializer (the subclasses are header-only now), drop the no-op subclass fakes, consolidate the remaining base fake, and raise the metrics test harness to C++17 to match the production library and GoogleTest >= 1.13.
bbetter173
force-pushed
the
feat/cmcd-cta5004
branch
from
July 5, 2026 22:01
44c889b to
0db87ff
Compare
Collaborator
Author
|
Closed in favor of #3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CMCD CTA-5004 (v1) spec completion — brings AAMP's Common Media Client Data output into full compliance with CTA-5004 §3, completing the standard key set and correcting serialization so the CMCD attached to segment/manifest requests is a complete, correctly-serialized v1 payload that any spec-compliant CDN or analytics collector can parse.
Changes
New serializer (
CMCDSerializer) — a dependency-free component that converts structuredCMCDEntryrecords into conformant CTA-5004 §3 header values:br/tb/bl/dl/mtp/rtp)sid/cid/nor/nrrbs/suFull v1 key set —
CMCDHeadersextended with the remaining v1 session/object/request keys (sf,st,cid,pr,d,mtp,su), with every per-media-type builder (Video/Audio/Manifest/Subtitle) routed through the shared serializer so output is spec-conformant across all groups.Engine wiring — new keys sourced from the playback path:
sf(session format) andcid(content id, with query/fragment stripped to avoid leaking auth tokens) at tunest(live/VOD) after manifest parsepr(playback rate) per request, level-triggered so it's correct on initial tunemtp(measured throughput) from the ABR estimatord(object duration) per media segmentsu(startup-urgent) during tune/rebufferbslatch semantics —bsis latched rather than level-triggered: a starvation seen since the prior request is sticky and is reported once on the resumption request, then cleared (CTA-5004 §3:bsmarks the buffer being starved at some point since the prior request).Tests
L1 GoogleTest coverage added under
support/aampmetrics/test/tests/:CMCDHeaderssubclass, including omit-when-unavailable,nor/prregression guards, and thebslatch behaviour (latched across a non-starving sample, then consumed on report)Compatibility
The existing CMCD enable/disable config path and per-media-type collector wiring are preserved. Deployed-device behavior changes only where spec compliance requires it (rounding/quoting/sorting/header-name fixes). Transport remains custom HTTP request headers only.