Repository navigation
Conversation
A live video aggregator drops an input buffer that ends before its next output frame with only a debug line, so an input that reaches the vision mixer later than its latency window vanished from program without a signal. The block now counts those drops per dist-mixer input (video and DSK pads) and posts a standard QoS message with the mixer sink pad as source, cumulative processed/dropped in Buffers, at most once a second per input and only when the dropped total grew. Detection: BUFFER probes on the mixer sink pads compare each buffer's end running time with the end of the mixer's last output frame, the same comparison as GstVideoAggregatorPad's skip_buffer. Atomics only; the segments come from event probes, the output position from a probe on the mixer src pad. The message is built on the overlay timer thread. Refs #1265 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Refs #1265
Problem
The vision mixer drops late input frames without a signal. In live mode a
GstVideoAggregator(compositoron the CPU path,glvideomixerelementon the GPU path) drops every queued input buffer that ends before its next output frame. It does this ingst_video_aggregator_pad_skip_buffer, called fromgst_aggregator_pad_skip_buffers, and logs only a debug line. Its own QoS message covers only late output. So an input that reaches the mixer later than its latency window disappears from program, and nothing on the bus says so. #1265 is the same class of problem for audio.Change
The block counts late drops per input and posts a standard GStreamer QoS message for each input that dropped frames. The message source is the mixer's sink pad, so the drops go through the same QoS path as any element's.
vision_mixer/late_input.rs): a BUFFER probe on each dist-mixer input pad (video inputssink_0..N, then DSK inputs) converts the buffer's end to running time. It compares that with the end of the last frame the mixer pushed. This is the same comparisonskip_buffermakes, and the output position only grows, so a buffer that is behind it on arrival is always dropped. The count can only be low, never high: a buffer that turns late while it waits in the queue is missed. Nothing the mixer shows is counted.live=true, the running time of the last late buffer, jitter equal to how late it was, and stats inBuffersformat.processedanddroppedare cumulative totals since the last flush, as in GStreamer's own QoS, as agreed with the consumer side. At most one message per second per input, and only when the dropped total went up.The QoS consumption fix is a separate PR. That PR parses
Qos::stats(), maps a QoS message whose source is a pad to its parent element while keeping the pad name, and bases health on drops. Until it lands, the currentbus.rskeys these messages by the pad name (sink_1).Alternatives I rejected:
GstAggregatorPad::buffer-consumed: it fires for used and dropped buffers alike, and costs a signal emission per buffer.docs/UPSTREAM_NOTES.md.Evidence
vision_mixer_late_input_qos_test::late_input_posts_qos_for_its_mixer_pad_only_{cpu,gpu}. It builds the real block with two live 30 fps inputs and stamps input 1 one second in the past. It asserts a QoS message from<block>:mixer.sink_1with dropped > 0,processed >= dropped, and no QoS message fromsink_0over the following 3 s.post_messagereplaced by dropping the message, both variants fail:Tests
Ran on macOS (arm64) with GStreamer 1.28.6:
cargo test --test it vision_mixer_late_input_qos: 2 passed. The GPU variant also passed withSTROM_REQUIRE_GL=1, so it did not skip.cargo test --lib vision_mixer: 39 passed.cargo test --test it pipeline_lifecycle: 4 passed.cargo test --test it vision_mixer: 43 passed, 1 failed. The failure isfailed_start_teardown_test::vision_mixer_overlay::failed_start_leaves_no_overlay_timer. It is not caused by this PR: it also fails with-- --skip late_input, and passes on its own. It counts the process-wideoverlay_timers_running(), so any other vision mixer test running in parallel can break it. That is a test-isolation issue that exists without this change.cargo fmt --all,cargo clippy --all-targets -- -D warnings,cargo clippy --all-targets --features efp -- -D warnings: clean.Skipped or not run:
STROM_REQUIRE_GL=1) and is serialized with the other GL tests. I have not seen it run there.Lesson
None for CLAUDE.md. Two upstream entries were added to
docs/UPSTREAM_NOTES.md:gst_video_aggregator_fill_queues(start_running_time != -1assertion) when a live input has a negative pad offset. It was measured once, on 1.28.6, while writing the test, and its cause is a guess. Because of it, the test shifts timestamps with a probe instead.A note for test writers: a flow's thread-priority setup owns the bus sync handler, so a test that replaces it with
set_sync_handlersees nothing. The test usesenable_sync_message_emissionandconnect_sync_messageinstead.For the reviewer
overlay.rsis over 1500 lines (1852 before this PR). I kept my change there to a field and a hook in the timer loop, and put the logic inlate_input.rs. Splittingoverlay.rsshould be its own PR.Out of scope
mv_comp) inputs: they carry the same frames as the dist mixer inputs, so counting them would count each late frame twice and say nothing about program.queue_pgm_mv(leaky=upstream, max-size-buffers=1, CPU path): it drops by design whenever the multiview takes PGM slower than PGM is produced, for example a multiview framerate below the PGM framerate. These drops are not lost program frames, and reporting them would be noise.appsrc(leaky, max-buffers=2): it carries the overlay graphic, which is re-rendered and pushed again. It is not media from an input.failed_start_leaves_no_overlay_timer(see Tests): it needs its own fix.🤖 Generated with Claude Code