@@ -62,7 +62,7 @@ function convertNv12ToRgbaMainThread(
6262 const ySize = yStride * height ;
6363 const yPlane = nv12Data ;
6464 const uvPlane = nv12Data . subarray ( ySize ) ;
65- const uvStride = width ;
65+ const uvStride = yStride ;
6666
6767 for ( let row = 0 ; row < height ; row ++ ) {
6868 const yRowOffset = row * yStride ;
@@ -308,7 +308,7 @@ export function createImageDataWS(
308308
309309 if ( width > 0 && height > 0 ) {
310310 const ySize = yStride * height ;
311- const uvSize = width * ( height / 2 ) ;
311+ const uvSize = yStride * ( height / 2 ) ;
312312 const totalSize = ySize + uvSize ;
313313
314314 const frameData = new Uint8ClampedArray ( buffer , 0 , totalSize ) ;
@@ -351,7 +351,7 @@ export function createImageDataWS(
351351
352352 if ( width > 0 && height > 0 ) {
353353 const ySize = yStride * height ;
354- const uvSize = width * ( height / 2 ) ;
354+ const uvSize = yStride * ( height / 2 ) ;
355355 const totalSize = ySize + uvSize ;
356356
357357 const frameData = new Uint8ClampedArray ( buffer , 0 , totalSize ) ;
@@ -669,7 +669,7 @@ export function createImageDataWS(
669669
670670 if ( width > 0 && height > 0 ) {
671671 const ySize = yStride * height ;
672- const uvSize = width * ( height / 2 ) ;
672+ const uvSize = yStride * ( height / 2 ) ;
673673 const totalSize = ySize + uvSize ;
674674
675675 const frameData = new Uint8ClampedArray ( buffer , 0 , totalSize ) ;
@@ -735,7 +735,7 @@ export function createImageDataWS(
735735
736736 if ( width > 0 && height > 0 ) {
737737 const ySize = yStride * height ;
738- const uvSize = width * ( height / 2 ) ;
738+ const uvSize = yStride * ( height / 2 ) ;
739739 const totalSize = ySize + uvSize ;
740740
741741 const nv12Data = new Uint8ClampedArray ( buffer , 0 , totalSize ) ;
0 commit comments