Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion apps/desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,17 @@ async fn set_camera_input(
let camera_in_use = app.camera_in_use;
drop(app);

let skip_camera_window = skip_camera_window.unwrap_or(false);

if id == current_id && camera_in_use {
if !skip_camera_window && CapWindowId::Camera.get(&app_handle).is_none() {
let show_result = ShowCapWindow::Camera { centered: false }
.show(&app_handle)
.await;
show_result
.map_err(|err| error!("Failed to show camera preview window: {err}"))
.ok();
}
return Ok(());
}

Expand Down Expand Up @@ -717,7 +727,7 @@ async fn set_camera_input(
return Err(e);
}

if !skip_camera_window.unwrap_or(false) {
if !skip_camera_window {
let show_result = ShowCapWindow::Camera { centered: false }
.show(&app_handle)
.await;
Expand Down
6 changes: 6 additions & 0 deletions crates/enc-ffmpeg/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ impl EncoderBase {
}
}

if let (Some(pts), Some(dts)) = (self.packet.pts(), self.packet.dts())
&& pts < dts
{
self.packet.set_pts(Some(dts));
}
Comment on lines +88 to +92
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Second pts < dts guard is correct but worth a comment

The existing DTS monotonicity block (lines 76–86) already adjusts PTS when DTS is bumped. This new block catches the distinct case where the encoder emits a packet with pts < dts without any DTS ordering violation (i.e., the first block didn't fire). This is a real scenario with libx264 at certain configurations.

A short comment would help future readers understand why two separate guards exist:

// Secondary guard: encoder may emit pts < dts even when DTS is
// already monotonic (e.g. during stream init or B-frame drain).
if let (Some(pts), Some(dts)) = (self.packet.pts(), self.packet.dts())
    && pts < dts
{
    self.packet.set_pts(Some(dts));
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/enc-ffmpeg/src/base.rs
Line: 88-92

Comment:
**Second `pts < dts` guard is correct but worth a comment**

The existing DTS monotonicity block (lines 76–86) already adjusts PTS when DTS is bumped. This new block catches the distinct case where the encoder emits a packet with `pts < dts` without any DTS ordering violation (i.e., the first block didn't fire). This is a real scenario with libx264 at certain configurations.

A short comment would help future readers understand why two separate guards exist:

```rust
// Secondary guard: encoder may emit pts < dts even when DTS is
// already monotonic (e.g. during stream init or B-frame drain).
if let (Some(pts), Some(dts)) = (self.packet.pts(), self.packet.dts())
    && pts < dts
{
    self.packet.set_pts(Some(dts));
}
```

How can I resolve this? If you propose a fix, please make it concise.

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!


self.last_written_dts = self.packet.dts();
self.packet.write_interleaved(output)?;
}
Expand Down
3 changes: 2 additions & 1 deletion crates/enc-ffmpeg/src/video/h264.rs
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,9 @@ fn get_codec_and_options(
.map(|v| v.get())
.unwrap_or(4);
options.set("threads", &thread_count.to_string());
options.set("bf", "0");
options.set("rc-lookahead", "10");
options.set("b-adapt", "1");
options.set("b-adapt", "0");
options.set("aq-mode", "1");
options.set("ref", "2");
options.set("subme", "2");
Expand Down
Loading