[feat] optimize Windows native video rendering

This commit is contained in:
dijunkun
2026-09-03 18:01:09 +08:00
parent e716346b26
commit 3f537ae63c
7 changed files with 815 additions and 66 deletions
@@ -1124,12 +1124,17 @@ Params MakeParams(const RTCState &state, const std::string &user_id,
static_cast<size_t>(_selectedDisplay.load()));
if (source != expected) return;
}
const XNativeVideoFrame *native_frame = frame->native_frame;
const bool has_native_pixel_buffer =
frame->native_handle &&
frame->native_handle_type == XVideoFrameNativeHandleCVPixelBuffer;
native_frame &&
native_frame->struct_size >=
static_cast<uint32_t>(sizeof(XNativeVideoFrame)) &&
native_frame->type == XNativeVideoFrameCVPixelBuffer &&
native_frame->payload.cv_pixel_buffer;
if (has_native_pixel_buffer) {
CVPixelBufferRef pixel_buffer =
static_cast<CVPixelBufferRef>(frame->native_handle);
static_cast<CVPixelBufferRef>(
native_frame->payload.cv_pixel_buffer);
[self enqueueVideoPixelBuffer:pixel_buffer
width:frame->width
height:frame->height];