the project I am working on needs to read the camera data from C # and pass it to java for processing.
I don"t know how to implement it, but I can"t find a lot of examples on the Internet
my current implementation is as follows. I don"t know where there is a problem. Do you have any familiar classmates?
extern "C"
jbyteArray JNICALL Java_com_example_administrator_mmap_MainActivity_getFrame(
JNIEnv *env,
jobject) {
void *buff = NULL;
int ret ;
jbyteArray array = NULL;
ret = pFrameClient->readFrame(&buff);
if(ret == 0)
{
ALOGD("debug, wait");
}
else{
array = env->NewByteArray(ret);
env->SetByteArrayRegion(array, 0, ret, (jbyte *)buff);
ALOGD("debug, read frame %d", ret);
}
return array;
}