MCPcopy Index your code
hub / github.com/CapSoftware/Cap / renderPendingFrameCanvas2D

Function renderPendingFrameCanvas2D

apps/desktop/src/utils/socket.ts:608–634  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

606 }
607
608 function renderPendingFrameCanvas2D() {
609 if (!pendingNv12Frame || !directCanvas || !directCtx) return;
610
611 const { buffer, receivedAt } = pendingNv12Frame;
612 pendingNv12Frame = null;
613
614 const metadata = readNv12Metadata(buffer);
615 if (!metadata) return;
616
617 const { yStride, height, width, fullRange } = metadata;
618
619 if (width > 0 && height > 0) {
620 const ySize = yStride * height;
621 const uvSize = yStride * (height / 2);
622 const totalSize = ySize + uvSize;
623
624 const frameData = new Uint8ClampedArray(buffer, 0, totalSize);
625 renderNv12FrameCanvas2D(
626 frameData,
627 width,
628 height,
629 yStride,
630 fullRange,
631 receivedAt,
632 );
633 }
634 }
635
636 function schedulePendingNv12FrameCanvas2D(
637 buffer: ArrayBuffer,

Callers 2

createImageDataWSFunction · 0.85

Calls 2

readNv12MetadataFunction · 0.85
renderNv12FrameCanvas2DFunction · 0.85

Tested by

no test coverage detected