Repository navigation
Conversation
audiomixer and liveadder drop input that misses its deadline and post a QoS message only when the input pad's qos-messages is set, which defaults to false. A mixer input could be dropped for a whole connection with nothing logged or shown (#1265). - Set qos-messages on every audio aggregator sink pad Strom creates (make_audiomixer: Audio Mixer, Live Audio Router; Audio Router; WHEP Input liveadder) through gst::aggregator_qos. - Read Qos::stats() as (processed, dropped). total_processed carried the dropped count. - Map a QoS message from a pad to its parent element and keep the pad name and the upstream element, so a drop names the block and input. - Aggregate per element and pad; drops per period are the growth of the cumulative dropped count, a decrease is a counter reset. - Health follows drops, not proportion (is_falling_behind was avg_proportion < 1.0, true when an element keeps up). Frontend health follows drops too, and reports expire after 15 s. - Log the first drop per input at once, then the sum at most every 10 s. - StromEvent::QoSStats gains optional pad_name, upstream_element, total_dropped, dropped_in_period, stats_format (serde defaults). 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
A
builtin.mixeraudiomixerdropped a late input for a whole connection, and nothing was logged or shown (#1265). There were four causes:audiomixerandliveadderpost a QoS message for a dropped input only when the input pad'sqos-messagesis set. It defaults to false, and Strom set it only on the WHEP Input liveadder pads.sink_1), not the element. The bus handler used the source name, so the report named no block (block_id: None, elementsink_1).bus.rsreadqos.stats()as(format, processed). gstreamer-rs 0.25 returns(processed, dropped), sototal_processedcarried the cumulative dropped count, and the real processed count was lost.is_falling_behind = avg_proportion < 1.0is true when an element keeps up, and anaudiomixerinput that drops everything reports a proportion of 1.0 (measured:proportion=(double)1on every drop message, see Evidence). The frontend used the same thresholds (Warning < 0.95, Critical < 0.8), and its state never expired.Change
gst::aggregator_qos::report_late_input_dropssetsqos-messages=trueon an aggregator's sink pads, now and in future (apad-addedhandler that captures nothing). It is called frommake_audiomixer(Audio Mixer: main, solo, monitor, aux and group buses; Live Audio Router), from the Audio Router'saudiomixers, and from both WHEP Inputliveadders. The per-pad set inwhep/input/stream.rsis gone because the helper now covers it. The property exists from GStreamer 1.20, below our 1.22 floor. Thefind_propertycheck only keeps another element class working.gst/pipeline/qos.rs(new, the QoS code moved out ofpipeline/mod.rs):parse_qosreads(processed, dropped)in that order. A pad source is mapped to its parent element, and the pad name is kept along with the element linked to that pad (e.g.mixer:to_main_queue_1, which shows it was channel 2). The unit issamples/framesforGST_FORMAT_DEFAULT, taken from the pad's caps, orbuffers/bytes.QoSAggregatoris keyed on (element, pad). The counts are cumulative per source, so drops in a period are the growth of the dropped count since the last period, and a decrease counts as a counter reset (flush, restart). A source that reports no dropped count counts one drop per message.dropped_in_period > 0, no longer the proportion.DropLogGatelogs the first drop per input at once (warn!, names the element, input pad, upstream element and unit), then the sum at most every 10 s, and forgets a source after 10 quiet seconds.StromEvent::QoSStats: no field renamed or removed. It gainspad_name,upstream_element,total_dropped,dropped_in_periodandstats_format, all with serde defaults, so old payloads still parse (unit test).openapi.jsonis updated on purpose.qos_monitor.rs: health followsdropped_in_period(Warning) and ≥ 10 QoS messages in a period (Critical, a continuous drop). Reports expire after 15 s, likebuffer_age.rs. Entries are keyed per (node, element, pad). A node shows the worst of its inputs. The tooltip and log line name the input and the drop count, not a proportion percentage.Behaviour changes, on purpose:
total_processednow carries the processed count. Before, it carried the dropped count.is_falling_behindflips meaning: it is now true when the element dropped data in the period. Before, it was true when the proportion was below 1.0. Consumers that read these fields (Open Live) will see different values.Rejected:
qos-messagesat eachrequest_pad_simplecall site. Mostaudiomixerpads in the mixer block are requested by the generic linker (ElementPadRef::element), and thepad-addedhandler covers every call site, including future ones.Evidence
audiomixerinput pad posts QoS only withqos-messages, the pad is the source, and the proportion stays 1.0 while it drops. Measured with gst-launch 1.28.6 on macOS:audiomixer sink_1::qos-messages=true ... audiotestsrc is-live=true ! identity sleep-time=40000 ! mix.givesGot message from pad "mix:sink_1" (qos): ... proportion=(double)1 ... format=(GstFormat)default, processed=(guint64)3200, dropped=(guint64)1920.mixer_late_input_qos_test::a_late_mixer_input_is_reported_with_its_block_and_padbuilds a flow throughPipelineManagerwith the realbuiltin.mixerblock. Input 1 is a live tone. Input 2 is a live tone behindidentity sleep-time=40000. The test asserts aQoSStatswithblock_id=mixer,element_name=mixer:audiomixer, a pad name,upstream_element=mixer:to_main_queue_1,total_dropped > 0andis_falling_behind. Revert checks, each run locally:report_late_input_dropsinmake_audiomixer:no QoS drop reported for an input pad of the mixer block's audiomixer; QoS reports: []QoS reports: [(None, "sink_3", None, None, Some(20480), 20480, true), (None, "sink_1", ...), ...]. There is no block, only bare pad names.avg_proportion < 1.0): every report hasis_falling_behind=false, e.g.(Some("mixer"), "mixer:audiomixer", Some("sink_1"), Some("mixer:to_main_queue_1"), Some(19721), 19721, false)gst::pipeline::qos::tests::a_pad_qos_message_is_read_as_its_element_and_pad. With the old(dropped, processed)read it fails withleft: Some(1920) right: Some(3200).gst::pipeline::qos::tests. The log gate (first drop at once, then at most once per 10 s, flush, forget) is covered there too. Frontend health and TTL are covered inqos_monitor::tests. Old-payload parsing is covered inevents::event_accessor_tests::qos_stats_without_the_drop_fields_still_parses.gst::aggregator_qos::tests::requested_audiomixer_pads_post_qos_messageschecks that pads that already exist and pads requested later are both covered.Tests
Ran on macOS (arm64), GStreamer 1.28.6:
cargo fmt --all,cargo clippy --workspace --all-targets -- -D warnings,cargo clippy --all-targets --features efp -- -D warnings: clean. The pre-commit hook also ran wasm32 clippy: clean.cargo test --workspace --lib: 1344 + 106 + 215 passed.cargo test --test it -- openapi_test mixer_late_input_qos liveaudiorouter latency_diagnosis latency_redistribute: 45 passed.cargo test --test it -- drop_on_latency audioprocessor: passed.cargo test --test gst_floor_smoke_test: 5 passed. It runs the Audio Mixer block on the local 1.28, not on 1.22.Failed locally, same on main:
whep_input_video_test(3 tests), withICE failedfrom whepsrc on this Mac. I restored main's WHEP files and reran: same 3 failures. Not caused by this change.Not run: the full
--test itsuite, and Linux or Windows locally. CI covers those.The new test needs only
audiotestsrc,identity,audiomixerandfakesink(core and base), which are in every CI image. It asserts withcommon::require_elementsand does not skip.Lesson
Added to
docs/BLOCK_GUIDELINES.mdunder "Reported Latency": a mixer reports the late data it drops. Every audio aggregator a block creates goes throughgst::aggregator_qos::report_late_input_drops, and the new integration test guards the Audio Mixer.For the reviewer
QoSStatsWebSocket contract:total_processedandis_falling_behindchange meaning (see Change). Field names and types are unchanged, and new fields are additive with defaults.Out of scope
input_2) instead of the internal upstream element (mixer:to_main_queue_1). That needs per-block knowledge of the internal chains.🤖 Generated with Claude Code