Skip to content

feat(cmcd): CTA-5004 v1 spec completion - #1

Closed
bbetter173 wants to merge 7 commits into
xione-releasefrom
feat/cmcd-cta5004
Closed

feat(cmcd): CTA-5004 v1 spec completion#1
bbetter173 wants to merge 7 commits into
xione-releasefrom
feat/cmcd-cta5004

Conversation

@bbetter173

@bbetter173 bbetter173 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

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.

The XiOne armhf cross-compile build tooling that previously rode along on this branch has been split into its own PR so this change stays CMCD-only and independently reviewable.

Changes

New serializer (CMCDSerializer) — a dependency-free component 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 for sid/cid/nor/nrr
  • Bare boolean tokens for bs/su
  • Alphabetical key ordering within each group
  • Omission of unavailable keys
  • Same-group serialize calls merge and re-sort rather than overwrite

Full v1 key setCMCDHeaders extended 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) and cid (content id, with query/fragment stripped to avoid leaking auth tokens) at tune
  • st (live/VOD) after manifest parse
  • pr (playback rate) per request, level-triggered so it's correct on initial tune
  • mtp (measured throughput) from the ABR estimator
  • d (object duration) per media segment
  • su (startup-urgent) during tune/rebuffer

bs latch semanticsbs 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).

Tests

L1 GoogleTest coverage added under support/aampmetrics/test/tests/:

  • Serializer primitives — rounding, quoting, group key names, alphabetical ordering, same-group merge
  • End-to-end CTA-5004 rules — across every CMCDHeaders subclass, including omit-when-unavailable, nor/pr regression guards, and the bs latch 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.

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 bbetter173 changed the title Feat/cmcd cta5004 feat(cmcd): CTA-5004 v1 spec completion + XiOne armhf build tooling Jul 5, 2026
@bbetter173
bbetter173 force-pushed the feat/cmcd-cta5004 branch from 44c889b to 0db87ff Compare July 5, 2026 22:01
@bbetter173 bbetter173 changed the title feat(cmcd): CTA-5004 v1 spec completion + XiOne armhf build tooling feat(cmcd): CTA-5004 v1 spec completion Jul 5, 2026
@bbetter173

Copy link
Copy Markdown
Collaborator Author

Closed in favor of #3

@bbetter173 bbetter173 closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant