Skip to content

moq-gst: fix plugin license + broadcast-aligned timestamps#1808

Merged
kixelated merged 2 commits into
mainfrom
claude/moqsink-license-pts-fix
Jun 19, 2026
Merged

moq-gst: fix plugin license + broadcast-aligned timestamps#1808
kixelated merged 2 commits into
mainfrom
claude/moqsink-license-pts-fix

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Summary

Two small, independent moqsink fixes cherry-picked from the larger rewrite in #1771, without the FLUSH/seek handling or the per-pad/session generation machinery from that PR.

1. Plugin license so the plugin actually loads

GStreamer's registry only loads plugins whose license string is in its recognised set. The plugin_define! license was "Apache 2.0", which is not in that set, so the moq plugin (moqsink/moqsrc) is silently refused at registry load. The crate is MIT OR Apache-2.0, so this declares the MIT side ("MIT/X11"), which is valid.

This commit is self-contained and can be cherry-picked on its own if you want it in faster.

2. Broadcast-aligned timestamps instead of per-pad PTS rebasing

The sink rebased each pad to its own first PTS (reference_pts), zeroing every pad's timeline independently. That breaks A/V alignment: audio and video both start at ~0 regardless of their real offset.

Now the sink forwards the SEGMENT event to the worker and maps each buffer's PTS to GStreamer running time, the broadcast-aligned timeline shared by every pad in the pipeline. It falls back to the raw PTS only when no TIME segment is known (e.g. a BYTES segment).

What this deliberately leaves out (vs #1771)

  • FLUSH/seek handling (per-pad watch channels, send_or_flush, re-anchoring). moqsink is a live-publish sink; the flush path adds significant concurrency surface for a case it doesn't exercise.
  • Two-level pad/session generation tracking and generation-keyed failure maps.
  • The module split and the bounded-channel / error-to-bus changes (separable follow-ups).

Testing

  • cargo build -p moq-gst, cargo clippy -p moq-gst --all-targets -- -D warnings, cargo fmt --check, cargo test -p moq-gst all pass (via the nix dev shell).

(Written by Claude)

kixelated and others added 2 commits June 19, 2026 12:26
GStreamer's registry only loads plugins whose license string is in its
recognised set. "Apache 2.0" is not in that set, so the moq plugin
(moqsink/moqsrc) was silently refused at registry load. The crate is
MIT OR Apache-2.0, so declare the MIT side ("MIT/X11"), which is valid.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ebase

The sink rebased each pad to its own first PTS, zeroing every pad's
timeline independently. That destroys A/V alignment: audio and video
both start at ~0 regardless of their real offset in the pipeline.

Forward the SEGMENT event to the worker and map each buffer's PTS to
GStreamer running time, which is the broadcast-aligned timeline shared by
every pad. Fall back to the raw PTS only when no TIME segment is known.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 19be7b51-ed9c-47a8-b695-4caa4acb2f13

📥 Commits

Reviewing files that changed from the base of the PR and between 230e34d and a7229e5.

📒 Files selected for processing (2)
  • rs/moq-gst/src/lib.rs
  • rs/moq-gst/src/sink/imp.rs

Walkthrough

The MoqSink GStreamer plugin gains TIME-segment-aware timestamp mapping. PadState replaces its reference_pts field with an optional gst::FormattedSegment<gst::ClockTime>. A new ControlMessage::Segment variant is added to carry per-pad segment events from the GStreamer thread to the async session worker. handle_event intercepts EventView::Segment events, forwards them via the control channel, then calls the default pad handler. The session worker dispatches the message to handle_segment, which stores the segment only when it is in TIME format. handle_buffer now maps buffer PTS through the stored segment's running-time conversion, falling back to raw PTS if no segment is recorded. Separately, the plugin's license string is corrected from "Apache 2.0" to "MIT/X11" so GStreamer recognizes and loads the plugin.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the two main changes: fixing the plugin license issue and implementing broadcast-aligned timestamps for proper A/V synchronization.
Description check ✅ Passed The description clearly explains both fixes, the rationale behind each change, and deliberately documents what was excluded from the larger PR #1771.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/moqsink-license-pts-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kixelated kixelated merged commit 678a250 into main Jun 19, 2026
1 check passed
@kixelated kixelated deleted the claude/moqsink-license-pts-fix branch June 19, 2026 21:13
@moq-bot moq-bot Bot mentioned this pull request Jun 19, 2026
kixelated added a commit that referenced this pull request Jun 22, 2026
Resolutions:
- sink/imp.rs: kept the GstAggregator rewrite. main's #1808 (broadcast-aligned
  timestamps) targeted the old sink and is superseded by the shared running-time
  timeline this rewrite already uses.
- rs/justfile: took main's cargo-based CI. Its `cargo nextest run --workspace`
  covers moq-gst, so ArielM's separate `test-moq-gst` recipe is redundant.
- lib.rs: kept main's plugin-license comment wording (code identical).

Adopts main's edition 2024 bump for moq-gst (reformatted accordingly).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@moq-bot moq-bot Bot mentioned this pull request Jun 23, 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