@@ -32,17 +32,19 @@
|
||||
- **Fix**: Use `try_send` and drop frames on full, or use an unbounded channel with a backpressure counter.
|
||||
- **Fixed in**: [`a09a423`](commit:a09a423) — Replaced `send()` with `try_send()` + `AtomicU64` drop counter. PipeWire `.process` callback is now guaranteed non-blocking. Dropped frames are counted and logged every 30 occurrences.
|
||||
|
||||
### #3: Portal PTS uses raw PipeWire timestamp as encoder frame-number timebase
|
||||
### ~~#3: Portal PTS uses raw PipeWire timestamp as encoder frame-number timebase~~ ✅ Fixed
|
||||
|
||||
- **Location**: `src/state_portal.rs:177`, `src/cap_portal.rs:279`
|
||||
- **Description**: PipeWire PTS (from `spa_meta_header.pts`) is not guaranteed to be in frame-count units — it may be nanoseconds or an invalid sentinel. It is assigned directly to `AVFrame.pts` while the encoder time_base is `1/fps`.
|
||||
- **Fix**: Normalize timestamps at the Portal boundary: store the first valid PipeWire PTS, convert elapsed time to encoder ticks with `elapsed_ns * fps / 1_000_000_000`, and synthesize monotonic frame numbers when PTS is invalid.
|
||||
- **Description**: PipeWire PTS (from `spa_meta_header.pts`) is in nanoseconds (CLOCK_MONOTONIC), not frame-count units. It was assigned directly to `AVFrame.pts` while the encoder time_base is `1/fps`, causing the muxer to interpret timestamps as billions of frames and producing corrupted duration metadata.
|
||||
- **Fix**: Record the first frame's PipeWire PTS as a nanosecond base, compute elapsed nanoseconds for each subsequent frame, then convert to frame numbers via `elapsed_ns * fps / 1_000_000_000`. Using elapsed time avoids i64 overflow on absolute timestamps. Invalid/negative PTS values are clamped to 0.
|
||||
- **Fixed in**: [`ffb36b7`](commit:ffb36b7) — Added `first_pts_ns: Option<i64>` to `StatePortal`. PTS conversion matches WLR path pattern (`state.rs:525-527`).
|
||||
|
||||
### #4: AVDRMFrameDescriptor leaks if Portal encode fails
|
||||
### ~~#4: AVDRMFrameDescriptor leaks if Portal encode fails~~ ✅ Fixed
|
||||
|
||||
- **Location**: `src/state_portal.rs:183`
|
||||
- **Description**: The descriptor is allocated with `Box::into_raw` at line 120 and manually recovered at lines 187-191. But `enc.encode_frame(&hw_frame)?` returns early on error before recovery. This leaks the boxed `AVDRMFrameDescriptor`.
|
||||
- **Fix**: Wrap the descriptor pointer in a small RAII guard that reclaims the box on every return path, or recover the box before propagating the encode error.
|
||||
- **Fixed in**: [`2d448dc`](commit:2d448dc) — Moved `Box::from_raw` descriptor recovery from after `encode_frame` to before it. Since `av_hwframe_transfer_data` has already imported the DMA-BUF into the VAAPI surface by that point, the descriptor struct is safe to reclaim. Now `encode_frame`'s `?` early-return can no longer leak the descriptor.
|
||||
|
||||
### #5: Portal can initialize encoder with zero or unknown format
|
||||
|
||||
|
||||
Reference in New Issue
Block a user