Repository navigation
Conversation
Detect speech on each clip's mic and generate Hide Camera scene segments for the long silences. The segments are ordinary scenes, so they show on the Scene track, follow cuts, and export without any renderer changes.
|
Someone is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
|
@greptile-apps review |
| let edited = self.edit_timeline_project( | ||
| |project| { | ||
| project.camera_silence_delay = Some(delay); | ||
| true | ||
| }, |
There was a problem hiding this comment.
Delay changes fail after reopening
After reopening a project with “Hide When Silent” enabled, clip_speech starts as None. Moving the delay slider takes this branch, which saves the new delay without rebuilding the generated scenes. The slider shows the new value, but preview and export still hide the camera at the old times. Run speech analysis when the cache is missing, then regenerate with the requested delay.
Knowledge Base Used: GPUI desktop client
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_window/silence.rs
Line: 91-95
Comment:
**Delay changes fail after reopening**
After reopening a project with “Hide When Silent” enabled, `clip_speech` starts as `None`. Moving the delay slider takes this branch, which saves the new delay without rebuilding the generated scenes. The slider shows the new value, but preview and export still hide the camera at the old times. Run speech analysis when the cache is missing, then regenerate with the requested delay.
**Knowledge Base Used:** [GPUI desktop client](https://app.greptile.com/-/switch-tenant?tenant=cap&next=%2Fcustom-context%2Fknowledge-base%2Fcapsoftware%2Fcap%2F-%2Fdocs%2Fgpui-desktop-client.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed: with no cached speech, moving the delay now runs the analysis and regenerates with the latest delay when it lands. If every mic is unreadable it keeps the existing scenes instead of wiping them.
| for window in timeline.clip_source_windows() { | ||
| if !(window.timescale.is_finite() && window.timescale > 0.0) { | ||
| continue; | ||
| } | ||
| let clip = speech | ||
| .get(window.recording_clip as usize) | ||
| .and_then(Option::as_ref); |
There was a problem hiding this comment.
Cross-fade speech stays hidden
timeline_speech checks only the incoming clip during a transition because clip_source_windows drops the outgoing clip’s overlapping tail. The audio renderer still plays both microphones during a cross-fade. If speech starts in that outgoing tail after a long silence and the incoming clip is silent, the generated scene keeps the camera hidden while the outgoing speaker is audible. Include speech from both sides of the transition.
Knowledge Base Used: Export and editor rendering
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/rendering/src/silence_scenes.rs
Line: 80-86
Comment:
**Cross-fade speech stays hidden**
`timeline_speech` checks only the incoming clip during a transition because `clip_source_windows` drops the outgoing clip’s overlapping tail. The audio renderer still plays both microphones during a cross-fade. If speech starts in that outgoing tail after a long silence and the incoming clip is silent, the generated scene keeps the camera hidden while the outgoing speaker is audible. Include speech from both sides of the transition.
**Knowledge Base Used:** [Export and editor rendering](https://app.greptile.com/-/switch-tenant?tenant=cap&next=%2Fcustom-context%2Fknowledge-base%2Fcapsoftware%2Fcap%2F-%2Fdocs%2Fexport-and-editor-rendering.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed: clip_source_windows now keeps each clip's full played range, so clips overlap during a transition and speech from either side counts. Added a test for the outgoing tail.
| this.update_in(cx, |this, window, cx| { | ||
| this.analyzing_speech = false; | ||
| let speech = Arc::new(speech); | ||
| this.clip_speech = Some(Arc::clone(&speech)); | ||
| this.enable_camera_silence(&speech, window, cx); |
There was a problem hiding this comment.
The background result always calls enable_camera_silence, even if the user cleared the Scene track while analysis was running. Clearing that track sets camera_silence_delay to None, but this callback turns it back on and adds generated scenes again. Let clearing the track cancel the pending enable request, and check that request before applying the result.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_window/silence.rs
Line: 51-55
Comment:
**Cleared scenes come back**
The background result always calls `enable_camera_silence`, even if the user cleared the Scene track while analysis was running. Clearing that track sets `camera_silence_delay` to `None`, but this callback turns it back on and adds generated scenes again. Let clearing the track cancel the pending enable request, and check that request before applying the result.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed: the result now acts on a speech_request that clearing the Scene track resets. Toggling off while analysis runs cancels it the same way.
Analyze speech when the delay moves on a reopened project, let clearing the Scene track cancel a pending result, and count speech from both clips during a transition.
|
@greptile-apps review |
| Some(SpeechRequest::Regenerate) if speech.iter().any(Option::is_some) => { | ||
| if let Some(delay) = this.project.camera_silence_delay { | ||
| this.write_camera_silence(delay, &speech, window, cx); |
There was a problem hiding this comment.
Undo leaves mismatched settings
After reopening an enabled project, changing the delay saves one history entry before analysis finishes. If analysis finishes after the slider is released, this callback saves the rebuilt scenes as another entry. Undo then restores the old scenes but leaves the new delay displayed. Keep the delay and its rebuilt scenes in one undoable change.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_window/silence.rs
Line: 81-83
Comment:
**Undo leaves mismatched settings**
After reopening an enabled project, changing the delay saves one history entry before analysis finishes. If analysis finishes after the slider is released, this callback saves the rebuilt scenes as another entry. Undo then restores the old scenes but leaves the new delay displayed. Keep the delay and its rebuilt scenes in one undoable change.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed: with no speech data the delay now waits in the pending request and the slider shows it, so the delay and rebuilt scenes land as one undoable edit.
| this.clip_speech = Some(Arc::clone(&speech)); | ||
| match this.speech_request.take() { | ||
| Some(SpeechRequest::Enable) => this.enable_camera_silence(&speech, window, cx), | ||
| // Unreadable mics count as speech, which would wipe the | ||
| // scenes the delay was only meant to adjust. | ||
| Some(SpeechRequest::Regenerate) if speech.iter().any(Option::is_some) => { |
There was a problem hiding this comment.
If every mic is unreadable, this callback keeps existing scenes but still caches the all-None result. The next slider adjustment uses that cache without the readability check. regenerate_silence_scenes then removes every generated scene and adds none. Apply the same check to cached results so another slider adjustment cannot erase the scenes that the callback preserved.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_window/silence.rs
Line: 76-81
Comment:
**Saved camera scenes disappear**
If every mic is unreadable, this callback keeps existing scenes but still caches the all-`None` result. The next slider adjustment uses that cache without the readability check. `regenerate_silence_scenes` then removes every generated scene and adds none. Apply the same check to cached results so another slider adjustment cannot erase the scenes that the callback preserved.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed: cached_clip_speech ignores an all-unreadable result, so the slider re-analyzes and the guard still keeps the existing scenes.
Hold the delay until speech is ready so undo restores both together, and stop treating an all-unreadable analysis as a usable cache.
|
@greptile-apps review |
| Some(SpeechRequest::Delay(delay)) | ||
| if this.project.camera_silence_delay.is_some() | ||
| && speech.iter().any(Option::is_some) => | ||
| { | ||
| this.write_camera_silence(delay, &speech, window, cx); |
There was a problem hiding this comment.
Undo leaves delayed changes active
After reopening an enabled project, changing the delay leaves the requested value outside project history until speech analysis finishes. Pressing Undo while waiting restores the project but leaves speech_request alive. This callback then applies the pending delay and records a fresh edit, discarding the redo history.
Cancel the pending delay when Undo or Redo restores project state.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_window/silence.rs
Line: 91-95
Comment:
**Undo leaves delayed changes active**
After reopening an enabled project, changing the delay leaves the requested value outside project history until speech analysis finishes. Pressing Undo while waiting restores the project but leaves `speech_request` alive. This callback then applies the pending delay and records a fresh edit, discarding the redo history.
Cancel the pending delay when Undo or Redo restores project state.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed: apply_history, used by both Undo and Redo, now clears the pending speech request.
|
@greptile-apps review |
| //! "Hide when silent": the camera steps aside while nobody is talking. | ||
| //! | ||
| //! Speech detection runs once per opened project and lands as ordinary | ||
| //! `HideCamera` scene segments, so the result shows on the Scene track and can | ||
| //! be trimmed or deleted like any other scene. |
There was a problem hiding this comment.
Opening comment repeats the feature
The opening comment in silence.rs only describes the feature and the code below it. AGENTS.md prohibits comments that narrate code or describe the change being made. Remove it, or replace it with non-obvious context a future maintainer needs. This repository requirement must be satisfied before merging.
| //! "Hide when silent": the camera steps aside while nobody is talking. | |
| //! | |
| //! Speech detection runs once per opened project and lands as ordinary | |
| //! `HideCamera` scene segments, so the result shows on the Scene track and can | |
| //! be trimmed or deleted like any other scene. |
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_window/silence.rs
Line: 1-5
Comment:
**Opening comment repeats the feature**
The opening comment in `silence.rs` only describes the feature and the code below it. `AGENTS.md` prohibits comments that narrate code or describe the change being made. Remove it, or replace it with non-obvious context a future maintainer needs. This repository requirement must be satisfied before merging.
```suggestion
```
**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
@greptile-apps review |
Hyprland 0.57 only reads hyprland.lua, so the harness ran on defaults at 1024x768. Compare screenshots with the monitor's real size. Newer runner kernels ship videodev in the base modules, with no extra package to install.
|
@greptile-apps review |
1 similar comment
|
@greptile-apps review |
|
@greptile-apps review |
d095d05 to
be8bb29
Compare
Adds "Hide When Silent" to the Camera tab: the camera fades away when you stop talking and comes back just before you speak again.
How it works
cap_audio::detect_speech_in_fileruns RNNoise's voice probability over each clip's mic, with a -55 dBFS floor. It runs in the background once per opened project, and a slider drag reuses the result.HideCamerascene segments taggedfromSilence. They are normal scenes, so they appear on the Scene track, can be trimmed or deleted, and follow ripple cuts. The renderer and export need no changes.TimelineConfiguration::clip_source_windowsmaps speech through cuts, clip speed, transitions, fullscreen text holds, and mic offsets including timing repairs.The toggle only shows for recordings with a microphone. If nothing qualifies, it shows a notice and stays off. Removing the Scene track also turns the setting off, and presets leave it alone because it belongs to the timeline.
Why segments, not a render-time rule
Cap's other automation, like auto zoom and auto 3D shots, writes editable segments. Doing the same here means no per-frame merge in the renderer, no analysis step before export, and every hidden range is visible and fixable on the timeline. The trade-off is that adding or replacing footage later doesn't regenerate the segments. Toggling off and on, or moving the slider, refreshes them.
Testing
cargo test -p cap-audio -p cap-project -p cap-rendering --libfiltered to silence and speech: all pass, covering windowing, cut and speed mapping, offsets, manual scene margins, fade timing throughInterpolatedScene, regenerate behavior, and unreadable mics.cargo test --bin cap-gpui editor_passes inapps/desktop-gpui(482 tests), including the i18n surface tests for the new strings.cargo check --workspace --all-targetspasses.Not tested by hand in the running app.


Confidence Score: 5/5
The PR appears safe to merge; all previous findings are addressed and no new actionable issue was found.Summary
Adds “Hide When Silent” to the Camera tab.
All seven previous findings are addressed. No new actionable issues were found in the changes since the previous review. Checks were limited to source review; no tests or app sessions were run.
Reviews (8) · Last reviewed commit: "fix: allow busy Wayland compositors to e..." · Reviewed by Greptile