Open anonym24 opened 6 years ago
We'll need to reallocate the image buffer then.
I found out that this happens when I first installs app and trying to record for the first time when I try second time, it works ok
try {
((ByteBuffer) frame.image[0].position(0)).put(data);
} catch (BufferOverflowException e) {
Log.i(TAG, "recordError BufferOverflowException " + e);
frame = new Frame(previewWidth, previewHeight, frameDepth, frameChannels);
frameToRecord = new FrameToRecord(timestamp, frame);
((ByteBuffer) frame.image[0].position(0)).put(data);
}
this didn't help, error on the second try in try,,,catch block
java.nio.BufferOverflowException
Sometimes this error happens at this line
((ByteBuffer)yuvImage.image[0].position(0)).put(data);
https://github.com/bytedeco/javacv/blob/master/samples/RecordActivity.java#L552