fix(recording): detect microphone starvation during voip calls - #2313
Open
ManthanNimodiya wants to merge 2 commits into
Open
ManthanNimodiya wants to merge 2 commits into
ManthanNimodiya wants to merge 2 commits into
Conversation
Track keepalive silence dominance and emit stalled health events when input frames are starved without intentional muting. Signed-off-by: ManthanNimodiya <manthannimodiya989898@gmail.com>
Comment on lines
+773
to
+781
| if high_silence_intervals >= 2 { | ||
| emit_health( | ||
| &health_tx, | ||
| PipelineHealthEvent::Stalled { | ||
| source: "microphone".to_string(), | ||
| waited_ms: (silence_delta as u64).saturating_mul( | ||
| SILENCE_CHUNK_DURATION.as_millis() as u64, | ||
| ), | ||
| }, |
Contributor
There was a problem hiding this comment.
During one continuous microphone starvation, high_silence_intervals remains at or above two, so this block emits another Stalled event every five seconds. It also calculates waited_ms from only the latest interval's silence_delta. Existing telemetry counts each event as a separate capture stall and records the interval-sized duration as the maximum, inflating the stall count while understating how long the microphone was starved. Track the start of the current stall and emit once per sustained stall, or report cumulative elapsed time like the other stall emitters.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/recording/src/sources/microphone.rs
Line: 773-781
Comment:
**Repeated stall events**
During one continuous microphone starvation, `high_silence_intervals` remains at or above two, so this block emits another `Stalled` event every five seconds. It also calculates `waited_ms` from only the latest interval's `silence_delta`. Existing telemetry counts each event as a separate capture stall and records the interval-sized duration as the maximum, inflating the stall count while understating how long the microphone was starved. Track the start of the current stall and emit once per sustained stall, or report cumulative elapsed time like the other stall emitters.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.…rvation Record stall start timestamp to compute cumulative elapsed time and prevent repeated stall health events during sustained starvation. Signed-off-by: ManthanNimodiya <manthannimodiya989898@gmail.com>
Contributor
Author
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.
What & Why
When VoIP calls pre-empt hardware microphone capture, synthetic keepalive silence indefinitely masked the stall and reported false recording success. This adds keepalive silence ratio tracking to detect hardware starvation while preserving intentional mute behavior and emits pipeline stall health events.
Changes
is_audio_starvedhelper to evaluate silence frame dominance (PipelineHealthEvent::Stalledwhen starvation persists.Checklist
The PR appears safe to merge; the previous repeated-event and understated-duration issue is fully addressed.
Findings
Fix with agent prompt
Summary
The PR detects microphone starvation when synthetic keepalive silence dominates unmuted capture and emits a single pipeline-stall event for each sustained starvation episode.
Reviews (2) · Last reviewed commit: "fix(recording): track cumulative stall d..."