Closed jimmyn closed 1 year ago
This is a bug I could've sworn I fixed, but apparently I didn't.
The data coming out of libav has a stride length per row that can be different than the actual amount of data in each row, and this is incorrectly conflating the two. This will need correction...
Turns out I fixed it on the input side but not the output side. This should be fixed in 19818ba6a, but I'd appreciate testing.
@Yahweasel thanks, I've got the idea, seems it should be image.codedWidth * 4
, not just image.codedWidth
. It works!
I'm facing issues with some videos in
createImageBitmap
function. It seems that the frame has more data that can fit intoUint8ClampedArray
of theImageData
with the given size.The error happens here - https://github.com/ennuicastr/libavjs-webcodecs-polyfill/blob/master/src/rendering.ts#L375 It only happens in some videos, not all of them.
You can find the code example to reproduce the issue here - https://github.com/jimmyn/libavjs-webcodecs
I tried to truncate the last chunk of data, it fixes the error, but logically the frame appears corrupted.
I get the frame like this:
The sum of data of each plane in my example is 3727360, but the
frameData.data.length
is 722 1280 4 = 3696640I'd appreciate any help here.