diff --git a/src/state_portal.rs b/src/state_portal.rs index 47f80c8..e895ef6 100644 --- a/src/state_portal.rs +++ b/src/state_portal.rs @@ -464,7 +464,7 @@ impl StatePortal { // damage-driven variable fps — issue #24). MP4: keep sequential counter; // file output doesn't need real-time PTS and changing it would alter // playback speed during static periods. - let pts = if self.webrtc.is_some() { + let pts = if self.webrtc_thread.is_some() { self.compute_capture_pts(frame.pts) } else { self.frames_encoded as i64 @@ -579,7 +579,8 @@ impl StatePortal { 0 }; let ticks_i128 = (relative_ns.saturating_mul(i128::from(self.args.fps))) / NS_PER_SEC; - let mut pts = i64::try_from(ticks_i128).unwrap_or(i64::MAX); + let computed_pts = i64::try_from(ticks_i128).unwrap_or(i64::MAX); + let mut pts = computed_pts; if let Some(last) = self.last_pts_emitted { if pts <= last {