local video example enhancements#1067
Open
chenosaurus wants to merge 15 commits into
Open
Conversation
Contributor
ChangesetThe following package versions will be affected by this PR:
|
Contributor
|
local_video should not be in the changeset since it is not a versioned package configured in knope.toml. |
Contributor
There was a problem hiding this comment.
Pull request overview
Enhances the examples/local_video publisher/subscriber demos with test-pattern generation, local preview rendering, improved timing/latency overlays, and macOS Metal zero-copy NV12 rendering; also exposes room creation playout-delay options via livekit-api.
Changes:
- Add
RoomClient::create_room_with_playout_delayand use it from the publisher to recreate rooms with explicit subscriber playout delay. - Extend local video examples with SMPTE test pattern publishing, optional local preview window, aspect-constrained viewport resizing, and richer timing overlays.
- Add macOS NV12 CVPixelBuffer → Metal texture import path and shader support for NV12 vs I420 sampling.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| livekit-api/src/services/room.rs | Refactors room creation request building and adds a playout-delay-specific room creation API. |
| examples/local_video/src/yuv_shader.wgsl | Adds yuv_layout to support NV12 (RG) vs I420 (separate U/V) sampling. |
| examples/local_video/src/viewport_aspect.rs | Introduces an aspect-constrained viewport helper for smoother window resizing. |
| examples/local_video/src/video_display.rs | Adds a local preview app for displaying published I420 frames plus publisher timing HUD. |
| examples/local_video/src/timestamp_burn.rs | Reworks burned-in overlay rendering and adds LatencyDisplay with tests. |
| examples/local_video/src/test_pattern.rs | Adds SMPTE-style 75% color bars generator in I420 format. |
| examples/local_video/src/subscriber.rs | Adds viewport constraint logic, timing overlay updates, jitter buffer logging, and macOS zero-copy NV12 render path. |
| examples/local_video/src/publisher.rs | Adds test-pattern source, room playout-delay recreation, local preview window, and updated capture/timing pipeline. |
| examples/local_video/README.md | Documents new flags and recommends --release for smoother rendering. |
| examples/local_video/Cargo.toml | Adds macOS dependency on metal. |
| Cargo.lock | Locks metal dependency. |
| .changeset/add_room_playout_delay_options.md | Records the API and example enhancement as a patch change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1742
to
1755
| if stride_y >= dims.0 { | ||
| queue.write_texture( | ||
| wgpu::TexelCopyTextureInfo { | ||
| texture: &state.y_tex, | ||
| mip_level: 0, | ||
| origin: wgpu::Origin3d::ZERO, | ||
| aspect: wgpu::TextureAspect::All, | ||
| }, | ||
| &state.upload_y, | ||
| data_y, | ||
| wgpu::TexelCopyBufferLayout { | ||
| offset: 0, | ||
| bytes_per_row: Some(upload_row_bytes.0), | ||
| bytes_per_row: Some(stride_y), | ||
| rows_per_image: Some(dims.1), | ||
| }, |
Comment on lines
+597
to
+601
| let source_frame_started_at = Instant::now(); | ||
| let frame_wall_time_us = unix_time_us_now(); | ||
| let mut buffer = create_i420_buffer(width, height, align_buffers_for_display); | ||
| let (stride_y, stride_u, stride_v) = buffer.strides(); | ||
| let (data_y, data_u, data_v) = buffer.data_mut(); |
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.
--test-patternflag to publisher example to generate SMPTE color bars.--display-videoon publisher example to render video being published.