if (buffer == null || buffer.getLength() <= 0) {
//logger.info("zero length buffer");
return BUFFER_PROCESSED_OK;
}
Format format = buffer.getFormat();
if (format instanceof VideoFormat) {
Dimension size = ((VideoFormat) format).getSize();
if ((size != null) && (size.width != inWidth || size.height != inHeight)) {
inWidth = size.width;
inHeight = size.height;
updateScale();
}
}
synchronized (syncObject) {
Object data = buffer.getData();
if (data == null) {
return BUFFER_PROCESSED_FAILED;
}
frameArray = buffer.getData();
if (format.getDataType() == Format.byteArray) {
frameData = ByteBuffer.wrap((byte[]) frameArray);
}
else if (format.getDataType() == Format.intArray) {
frameData = IntBuffer.wrap((int[]) frameArray);
}
else {
return BUFFER_PROCESSED_FAILED;
}