[Enhancement]Improve frame rendering#70
Merged
ipavlidakis merged 4 commits intodevelopfrom Feb 3, 2026
Merged
Conversation
Introduce stream_enable_rendering_backend GN arg to isolate Stream-specific rendering changes. When enabled, build a new shared Metal backend target and swap in an NV12-capable ObjC frame buffer bridge; otherwise keep upstream objc_frame_buffer unchanged. - add RTCSharedMetal* view/context/adapter and wire RTCVideoRenderingView to use it on iOS when RTC_STREAM_RENDERING_BACKEND is set - add maxInFlightFrames to RTCVideoRenderingView and forward to backend - gate NV12 wrappers and ObjC frame-buffer policy to stream builds only - move NV12 policy implementation to objc_frame_buffer_stream.mm and keep objc_frame_buffer.mm clean - export NV12 headers only when the stream flag is enabled - add comments to clarify gating and platform behavior
This was referenced Jan 28, 2026
martinmitrevski
approved these changes
Feb 2, 2026
martinmitrevski
left a comment
There was a problem hiding this comment.
check the feedback shared via slack, if there's something meaningful there. Other than that, we're good ✅
santhoshvai
added a commit
to GetStream/react-native-webrtc
that referenced
this pull request
Feb 17, 2026
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.
Summary
This PR introduces an opt‑in shared Metal rendering backend and NV12 frame‑buffer policies for iOS, behind the
stream_enable_rendering_backendbuild flag (defaultfalse). It adds NV12 buffer wrappers, policy‑driven bridging for ObjC frame buffers, and a newRTCVideoRenderingViewthat can select between the default Metal view and the shared backend. Existing behavior is preserved when the flag is disabled.Key Changes
RTCNV12Bufferprotocol andRTCNativeNV12Bufferwrapper to expose NV12 data to ObjC consumers.RTCFrameBufferPolicyonRTCPeerConnectionFactoryto control how decoded buffers are bridged to ObjC:None(default) → I420 onlyWrapOnlyExistingNV12→ wrap NV12 if already availableCopyToNV12→ copy to NV12ConvertWithPoolToNV12→ pooled NV12 conversionobjc_frame_buffer_stream.mmcompiled only whenstream_enable_rendering_backendis enabled, leaving the default WebRTC file untouched.RTCSharedMetalRenderingContext,RTCSharedMetalRenderAdapter,RTCSharedMetalVideoView) to reduce per‑view Metal overhead. XR (visionOS) is excluded until validated.RTCVideoRenderingViewselects either default Metal rendering or shared Metal when available, with fallback toRTCMTLVideoViewif shared context fails.frameBufferPolicyper‑frame behavior and mid‑call changes, and notes property access is not synchronized.Behavior & Compatibility
stream_enable_rendering_backend = falseensures existing consumers see no changes unless they opt in.