Closed chuen1118 closed 5 years ago
Checked this post, android would add padding to image buffer, thus the Y-plane buffer size returned from ImageReader should be
size = rowStride * height - (rowStride - width)
in my case 768*480-(768-640) = 368512
In videoAndroid.c, https://github.com/artoolkitx/artoolkitx/blob/381ec933048cbb4dfffb4d8397c88f463d587f67/Source/ARX/ARVideo/Android/videoAndroid.c#L763-L766
Changed
if ((vid->widthIn * vid->heightIn) != buf0Size) {
to
if ((buf0RowStride * vid->heightIn - (buf0RowStride - vid->widthIn)) != buf0Size) {
problem solved.
Encountered some errors when running on Android device.
I only have this one device so could not test if this is a device specific issue, but no error when running on emulator.
ARproject E/Unity: Unable to find __Internal
This one seemed not affecting muchAfter 5 minutes of not running
Error: unexpected buffer size (368512) for format YUV_420_888.
What does this mean?EDIT:
The device is running on Nougat (7.0.0) Camera is set to 640x480, thus the buffer size should be 406800, I don't understand where 368512 comes from. Here is what the planes from
reader.acquireLatestImage()
look likePlane[0]
Plane[1]
Plane[2]