Hi, I've been working in an application that uses CameraInterface.java and i
found a bug with the JPEG compressed images payload, it wasn't the same in
every package, obviously. So, when a package arrived, the first 32 (28+4)
bytes were decoded correctly, but when the image bytes were read,
apparently, didn't match with the imageCount previously obtained, so the
next frame never synchronized and there wasn't data ready.
With the non-compressed images worked fine, because the length of the
imagecount was always the same.
To fix it, i modified the readData method in the CameraInterface.java,
replacing the buffer's length with the header payload size less 32 (28+4)
bytes previously read, so it always matched, for compress and non-compress
images.
// Buffer for reading image
//buffer = new byte[PLAYER_CAMERA_IMAGE_SIZE];
buffer = new byte[ header.getSize()-32];
//is.readFully (buffer, 0, imageCount);
is.readFully (buffer, 0, header.getSize()-32);
pcdata.setImage (buffer);
It works fine, or like people say in my country, "al peluche".
--
+++++++++++++++++++++++++++++++++++++++
David Leonardo Acosta Molano
Móvil 300 620 56 08
Cali - Colombia
+++++++++++++++++++++++++++++++++++++++ |