This Question have no Text answers yet!

Error with onPreviewFrame Callback when trying to get current camera frame as bitmap

By : Luis
Source: Stackoverflow.com
Question!

I try to get the single camera frames as bitmaps like in this answer:

@Override
public void onPreviewFrame(byte[] data, Camera camera) {

    yuvType = new Type.Builder(rs, Element.U8(rs)).setX(data.length);
    in = Allocation.createTyped(rs, yuvType.create(), Allocation.USAGE_SCRIPT);

    rgbaType = new Type.Builder(rs, Element.RGBA_8888(rs));
    rgbaType.setX(width);
    rgbaType.setY(height); //From Camera.Size
    out = Allocation.createTyped(rs, rgbaType.create(), Allocation.USAGE_SCRIPT);



    in.copyFrom(data);

    yuvToRgbIntrinsic.setInput(in);
    yuvToRgbIntrinsic.forEach(out);

    Bitmap bmpout = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
     out.copyTo(bmpout);

}

When I run this, it works perfectly until

yuvToRgbIntrinsic.forEach(out);

I get a error in the logcat and the application closes after a few seconds but doesn't show any kind of error.

Logcat error:

A/libc: Fatal signal 11 (SIGSEGV), code 128, fault addr 0x0 in tid 5121 (//package name of my app)
A/libc: Fatal signal 11 (SIGSEGV) in tid 5122 (//package name of my app)

I tried it on an other device and it worked. Can somebody tell me what I have to do that it works on every devices?

By : Luis


Video about Error with onPreviewFrame Callback when trying to get current camera frame as bitmap