Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Camera Screen goes black when using Skia Frame Processors (doesn't happen with normal frame processors) #3365

Open
5 tasks done
DragonDare opened this issue Jan 14, 2025 · 33 comments
Labels
🐛 bug Something isn't working

Comments

@DragonDare
Copy link

What's happening?

I'm trying to implement pose detection by drawing stick-figure of the pose on my app. But with Skia Frame processor, the camera screen goes black with only the stick figure being visible. However, if i use a normal frame processor, the camera is visible and not black.

Packages:

  1. "react-native-fast-tflite": "^1.5.1",
  2. "@shopify/react-native-skia": "1.5.0",
  3. "react-native-worklets-core": "^1.5.0",
  4. "vision-camera-resize-plugin": "^3.2.0"

WhatsApp Image 2025-01-14 at 17 40 08_e5825574

Reproduceable Code

import TopAppBar from '@/components/TopAppBar';
import { SlamdunkTheme } from '@/constants/Theme';
import { scaleHeight, scaleWidth } from '@/utils/scaling';
import React, { useEffect, useMemo } from 'react';
import { StyleSheet, View, Text, Platform } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { Camera, useCameraDevice, useCameraPermission, useSkiaFrameProcessor } from 'react-native-vision-camera';
import { useResizePlugin } from 'vision-camera-resize-plugin';
import { TensorflowModel, useTensorflowModel } from 'react-native-fast-tflite';
import { PaintStyle, Skia } from '@shopify/react-native-skia';
import getBestFormat from './formatFilter';

function tensorToString(tensor: TensorflowModel['inputs'][number]): string {
  return `${tensor.dataType} [${tensor.shape}]`;
}

const LINE_WIDTH = 1;
const MIN_CONFIDENCE = 0.3;

const VIEW_WIDTH = scaleWidth(375);

const CameraScreen = () => {
  const device = useCameraDevice('back');

  const { hasPermission, requestPermission } = useCameraPermission();

  useEffect(() => {
    if (!hasPermission) {
      requestPermission().catch((err) => {
        console.error('Camera permission request failed:', err);
      });
    }
  }, [hasPermission, requestPermission]);

  if (!device) {
    return <Text>Loading camera...</Text>;
  }
  
  const { resize } = useResizePlugin();

  const delegate = Platform.OS === 'ios' ? 'core-ml' : undefined;
  const plugin = useTensorflowModel(
    require('../assets/models/singlepose-lightning-tflite-float16.tflite'),
    delegate,
  );
  const format = useMemo(
    () => (device != null ? getBestFormat(device, 720, 1000) : undefined),
    [device],
  );
  console.log(format?.videoWidth, format?.videoHeight);

  const pixelFormat = Platform.OS === 'ios' ? 'rgb' : 'yuv';

  useEffect(() => {
    const model = plugin.model;
    if (model == null) {
      return;
    }
    console.log(
      `Model: ${model.inputs.map(tensorToString)} -> ${model.outputs.map(
        tensorToString,
      )}`,
    );
  }, [plugin]);

  const inputTensor = plugin.model?.inputs[0];
  const inputWidth = inputTensor?.shape[1] ?? 0;
  const inputHeight = inputTensor?.shape[2] ?? 0;
  if (inputTensor != null) {
    console.log(
      `Input: ${inputTensor.dataType} ${inputWidth} x ${inputHeight}`,
    );
  }

  // to get from px -> dp since we draw in the camera coordinate system
  const SCALE = (format?.videoWidth ?? VIEW_WIDTH) / VIEW_WIDTH;

  const paint = Skia.Paint();
  paint.setStyle(PaintStyle.Fill);
  paint.setStrokeWidth(LINE_WIDTH * SCALE);
  paint.setColor(Skia.Color('yellow'));

  const lines = [
    // left shoulder -> elbow
    5, 7,
    // right shoulder -> elbow
    6, 8,
    // left elbow -> wrist
    7, 9,
    // right elbow -> wrist
    8, 10,
    // left hip -> knee
    11, 13,
    // right hip -> knee
    12, 14,
    // left knee -> ankle
    13, 15,
    // right knee -> ankle
    14, 16,

    // left hip -> right hip
    11, 12,
    // left shoulder -> right shoulder
    5, 6,
    // left shoulder -> left hip
    5, 11,
    // right shoulder -> right hip
    6, 12,
  ];

  const rotation = Platform.OS === 'ios' ? '0deg' : '0deg'; // hack to get android oriented properly

  const frameProcessor = useSkiaFrameProcessor(
    frame => {
      'worklet';

      if (plugin.model != null) {
        const smaller = resize(frame, {
          scale: {
            width: inputWidth,
            height: inputHeight,
          },
          pixelFormat: 'rgb',
          dataType: 'uint8',
          rotation: rotation,
        });
        const outputs = plugin.model.runSync([smaller]);

        const output = outputs[0];
        const frameWidth = frame.width;
        const frameHeight = frame.height;

        for (let i = 0; i < lines.length; i += 2) {
          const from = lines[i];
          const to = lines[i + 1];

          const confidence = output[from * 3 + 2];
          if (confidence > MIN_CONFIDENCE) {
            frame.drawLine(
              Number(output[from * 3 + 1]) * Number(frameWidth),
              Number(output[from * 3]) * Number(frameHeight),
              Number(output[to * 3 + 1]) * Number(frameWidth),
              Number(output[to * 3]) * Number(frameHeight),
              paint,
            );
          }
        }
      }
    },
    [plugin, paint],
  );

  return (
    <SafeAreaView style={SlamdunkTheme.styles.rootBlack}>
      <TopAppBar title="" arrowColor="white" />
      <View style={styles.textBox}>
        <Text style={styles.instructionText}>
          Make sure your body is positioned correctly
        </Text>
      </View>
      {hasPermission && (
        <Camera
          style={styles.camera}
          device={device}
          isActive={true}
          frameProcessor={frameProcessor}
          format={format}
          fps={10}
          pixelFormat={pixelFormat}
          outputOrientation='device'
          audio={false}
          enableFpsGraph={true}
        />
      )}
      {/* <View style={styles.overlay}>
        <View style={styles.dottedBox}></View>
      </View> */}
    </SafeAreaView>
  );
};

export default CameraScreen;

const styles = StyleSheet.create({
  overlay: {
    ...StyleSheet.absoluteFillObject,
		top: scaleHeight(161),
		alignItems: 'center',
  },
	textBox: {
		width: scaleWidth(290),
		alignSelf: 'center',
	},
	camera: {
		height: scaleHeight(638),
	},
  instructionText: {
		fontFamily: SlamdunkTheme.fonts.poppinsRegular,
    fontSize: 22,
    fontWeight: 400,
		lineHeight: 33,
    color: SlamdunkTheme.colors.backgroundColor,
		textAlign: 'center',
  },
  dottedBox: {
    width: scaleWidth(319),
    height: scaleHeight(514),
    borderWidth: 2,
    borderColor: SlamdunkTheme.colors.backgroundVariant3,
    borderStyle: 'dashed',
		backgroundColor: SlamdunkTheme.colors.backgroundVariant3,
    borderRadius: 8,
  },
});

Relevant log output

01-14 17:44:02.118  6274  6581 I MediaCodec: [0xb400007922e3a410] dequeue 61 output frames in last 1003 ms, latest timeUs 1000028846183, flags 128
01-14 17:44:02.118  1391  6735 I FlickerAlgo: [DoCmdDetect] type(0) n_win_h(3) n_win_w(6) win_wd(682) win_ht(758) cur_freq(50) time_diff(0) score_50(0) score_60(-2) result_status(2)
01-14 17:44:02.123  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55215801788407
01-14 17:44:02.140  1391  6710 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.140  1391  6710 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:do_validatePerFrameP2
01-14 17:44:02.141  1023  1173 I HfLooper: LIGHT_SENSOR lux = 4.000000, timestamp = 55215819245551
01-14 17:44:02.143  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55215822044705 
01-14 17:44:02.160  6274  6758 I CameraView: invokeOnAverageFpsChanged(10.131712259371833)
01-14 17:44:02.155  6274  6274 W ionCamera.video: type=1400 audit(0.0:362521): avc:  denied  { getattr } for  name="dmabuf:" dev="dmabuf" ino=1 scontext=u:r:untrusted_app:s0:c91,c258,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=com.pronisi.slamdunkai.debug
01-14 17:44:02.163  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55215842134278
01-14 17:44:02.164  6274  6461 I ResizePlugin: Rotation: 0
01-14 17:44:02.164  6274  6461 I ResizePlugin: Mirror not specified, defaulting to: false
01-14 17:44:02.164  6274  6461 I ResizePlugin: Target scale: 192 x 192
01-14 17:44:02.164  6274  6461 I ResizePlugin: Cropping to 720 x 720 at (280, 0)
01-14 17:44:02.164  6274  6461 I ResizePlugin: Target Format: RGB
01-14 17:44:02.164  6274  6461 I ResizePlugin: Target DataType: UINT8
01-14 17:44:02.164  6274  6461 I ResizePlugin: Converting YUV 4:2:0 -> ARGB 8888...
01-14 17:44:02.167  6274  6461 I ResizePlugin: Cropping [0, 0 @ 1280x720] ARGB buffer to [280, 0 @ 720x720]...
01-14 17:44:02.168  6274  6461 I ResizePlugin: Scaling [0, 0 @ 720x720] ARGB buffer to [0, 0 @ 192x192]...
01-14 17:44:02.169  6274  6461 I ResizePlugin: Converting ARGB Buffer to Pixel Format 0...
01-14 17:44:02.169  6274  6461 I SharedArray: Wrapping Java ByteBuffer with size 110592...
01-14 17:44:02.184  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55215862058796
01-14 17:44:02.199  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(IS_MOTCAM), factor_value(0)
01-14 17:44:02.199  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.199  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.199  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.199  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.200  1391  6654 D CcuCtrlAe: [dequeCcuAeStat] m_sensorIdx:0 magic_is_ready:178 query_magic:178 duration_us:0.000000 aeOutputVa:0x7131df9ab0 ridx:1 req/key/cwv_y_le/cwv_y_se:180/180/929/940
01-14 17:44:02.202  1391  1843 D MtkCam/ATMsEventMgr: [ATMsEventMgr]set factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.202  1391  1843 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.203  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55215882074580
01-14 17:44:02.205  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.205  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.205  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK load matchIndex = 2
01-14 17:44:02.205  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] expected trans. AfeGain: 5119
01-14 17:44:02.205  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] after AlignGainList AfeGain: 5119 IspGain: 4096       
01-14 17:44:02.205  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] - u4Eposuretime:10000 u4AfeGain:5119 u4IspGain:4096 u4ISO:499 u4MiniISO:100 MiniAfeGain:1024 MiniIspGain:4096
01-14 17:44:02.214  1391  6654 D isp_tuning_custom: [evaluate_Shading_Ratio] sensorid(5656642), preSensorId(5656642), rLSCInfo.SensorMode(2), preSensorMode(2), isSensorOrModeSwitch(0), preLscHwType(0), isHwTypeSwitch(0), isPass2(0), isInit(0), i4Scenario(12), eApp(12), isAIshutter(0), isFlashCapture(0)
01-14 17:44:02.214  1391  6654 D isp_tuning_custom: [iso_smooth][ISO smooth enabled][ISO idx(180)]avgISO = 559.
01-14 17:44:02.214  1391  6654 D isp_tuning_custom: [RA_smooth][RA smooth][frm idx(180)] rto for iso(31), prev_rto(31),RA_incremental_step(2), smoothed ratio(31)
01-14 17:44:02.225  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55215902216326 
01-14 17:44:02.242  1391  6710 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.242  1391  6710 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:do_validatePerFrameP2
01-14 17:44:02.244  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 25.000000, timestamp = 55215922046820
01-14 17:44:02.255  1365  1365 W HidlServiceManagement: Waited for hwservicemanager.ready for a second, waiting another...
01-14 17:44:02.256  1365  1365 W libc    : Access denied finding property "hwservicemanager.ready"
01-14 17:44:02.251  1365  1365 W binder:1365_2: type=1400 audit(0.0:362522): avc:  denied  { read } for  name="u:object_r:hwservicemanager_prop:s0" dev="tmpfs" ino=8113 scontext=u:r:lbs_dbg_ext:s0 tcontext=u:object_r:hwservicemanager_prop:s0 tclass=file permissive=0
01-14 17:44:02.256  1365  1365 W libc    : Access denied finding property "hwservicemanager.ready"
01-14 17:44:02.251  1365  1365 W binder:1365_2: type=1400 audit(0.0:362523): avc:  denied  { read } for  name="u:object_r:hwservicemanager_prop:s0" dev="tmpfs" ino=8113 scontext=u:r:lbs_dbg_ext:s0 tcontext=u:object_r:hwservicemanager_prop:s0 tclass=file permissive=0
01-14 17:44:02.264  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55215942075417
01-14 17:44:02.268  6274  6461 I ResizePlugin: Rotation: 0
01-14 17:44:02.268  6274  6461 I ResizePlugin: Mirror not specified, defaulting to: false
01-14 17:44:02.268  6274  6461 I ResizePlugin: Target scale: 192 x 192
01-14 17:44:02.268  6274  6461 I ResizePlugin: Cropping to 720 x 720 at (280, 0)
01-14 17:44:02.268  6274  6461 I ResizePlugin: Target Format: RGB
01-14 17:44:02.268  6274  6461 I ResizePlugin: Target DataType: UINT8
01-14 17:44:02.268  6274  6461 I ResizePlugin: Converting YUV 4:2:0 -> ARGB 8888...
01-14 17:44:02.272  6274  6461 I ResizePlugin: Cropping [0, 0 @ 1280x720] ARGB buffer to [280, 0 @ 720x720]...
01-14 17:44:02.273  6274  6461 I ResizePlugin: Scaling [0, 0 @ 720x720] ARGB buffer to [0, 0 @ 192x192]...
01-14 17:44:02.274  6274  6461 I ResizePlugin: Converting ARGB Buffer to Pixel Format 0...
01-14 17:44:02.274  6274  6461 I SharedArray: Wrapping Java ByteBuffer with size 110592...
01-14 17:44:02.284  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55215962444542
01-14 17:44:02.299  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(IS_MOTCAM), factor_value(0)
01-14 17:44:02.299  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.299  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.299  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.300  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.300  1391  6654 D CcuCtrlAe: [dequeCcuAeStat] m_sensorIdx:0 magic_is_ready:179 query_magic:179 duration_us:0.000000 aeOutputVa:0x7131dcf000 ridx:0 req/key/cwv_y_le/cwv_y_se:181/181/920/931
01-14 17:44:02.302  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.302  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.302  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK load matchIndex = 2
01-14 17:44:02.302  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] expected trans. AfeGain: 5119
01-14 17:44:02.302  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] after AlignGainList AfeGain: 5119 IspGain: 4096       
01-14 17:44:02.302  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] - u4Eposuretime:10000 u4AfeGain:5119 u4IspGain:4096 u4ISO:499 u4MiniISO:100 MiniAfeGain:1024 MiniIspGain:4096
01-14 17:44:02.304  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55215982041267
01-14 17:44:02.305  1391 17333 D MtkCam/ATMsEventMgr: [ATMsEventMgr]set factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.305  1391 17333 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.309  1391  6654 D isp_tuning_custom: [evaluate_Shading_Ratio] sensorid(5656642), preSensorId(5656642), rLSCInfo.SensorMode(2), preSensorMode(2), isSensorOrModeSwitch(0), preLscHwType(0), isHwTypeSwitch(0), isPass2(0), isInit(0), i4Scenario(12), eApp(12), isAIshutter(0), isFlashCapture(0)
01-14 17:44:02.309  1391  6654 D isp_tuning_custom: [iso_smooth][ISO smooth enabled][ISO idx(181)]avgISO = 559.
01-14 17:44:02.309  1391  6654 D isp_tuning_custom: [RA_smooth][RA smooth][frm idx(181)] rto for iso(31), prev_rto(31),RA_incremental_step(2), smoothed ratio(31)
01-14 17:44:02.323  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216001798517
01-14 17:44:02.341  1391  6710 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.341  1391  6710 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:do_validatePerFrameP2
01-14 17:44:02.345  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55216022056946 
01-14 17:44:02.348  1023  1173 I HfLooper: LIGHT_SENSOR lux = 2.000000, timestamp = 55216025755638
01-14 17:44:02.364  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55216042203008
01-14 17:44:02.371  6274  6461 I ResizePlugin: Rotation: 0
01-14 17:44:02.371  6274  6461 I ResizePlugin: Mirror not specified, defaulting to: false
01-14 17:44:02.371  6274  6461 I ResizePlugin: Target scale: 192 x 192
01-14 17:44:02.371  6274  6461 I ResizePlugin: Cropping to 720 x 720 at (280, 0)
01-14 17:44:02.371  6274  6461 I ResizePlugin: Target Format: RGB
01-14 17:44:02.371  6274  6461 I ResizePlugin: Target DataType: UINT8
01-14 17:44:02.371  6274  6461 I ResizePlugin: Converting YUV 4:2:0 -> ARGB 8888...
01-14 17:44:02.375  6274  6461 I ResizePlugin: Cropping [0, 0 @ 1280x720] ARGB buffer to [280, 0 @ 720x720]...
01-14 17:44:02.376  6274  6461 I ResizePlugin: Scaling [0, 0 @ 720x720] ARGB buffer to [0, 0 @ 192x192]...
01-14 17:44:02.376  6274  6461 I ResizePlugin: Converting ARGB Buffer to Pixel Format 0...
01-14 17:44:02.377  6274  6461 I SharedArray: Wrapping Java ByteBuffer with size 110592...
01-14 17:44:02.386  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 25.000000, timestamp = 55216062074057
01-14 17:44:02.400  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(IS_MOTCAM), factor_value(0)
01-14 17:44:02.401  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.401  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.401  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.401  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.401  1391  6654 D CcuCtrlAe: [dequeCcuAeStat] m_sensorIdx:0 magic_is_ready:180 query_magic:180 duration_us:0.000000 aeOutputVa:0x7131df9ab0 ridx:1 req/key/cwv_y_le/cwv_y_se:182/182/915/927
01-14 17:44:02.403  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 25.000000, timestamp = 55216082095898
01-14 17:44:02.404  1391 17333 D MtkCam/ATMsEventMgr: [ATMsEventMgr]set factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.404  1391 17333 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.405  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.405  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.405  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK load matchIndex = 2
01-14 17:44:02.405  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] expected trans. AfeGain: 5119
01-14 17:44:02.405  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] after AlignGainList AfeGain: 5119 IspGain: 4096       
01-14 17:44:02.405  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] - u4Eposuretime:10000 u4AfeGain:5119 u4IspGain:4096 u4ISO:499 u4MiniISO:100 MiniAfeGain:1024 MiniIspGain:4096
01-14 17:44:02.411  1391  6654 D isp_tuning_custom: [evaluate_Shading_Ratio] sensorid(5656642), preSensorId(5656642), rLSCInfo.SensorMode(2), preSensorMode(2), isSensorOrModeSwitch(0), preLscHwType(0), isHwTypeSwitch(0), isPass2(0), isInit(0), i4Scenario(12), eApp(12), isAIshutter(0), isFlashCapture(0)
01-14 17:44:02.411  1391  6654 D isp_tuning_custom: [iso_smooth][ISO smooth enabled][ISO idx(182)]avgISO = 559.
01-14 17:44:02.411  1391  6654 D isp_tuning_custom: [RA_smooth][RA smooth][frm idx(182)] rto for iso(31), prev_rto(31),RA_incremental_step(2), smoothed ratio(31)
01-14 17:44:02.424  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 25.000000, timestamp = 55216102095272 
01-14 17:44:02.442  1391  6710 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.443  1391  6710 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:do_validatePerFrameP2
01-14 17:44:02.444  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216122054715
01-14 17:44:02.465  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 25.000000, timestamp = 55216142053878 
01-14 17:44:02.473  6274  6461 I ResizePlugin: Rotation: 0
01-14 17:44:02.473  6274  6461 I ResizePlugin: Mirror not specified, defaulting to: false
01-14 17:44:02.473  6274  6461 I ResizePlugin: Target scale: 192 x 192
01-14 17:44:02.473  6274  6461 I ResizePlugin: Cropping to 720 x 720 at (280, 0)
01-14 17:44:02.473  6274  6461 I ResizePlugin: Target Format: RGB
01-14 17:44:02.473  6274  6461 I ResizePlugin: Target DataType: UINT8
01-14 17:44:02.473  6274  6461 I ResizePlugin: Converting YUV 4:2:0 -> ARGB 8888...
01-14 17:44:02.475  6274  6461 I ResizePlugin: Cropping [0, 0 @ 1280x720] ARGB buffer to [280, 0 @ 720x720]...
01-14 17:44:02.475  6274  6461 I ResizePlugin: Scaling [0, 0 @ 720x720] ARGB buffer to [0, 0 @ 192x192]...
01-14 17:44:02.476  6274  6461 I ResizePlugin: Converting ARGB Buffer to Pixel Format 0...
01-14 17:44:02.476  6274  6461 I SharedArray: Wrapping Java ByteBuffer with size 110592...
01-14 17:44:02.484  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55216162579960
01-14 17:44:02.499  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(IS_MOTCAM), factor_value(0)
01-14 17:44:02.499  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.499  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.499  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.499  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.500  1391  6654 D CcuCtrlAe: [dequeCcuAeStat] m_sensorIdx:0 magic_is_ready:181 query_magic:181 duration_us:0.000000 aeOutputVa:0x7131dcf000 ridx:0 req/key/cwv_y_le/cwv_y_se:183/183/919/930
01-14 17:44:02.501  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.501  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.501  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK load matchIndex = 2
01-14 17:44:02.501  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] expected trans. AfeGain: 5119
01-14 17:44:02.501  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] after AlignGainList AfeGain: 5119 IspGain: 4096       
01-14 17:44:02.501  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] - u4Eposuretime:10000 u4AfeGain:5119 u4IspGain:4096 u4ISO:499 u4MiniISO:100 MiniAfeGain:1024 MiniIspGain:4096
01-14 17:44:02.502  1391  1842 D MtkCam/ATMsEventMgr: [ATMsEventMgr]set factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.502  1391  1842 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.504  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55216182206119
01-14 17:44:02.504  1391  6654 D isp_tuning_custom: [evaluate_Shading_Ratio] sensorid(5656642), preSensorId(5656642), rLSCInfo.SensorMode(2), preSensorMode(2), isSensorOrModeSwitch(0), preLscHwType(0), isHwTypeSwitch(0), isPass2(0), isInit(0), i4Scenario(12), eApp(12), isAIshutter(0), isFlashCapture(0)
01-14 17:44:02.504  1391  6654 D isp_tuning_custom: [iso_smooth][ISO smooth enabled][ISO idx(183)]avgISO = 559.
01-14 17:44:02.504  1391  6654 D isp_tuning_custom: [RA_smooth][RA smooth][frm idx(183)] rto for iso(31), prev_rto(31),RA_incremental_step(2), smoothed ratio(31)
01-14 17:44:02.524  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55216201781869
01-14 17:44:02.525  1391  6693 I MtkCam/fdNodeImp: [RunFaceDetection] check FD frame timestamp : 49777578600000
01-14 17:44:02.525  1391  6693 I MtkCam/fdNodeImp: [RunFaceDetection] check FD count : 368, duration : 100
01-14 17:44:02.543  1391  6710 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.543  1391  6710 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:do_validatePerFrameP2
01-14 17:44:02.544  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55216222040613 
01-14 17:44:02.563  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216242146248
01-14 17:44:02.566  6274  6461 I ResizePlugin: Rotation: 0
01-14 17:44:02.566  6274  6461 I ResizePlugin: Mirror not specified, defaulting to: false
01-14 17:44:02.566  6274  6461 I ResizePlugin: Target scale: 192 x 192
01-14 17:44:02.566  6274  6461 I ResizePlugin: Cropping to 720 x 720 at (280, 0)
01-14 17:44:02.566  6274  6461 I ResizePlugin: Target Format: RGB
01-14 17:44:02.566  6274  6461 I ResizePlugin: Target DataType: UINT8
01-14 17:44:02.566  6274  6461 I ResizePlugin: Converting YUV 4:2:0 -> ARGB 8888...
01-14 17:44:02.568  6274  6461 I ResizePlugin: Cropping [0, 0 @ 1280x720] ARGB buffer to [280, 0 @ 720x720]...
01-14 17:44:02.569  6274  6461 I ResizePlugin: Scaling [0, 0 @ 720x720] ARGB buffer to [0, 0 @ 192x192]...
01-14 17:44:02.569  6274  6461 I ResizePlugin: Converting ARGB Buffer to Pixel Format 0...
01-14 17:44:02.569  6274  6461 I SharedArray: Wrapping Java ByteBuffer with size 110592...
01-14 17:44:02.583  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55216262053321
01-14 17:44:02.598  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(IS_MOTCAM), factor_value(0)
01-14 17:44:02.599  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.599  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.599  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.599  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.599  1391  6654 D CcuCtrlAe: [dequeCcuAeStat] m_sensorIdx:0 magic_is_ready:182 query_magic:182 duration_us:0.000000 aeOutputVa:0x7131df9ab0 ridx:1 req/key/cwv_y_le/cwv_y_se:184/184/922/933
01-14 17:44:02.602  1391 17809 D MtkCam/ATMsEventMgr: [ATMsEventMgr]set factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.602  1391 17809 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.603  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.603  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.603  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK load matchIndex = 2
01-14 17:44:02.603  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] expected trans. AfeGain: 5119
01-14 17:44:02.603  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] after AlignGainList AfeGain: 5119 IspGain: 4096       
01-14 17:44:02.603  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] - u4Eposuretime:10000 u4AfeGain:5119 u4IspGain:4096 u4ISO:499 u4MiniISO:100 MiniAfeGain:1024 MiniIspGain:4096
01-14 17:44:02.603  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55216281793595
01-14 17:44:02.604  1391  6654 D isp_tuning_custom: [evaluate_Shading_Ratio] sensorid(5656642), preSensorId(5656642), rLSCInfo.SensorMode(2), preSensorMode(2), isSensorOrModeSwitch(0), preLscHwType(0), isHwTypeSwitch(0), isPass2(0), isInit(0), i4Scenario(12), eApp(12), isAIshutter(0), isFlashCapture(0)
01-14 17:44:02.604  1391  6654 D isp_tuning_custom: [iso_smooth][ISO smooth enabled][ISO idx(184)]avgISO = 559.
01-14 17:44:02.604  1391  6654 D isp_tuning_custom: [RA_smooth][RA smooth][frm idx(184)] rto for iso(31), prev_rto(31),RA_incremental_step(2), smoothed ratio(31)
01-14 17:44:02.623  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 26.000000, timestamp = 55216302515820
01-14 17:44:02.637  1391  6710 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.637  1391  6710 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:do_validatePerFrameP2
01-14 17:44:02.646  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216322040969 
01-14 17:44:02.658  6274  6461 I ResizePlugin: Rotation: 0
01-14 17:44:02.659  6274  6461 I ResizePlugin: Mirror not specified, defaulting to: false
01-14 17:44:02.659  6274  6461 I ResizePlugin: Target scale: 192 x 192
01-14 17:44:02.659  6274  6461 I ResizePlugin: Cropping to 720 x 720 at (280, 0)
01-14 17:44:02.659  6274  6461 I ResizePlugin: Target Format: RGB
01-14 17:44:02.659  6274  6461 I ResizePlugin: Target DataType: UINT8
01-14 17:44:02.659  6274  6461 I ResizePlugin: Converting YUV 4:2:0 -> ARGB 8888...
01-14 17:44:02.660  6274  6461 I ResizePlugin: Cropping [0, 0 @ 1280x720] ARGB buffer to [280, 0 @ 720x720]...
01-14 17:44:02.660  6274  6461 I ResizePlugin: Scaling [0, 0 @ 720x720] ARGB buffer to [0, 0 @ 192x192]...
01-14 17:44:02.660  6274  6461 I ResizePlugin: Converting ARGB Buffer to Pixel Format 0...
01-14 17:44:02.660  6274  6461 I SharedArray: Wrapping Java ByteBuffer with size 110592...
01-14 17:44:02.664  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216342072441
01-14 17:44:02.675  2230  2230 D CBR_SystemUI: CarrierLabel - : updateLabel cellMsg:  cellEnabled: true
01-14 17:44:02.676  2230  2230 D CBR_SystemUI: CarrierLabel - : updateLabel mCellBroadcastMessage Visibility: 8
01-14 17:44:02.676  2230  2230 D CBR_SystemUI: CarrierLabel - : updateLabel cellMsg:  cellEnabled: true
01-14 17:44:02.676  2230  2230 D CBR_SystemUI: CarrierLabel - : updateLabel mCellBroadcastMessage Visibility: 8
01-14 17:44:02.677  2230  2230 D StatusBarIconController: ignoring old pipeline callbacks, because the new mobile icons are enabled
01-14 17:44:02.683  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 28.000000, timestamp = 55216362130574
01-14 17:44:02.698  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(IS_MOTCAM), factor_value(0)
01-14 17:44:02.699  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.699  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.699  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.699  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.699  1391  6654 D CcuCtrlAe: [dequeCcuAeStat] m_sensorIdx:0 magic_is_ready:183 query_magic:183 duration_us:0.000000 aeOutputVa:0x7131dcf000 ridx:0 req/key/cwv_y_le/cwv_y_se:185/185/939/950
01-14 17:44:02.702  1391 17028 D MtkCam/ATMsEventMgr: [ATMsEventMgr]set factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.702  1391 17028 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.702  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.702  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.702  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK load matchIndex = 2
01-14 17:44:02.702  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] expected trans. AfeGain: 5119
01-14 17:44:02.702  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] after AlignGainList AfeGain: 5119 IspGain: 4096       
01-14 17:44:02.702  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] - u4Eposuretime:10000 u4AfeGain:5119 u4IspGain:4096 u4ISO:499 u4MiniISO:100 MiniAfeGain:1024 MiniIspGain:4096
01-14 17:44:02.703  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 28.000000, timestamp = 55216381789666
01-14 17:44:02.708  1391  6654 D isp_tuning_custom: [evaluate_Shading_Ratio] sensorid(5656642), preSensorId(5656642), rLSCInfo.SensorMode(2), preSensorMode(2), isSensorOrModeSwitch(0), preLscHwType(0), isHwTypeSwitch(0), isPass2(0), isInit(0), i4Scenario(12), eApp(12), isAIshutter(0), isFlashCapture(0)
01-14 17:44:02.708  1391  6654 D isp_tuning_custom: [iso_smooth][ISO smooth enabled][ISO idx(185)]avgISO = 559.
01-14 17:44:02.708  1391  6654 D isp_tuning_custom: [RA_smooth][RA smooth][frm idx(185)] rto for iso(31), prev_rto(31),RA_incremental_step(2), smoothed ratio(31)
01-14 17:44:02.726  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216402066170 
01-14 17:44:02.728  1055  1102 I libPerfCtl: xgfGetFPS pid:2230 fps:-1
01-14 17:44:02.728  1055  1102 I libPerfCtl: xgfGetFPS pid:6274 fps:14
01-14 17:44:02.733  1391  6710 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.734  1391  6710 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:do_validatePerFrameP2
01-14 17:44:02.743  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216422051781
01-14 17:44:02.753  6274  6461 I ResizePlugin: Rotation: 0
01-14 17:44:02.753  6274  6461 I ResizePlugin: Mirror not specified, defaulting to: false
01-14 17:44:02.753  6274  6461 I ResizePlugin: Target scale: 192 x 192
01-14 17:44:02.753  6274  6461 I ResizePlugin: Cropping to 720 x 720 at (280, 0)
01-14 17:44:02.753  6274  6461 I ResizePlugin: Target Format: RGB
01-14 17:44:02.753  6274  6461 I ResizePlugin: Target DataType: UINT8
01-14 17:44:02.753  6274  6461 I ResizePlugin: Converting YUV 4:2:0 -> ARGB 8888...
01-14 17:44:02.754  6274  6461 I ResizePlugin: Cropping [0, 0 @ 1280x720] ARGB buffer to [280, 0 @ 720x720]...
01-14 17:44:02.755  6274  6461 I ResizePlugin: Scaling [0, 0 @ 720x720] ARGB buffer to [0, 0 @ 192x192]...
01-14 17:44:02.755  6274  6461 I ResizePlugin: Converting ARGB Buffer to Pixel Format 0...
01-14 17:44:02.755  6274  6461 I SharedArray: Wrapping Java ByteBuffer with size 110592...
01-14 17:44:02.763  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216442220300
01-14 17:44:02.784  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 28.000000, timestamp = 55216462066483
01-14 17:44:02.799  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(IS_MOTCAM), factor_value(0)
01-14 17:44:02.799  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.799  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.799  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.799  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.799  1391  6654 D CcuCtrlAe: [dequeCcuAeStat] m_sensorIdx:0 magic_is_ready:184 query_magic:184 duration_us:0.000000 aeOutputVa:0x7131df9ab0 ridx:1 req/key/cwv_y_le/cwv_y_se:186/186/971/982
01-14 17:44:02.804  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.804  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.804  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK load matchIndex = 2
01-14 17:44:02.804  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] expected trans. AfeGain: 5119 
01-14 17:44:02.804  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] after AlignGainList AfeGain: 5119 IspGain: 4096       
01-14 17:44:02.804  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] - u4Eposuretime:10000 u4AfeGain:5119 u4IspGain:4096 u4ISO:499 u4MiniISO:100 MiniAfeGain:1024 MiniIspGain:4096
01-14 17:44:02.804  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 28.000000, timestamp = 55216481778161
01-14 17:44:02.806  1391  1843 D MtkCam/ATMsEventMgr: [ATMsEventMgr]set factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.806  1391  1843 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.808  1391  6654 D isp_tuning_custom: [evaluate_Shading_Ratio] sensorid(5656642), preSensorId(5656642), rLSCInfo.SensorMode(2), preSensorMode(2), isSensorOrModeSwitch(0), preLscHwType(0), isHwTypeSwitch(0), isPass2(0), isInit(0), i4Scenario(12), eApp(12), isAIshutter(0), isFlashCapture(0)
01-14 17:44:02.808  1391  6654 D isp_tuning_custom: [iso_smooth][ISO smooth enabled][ISO idx(186)]avgISO = 559.
01-14 17:44:02.808  1391  6654 D isp_tuning_custom: [RA_smooth][RA smooth][frm idx(186)] rto for iso(31), prev_rto(31),RA_incremental_step(2), smoothed ratio(31)
01-14 17:44:02.823  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 28.000000, timestamp = 55216502231334
01-14 17:44:02.840  1391  6710 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.840  1391  6710 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:do_validatePerFrameP2
01-14 17:44:02.843  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 28.000000, timestamp = 55216522069763 
01-14 17:44:02.862  6274  6461 I ResizePlugin: Rotation: 0
01-14 17:44:02.862  6274  6461 I ResizePlugin: Mirror not specified, defaulting to: false
01-14 17:44:02.862  6274  6461 I ResizePlugin: Target scale: 192 x 192
01-14 17:44:02.862  6274  6461 I ResizePlugin: Cropping to 720 x 720 at (280, 0)
01-14 17:44:02.862  6274  6461 I ResizePlugin: Target Format: RGB
01-14 17:44:02.862  6274  6461 I ResizePlugin: Target DataType: UINT8
01-14 17:44:02.862  6274  6461 I ResizePlugin: Converting YUV 4:2:0 -> ARGB 8888...
01-14 17:44:02.863  6274  6461 I ResizePlugin: Cropping [0, 0 @ 1280x720] ARGB buffer to [280, 0 @ 720x720]...
01-14 17:44:02.863  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 29.000000, timestamp = 55216542050041
01-14 17:44:02.863  6274  6461 I ResizePlugin: Scaling [0, 0 @ 720x720] ARGB buffer to [0, 0 @ 192x192]...
01-14 17:44:02.864  6274  6461 I ResizePlugin: Converting ARGB Buffer to Pixel Format 0...
01-14 17:44:02.864  6274  6461 I SharedArray: Wrapping Java ByteBuffer with size 110592...
01-14 17:44:02.884  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 29.000000, timestamp = 55216562617425
01-14 17:44:02.899  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(IS_MOTCAM), factor_value(0)
01-14 17:44:02.899  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.899  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.899  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.899  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.899  1391  6654 D CcuCtrlAe: [dequeCcuAeStat] m_sensorIdx:0 magic_is_ready:185 query_magic:185 duration_us:0.000000 aeOutputVa:0x7131dcf000 ridx:0 req/key/cwv_y_le/cwv_y_se:187/187/1008/1021
01-14 17:44:02.901  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.901  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:02.901  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK load matchIndex = 2
01-14 17:44:02.901  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] expected trans. AfeGain: 5119
01-14 17:44:02.901  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] after AlignGainList AfeGain: 5119 IspGain: 4096       
01-14 17:44:02.901  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] - u4Eposuretime:10000 u4AfeGain:5119 u4IspGain:4096 u4ISO:499 u4MiniISO:100 MiniAfeGain:1024 MiniIspGain:4096
01-14 17:44:02.901  1391 17333 D MtkCam/ATMsEventMgr: [ATMsEventMgr]set factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.901  1391 17333 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.903  1391  6654 D isp_tuning_custom: [evaluate_Shading_Ratio] sensorid(5656642), preSensorId(5656642), rLSCInfo.SensorMode(2), preSensorMode(2), isSensorOrModeSwitch(0), preLscHwType(0), isHwTypeSwitch(0), isPass2(0), isInit(0), i4Scenario(12), eApp(12), isAIshutter(0), isFlashCapture(0)
01-14 17:44:02.903  1391  6654 D isp_tuning_custom: [iso_smooth][ISO smooth enabled][ISO idx(187)]avgISO = 559.
01-14 17:44:02.903  1391  6654 D isp_tuning_custom: [RA_smooth][RA smooth][frm idx(187)] rto for iso(31), prev_rto(31),RA_incremental_step(2), smoothed ratio(31)
01-14 17:44:02.904  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 29.000000, timestamp = 55216581968550
01-14 17:44:02.906  6274  6581 I MediaCodec: [0xb400007922e3a410] enqueue 60 input frames in last 1000 ms, latest timeUs 1000029813816
01-14 17:44:02.925  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 29.000000, timestamp = 55216602046728 
01-14 17:44:02.933  1079  1079 I BufferQueueProducer: [com.pronisi.slamdunkai.debug/com.pronisi.slamdunkai.debug.MainActivity#14340](this:0xb400006d59d6c6d8,id:-1,api:0,p:-1,c:1079) queueBuffer: fps=11.07 dur=1084.27 max=183.77 min=16.60
01-14 17:44:02.935  1391  6710 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.936  1391  6710 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:do_validatePerFrameP2
01-14 17:44:02.936  1015  1015 I hwcomposer: [HWCDisplay] [Display_0 (type:1)] fps:11.070252,dur:1083.99,max:184.15,min:16.49
01-14 17:44:02.943  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 28.000000, timestamp = 55216622068349 
01-14 17:44:02.957  6274  6461 I ResizePlugin: Rotation: 0
01-14 17:44:02.957  6274  6461 I ResizePlugin: Mirror not specified, defaulting to: false
01-14 17:44:02.957  6274  6461 I ResizePlugin: Target scale: 192 x 192
01-14 17:44:02.957  6274  6461 I ResizePlugin: Cropping to 720 x 720 at (280, 0)
01-14 17:44:02.957  6274  6461 I ResizePlugin: Target Format: RGB
01-14 17:44:02.957  6274  6461 I ResizePlugin: Target DataType: UINT8
01-14 17:44:02.957  6274  6461 I ResizePlugin: Converting YUV 4:2:0 -> ARGB 8888...
01-14 17:44:02.958  6274  6461 I ResizePlugin: Cropping [0, 0 @ 1280x720] ARGB buffer to [280, 0 @ 720x720]...
01-14 17:44:02.959  6274  6461 I ResizePlugin: Scaling [0, 0 @ 720x720] ARGB buffer to [0, 0 @ 192x192]...
01-14 17:44:02.959  6274  6461 I ResizePlugin: Converting ARGB Buffer to Pixel Format 0...
01-14 17:44:02.959  6274  6461 I SharedArray: Wrapping Java ByteBuffer with size 110592...
01-14 17:44:02.964  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 29.000000, timestamp = 55216642120017
01-14 17:44:02.983  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216662046556 
01-14 17:44:02.994  1756  1779 E ApplicationHelper: Fail to get PackageManager
01-14 17:44:02.994  1756  2450 W ProcessStats: Tracking association SourceState{527b65e com.google.android.gms.persistent/10176 Fgs #268696} whose proc state 3 is better than process ProcessState{4f281c4 com.mgoogle.android.gms/10456 pkg=com.mgoogle.android.gms} proc state 14 (0 skipped)
01-14 17:44:02.998  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(IS_MOTCAM), factor_value(0)
01-14 17:44:02.999  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.999  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.999  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:02.999  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:02.999  1391  6654 D CcuCtrlAe: [dequeCcuAeStat] m_sensorIdx:0 magic_is_ready:186 query_magic:186 duration_us:0.000000 aeOutputVa:0x7131df9ab0 ridx:1 req/key/cwv_y_le/cwv_y_se:188/188/1023/1036
01-14 17:44:03.000  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:03.000  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:03.000  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK load matchIndex = 2
01-14 17:44:03.000  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] expected trans. AfeGain: 5119
01-14 17:44:03.000  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] after AlignGainList AfeGain: 5119 IspGain: 4096       
01-14 17:44:03.000  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] - u4Eposuretime:10000 u4AfeGain:5119 u4IspGain:4096 u4ISO:499 u4MiniISO:100 MiniAfeGain:1024 MiniIspGain:4096
01-14 17:44:03.001  1391  1843 D MtkCam/ATMsEventMgr: [ATMsEventMgr]set factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:03.001  1391  1843 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:03.003  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216681787761
01-14 17:44:03.006  1391  6654 D isp_tuning_custom: [evaluate_Shading_Ratio] sensorid(5656642), preSensorId(5656642), rLSCInfo.SensorMode(2), preSensorMode(2), isSensorOrModeSwitch(0), preLscHwType(0), isHwTypeSwitch(0), isPass2(0), isInit(0), i4Scenario(12), eApp(12), isAIshutter(0), isFlashCapture(0)
01-14 17:44:03.006  1391  6654 D isp_tuning_custom: [iso_smooth][ISO smooth enabled][ISO idx(188)]avgISO = 559.
01-14 17:44:03.006  1391  6654 D isp_tuning_custom: [RA_smooth][RA smooth][frm idx(188)] rto for iso(31), prev_rto(31),RA_incremental_step(2), smoothed ratio(31)
01-14 17:44:03.021  1391  6693 I MtkCam/fdNodeImp: [RunFaceDetection] check FD frame timestamp : 49778078599000
01-14 17:44:03.021  1391  6693 I MtkCam/fdNodeImp: [RunFaceDetection] check FD count : 367, duration : 100
01-14 17:44:03.023  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 29.000000, timestamp = 55216702453848
01-14 17:44:03.037  1391  6710 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:03.037  1391  6710 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:do_validatePerFrameP2
01-14 17:44:03.043  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 29.000000, timestamp = 55216722035180 
01-14 17:44:03.051  6274  6274 W ionCamera.video: type=1400 audit(0.0:362532): avc:  denied  { getattr } for  name="dmabuf:" dev="dmabuf" ino=1 scontext=u:r:untrusted_app:s0:c91,c258,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=com.pronisi.slamdunkai.debug
01-14 17:44:03.058  6274  6461 I ResizePlugin: Rotation: 0
01-14 17:44:03.058  6274  6461 I ResizePlugin: Mirror not specified, defaulting to: false
01-14 17:44:03.058  6274  6461 I ResizePlugin: Target scale: 192 x 192
01-14 17:44:03.058  6274  6461 I ResizePlugin: Cropping to 720 x 720 at (280, 0)
01-14 17:44:03.058  6274  6461 I ResizePlugin: Target Format: RGB
01-14 17:44:03.058  6274  6461 I ResizePlugin: Target DataType: UINT8
01-14 17:44:03.058  6274  6461 I ResizePlugin: Converting YUV 4:2:0 -> ARGB 8888...
01-14 17:44:03.060  6274  6461 I ResizePlugin: Cropping [0, 0 @ 1280x720] ARGB buffer to [280, 0 @ 720x720]...
01-14 17:44:03.060  6274  6461 I ResizePlugin: Scaling [0, 0 @ 720x720] ARGB buffer to [0, 0 @ 192x192]...
01-14 17:44:03.060  6274  6461 I ResizePlugin: Converting ARGB Buffer to Pixel Format 0...
01-14 17:44:03.061  6274  6461 I SharedArray: Wrapping Java ByteBuffer with size 110592...
01-14 17:44:03.063  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 29.000000, timestamp = 55216742064392
01-14 17:44:03.083  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 29.000000, timestamp = 55216761774527 
01-14 17:44:03.099  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(IS_MOTCAM), factor_value(0)
01-14 17:44:03.099  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:03.099  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:03.099  1391  6654 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:03.099  1391  6654 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:hal3araw_postcommand
01-14 17:44:03.099  1391  6654 D CcuCtrlAe: [dequeCcuAeStat] m_sensorIdx:0 magic_is_ready:187 query_magic:187 duration_us:0.000000 aeOutputVa:0x7131dcf000 ridx:0 req/key/cwv_y_le/cwv_y_se:189/189/1017/1030
01-14 17:44:03.100  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:03.100  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK debug tuning str_debug is unknow, str_area is retin
01-14 17:44:03.100  1391  6654 D CAM_CUS_MSDK: CAM_CUS_MSDK load matchIndex = 2
01-14 17:44:03.100  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] expected trans. AfeGain: 5119
01-14 17:44:03.100  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] after AlignGainList AfeGain: 5119 IspGain: 4096       
01-14 17:44:03.100  1391  6654 D camerahalserver: [transBinSum_motlyriqov50amipirawrow()] - u4Eposuretime:10000 u4AfeGain:5119 u4IspGain:4096 u4ISO:499 u4MiniISO:100 MiniAfeGain:1024 MiniIspGain:4096
01-14 17:44:03.101  1391  1842 D MtkCam/ATMsEventMgr: [ATMsEventMgr]set factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:03.101  1391  1842 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:03.103  1391  6654 D isp_tuning_custom: [evaluate_Shading_Ratio] sensorid(5656642), preSensorId(5656642), rLSCInfo.SensorMode(2), preSensorMode(2), isSensorOrModeSwitch(0), preLscHwType(0), isHwTypeSwitch(0), isPass2(0), isInit(0), i4Scenario(12), eApp(12), isAIshutter(0), isFlashCapture(0)
01-14 17:44:03.103  1391  6654 D isp_tuning_custom: [iso_smooth][ISO smooth enabled][ISO idx(189)]avgISO = 559.
01-14 17:44:03.103  1391  6654 D isp_tuning_custom: [RA_smooth][RA smooth][frm idx(189)] rto for iso(31), prev_rto(31),RA_incremental_step(2), smoothed ratio(31)
01-14 17:44:03.103  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216782076902
01-14 17:44:03.117  1391  6735 I FlickerAlgo: [DoCmdDetect] type(0) n_win_h(3) n_win_w(6) win_wd(682) win_ht(758) cur_freq(50) time_diff(0) score_50(0) score_60(-3) result_status(2)
01-14 17:44:03.123  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 29.000000, timestamp = 55216802061917
01-14 17:44:03.125  6274  6581 I MediaCodec: [0xb400007922e3a410] dequeue 61 output frames in last 1007 ms, latest timeUs 1000029863866, flags 128
01-14 17:44:03.140  1391  6710 D MtkCam/ATMsEventMgr: [HIDL]get factor(APP_NAME), factor_value(3rd_party)
01-14 17:44:03.140  1391  6710 D isp_tuning_custom: lyriq 3rd debug width:1280 height:720 from:do_validatePerFrameP2
01-14 17:44:03.143  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 27.000000, timestamp = 55216822043109
01-14 17:44:03.160  6274  6758 I CameraView: invokeOnAverageFpsChanged(10.044642857142858)
01-14 17:44:03.163  1023  1173 I HfLooper: LIGHT_SENSOR_LIGHT_1 lux = 28.000000, timestamp = 55216842227701
01-14 17:44:03.159  6274  6274 W ionCamera.video: type=1400 audit(0.0:362533): avc:  denied  { getattr } for  name="dmabuf:" dev="dmabuf" ino=1 scontext=u:r:untrusted_app:s0:c91,c258,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=com.pronisi.slamdunkai.debug

Camera Device

{
  "formats": [],
  "sensorOrientation": "landscape-left",
  "hardwareLevel": "full",
  "maxZoom": 8,
  "minZoom": 1,
  "maxExposure": 24,
  "supportsLowLightBoost": false,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": false,
  "isMultiCam": false,
  "minFocusDistance": 12.000000457763688,
  "minExposure": -24,
  "name": "0 (BACK) androidx.camera.camera2",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"
}

Device

Motorola Edge 40

VisionCamera Version

^4.6.3

Can you reproduce this issue in the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

@DragonDare DragonDare added the 🐛 bug Something isn't working label Jan 14, 2025
Copy link

Guten Tag, Hans here!

Thank you for providing a detailed description of your issue along with relevant logs and code. It seems like you're experiencing a valid concern with using the Skia Frame Processor in your application.

In order to better assist mrousavy in investigating this issue, it would be helpful to try reproducing the problem in the VisionCamera Example app. If you haven’t already, please give that a shot! Additionally, it might be beneficial to ensure you have the latest version of all related packages, as updates can sometimes resolve these kinds of conflicts.

If the issue persists after that, feel free to provide any further details about your testing environment. 🍻

Note: If you think I made a mistake, please ping @mrousavy to take a look.

@maxximee
Copy link

Having same issue, I think a lot of people are. I think react-native-vision-camera should update its skia dependency from current 1.4.2 to at least 1.7.4 where this issue was addressed, ideally > 1.7.7

@DragonDare

This comment has been minimized.

@maxximee
Copy link

This is a critical issue, useSkiaFrameProcessor is currently not usable.
My mistake for not testing on enough devices but I released and it tanked my google reviews and got over 1k crashes in a day because of this. I've now disabled useSkiaFrameProcessor to lessen the damage but my reviews have taken a very bad hit

@DragonDare
Copy link
Author

@maxximee have u tried on 1.7.7 yet as @wcandillon advised?

@maxximee
Copy link

@maxximee have u tried on 1.7.7 yet as @wcandillon advised?

I've forked the project and updated skia dependency, but having hard time compiling it

  ld.lld: error: undefined symbol: typeinfo for RNWorklet::JsiHostObject
  >>> referenced by JVisionCameraProxy.cpp
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessors/java-bindings/JVisionCameraProxy.cpp.o:(typeinfo for RNWorklet::JsiWorklet)
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

@DragonDare
Copy link
Author

@maxximee have u tried on 1.7.7 yet as @wcandillon advised?

I've forked the project and updated skia dependency, but having hard time compiling it

  ld.lld: error: undefined symbol: typeinfo for RNWorklet::JsiHostObject
  >>> referenced by JVisionCameraProxy.cpp
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessors/java-bindings/JVisionCameraProxy.cpp.o:(typeinfo for RNWorklet::JsiWorklet)
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

i just tried with 1.7.7, doesnt change anything. Same problem.

@wcandillon
Copy link

@mrousavy should we have a look? On our side things are pretty stable and we have new capabilities related to texture sharing with third-party, maybe we can do a refresh

@mrousavy
Copy link
Owner

Hmm, maybe it's an orientation thing? Maybe it tries to render in a wrong orientation? In that case, it'd be the fault of the CameraX implementation on this specific android device reporting a wrong orientation. You can play around with this switch in the VisionCamera useSkiaFrameProcessor code:

const orientation = relativeTo(frame.orientation, previewOrientation)
switch (orientation) {
case 'portrait':
// do nothing
break
case 'landscape-left':
// rotate two flips on (0,0) origin and move X + Y into view again
canvas.translate(frame.height, frame.width)
canvas.rotate(270, 0, 0)
break
case 'portrait-upside-down':
// rotate three flips on (0,0) origin and move Y into view again
canvas.translate(frame.width, frame.height)
canvas.rotate(180, 0, 0)
break
case 'landscape-right':
// rotate one flip on (0,0) origin and move X into view again
canvas.translate(frame.height, 0)
canvas.rotate(90, 0, 0)
break
default:
throw new Error(`Invalid frame.orientation: ${frame.orientation}!`)
}

If none of those options render properly, it migth actually be a texture issue.

@DragonDare
Copy link
Author

Hmm, maybe it's an orientation thing? Maybe it tries to render in a wrong orientation? In that case, it'd be the fault of the CameraX implementation on this specific android device reporting a wrong orientation. You can play around with this switch in the VisionCamera useSkiaFrameProcessor code:

const orientation = relativeTo(frame.orientation, previewOrientation)
switch (orientation) {
case 'portrait':
// do nothing
break
case 'landscape-left':
// rotate two flips on (0,0) origin and move X + Y into view again
canvas.translate(frame.height, frame.width)
canvas.rotate(270, 0, 0)
break
case 'portrait-upside-down':
// rotate three flips on (0,0) origin and move Y into view again
canvas.translate(frame.width, frame.height)
canvas.rotate(180, 0, 0)
break
case 'landscape-right':
// rotate one flip on (0,0) origin and move X into view again
canvas.translate(frame.height, 0)
canvas.rotate(90, 0, 0)
break
default:
throw new Error(`Invalid frame.orientation: ${frame.orientation}!`)
}

If none of those options render properly, it migth actually be a texture issue.

But will the orientation issue result in the camera screen turning to black?

@maxximee
Copy link

Hmm, maybe it's an orientation thing? Maybe it tries to render in a wrong orientation? In that case, it'd be the fault of the CameraX implementation on this specific android device reporting a wrong orientation. You can play around with this switch in the VisionCamera useSkiaFrameProcessor code:

const orientation = relativeTo(frame.orientation, previewOrientation)
switch (orientation) {
case 'portrait':
// do nothing
break
case 'landscape-left':
// rotate two flips on (0,0) origin and move X + Y into view again
canvas.translate(frame.height, frame.width)
canvas.rotate(270, 0, 0)
break
case 'portrait-upside-down':
// rotate three flips on (0,0) origin and move Y into view again
canvas.translate(frame.width, frame.height)
canvas.rotate(180, 0, 0)
break
case 'landscape-right':
// rotate one flip on (0,0) origin and move X into view again
canvas.translate(frame.height, 0)
canvas.rotate(90, 0, 0)
break
default:
throw new Error(`Invalid frame.orientation: ${frame.orientation}!`)
}

If none of those options render properly, it migth actually be a texture issue.

I've found this patch in another post, tried it but doesn't resolve the black screen.
@mrousavy I think it's what has been fixed in here: Shopify/react-native-skia#2801 . vision-camera still uses skia 1.4.2

@mrousavy
Copy link
Owner

vision-camera still uses skia 1.4.2

No. VisionCamera has a peerDependency on Skia which is set to * - that means whatever version of RN Skia you install, will be used. If you install 1.7.7. in your app, it will use 1.7.7.

@mrousavy
Copy link
Owner

But will the orientation issue result in the camera screen turning to black?

It could be, because if the wrong orientation is rendered, the canvas is translated and rotated by the wrong amount, resulting the Frame being drawn outside the visible bounds. Thats why I'm asking you to test this.

@maxximee
Copy link

maxximee commented Jan 15, 2025

But will the orientation issue result in the camera screen turning to black?

It could be, because if the wrong orientation is rendered, the canvas is translated and rotated by the wrong amount, resulting the Frame being drawn outside the visible bounds. Thats why I'm asking you to test this.

Didn't help with the black screen. Note on samsung galaxy s22 / s24 it causes thousands of null pointer crashes:
image

Detailed logs are exactly the same as in Shopify/react-native-skia#2800

@wcandillon
Copy link

the crashes on samsung galaxy s22 / s24 has been fixed right?

@maxximee
Copy link

maxximee commented Jan 15, 2025

the crashes on samsung galaxy s22 / s24 has been fixed right?

In skia > 1.7.4 yes. But vision-camera uses skia 1.4.2 so it's still there.

I can use skia in my app, but "useSkiaFrameProcessor" in the vision-camera crashes

@DragonDare
Copy link
Author

the crashes on samsung galaxy s22 / s24 has been fixed right?

In skia > 1.7.4 yes. But vision-camera uses skia 1.4.2 so it's still there.

I can use skia in my app, but "useSkiaFrameProcessor" in the vision-camera crashes

vision-camera still uses skia 1.4.2

No. VisionCamera has a peerDependency on Skia which is set to * - that means whatever version of RN Skia you install, will be used. If you install 1.7.7. in your app, it will use 1.7.7.

@maxximee
Copy link

the crashes on samsung galaxy s22 / s24 has been fixed right?

In skia > 1.7.4 yes. But vision-camera uses skia 1.4.2 so it's still there.
I can use skia in my app, but "useSkiaFrameProcessor" in the vision-camera crashes

vision-camera still uses skia 1.4.2

No. VisionCamera has a peerDependency on Skia which is set to * - that means whatever version of RN Skia you install, will be used. If you install 1.7.7. in your app, it will use 1.7.7.

Good point, 1.4.2 is actually the devDependency. So am not sure why I get all those crashes in my current build with now skia 1.10.1

@mrousavy
Copy link
Owner

But vision-camera uses skia 1.4.2 so it's still there

I just told you - you can use whatever Skia version you want with VisionCamera. It doesn't use 1.4.2.

@DragonDare
Copy link
Author

DragonDare commented Jan 15, 2025

Hmm, maybe it's an orientation thing? Maybe it tries to render in a wrong orientation? In that case, it'd be the fault of the CameraX implementation on this specific android device reporting a wrong orientation. You can play around with this switch in the VisionCamera useSkiaFrameProcessor code:

const orientation = relativeTo(frame.orientation, previewOrientation)
switch (orientation) {
case 'portrait':
// do nothing
break
case 'landscape-left':
// rotate two flips on (0,0) origin and move X + Y into view again
canvas.translate(frame.height, frame.width)
canvas.rotate(270, 0, 0)
break
case 'portrait-upside-down':
// rotate three flips on (0,0) origin and move Y into view again
canvas.translate(frame.width, frame.height)
canvas.rotate(180, 0, 0)
break
case 'landscape-right':
// rotate one flip on (0,0) origin and move X into view again
canvas.translate(frame.height, 0)
canvas.rotate(90, 0, 0)
break
default:
throw new Error(`Invalid frame.orientation: ${frame.orientation}!`)
}

If none of those options render properly, it migth actually be a texture issue.

So my device was reporting orientation as 'landscape-right' and I played around with that switch statement as you said. As in put other orientations' cases' in landscape-right's switch but all it did was either rotate my stick figure or not display it at all. The Camera screen is still black tho.

Another interesting observation, your Skia Vision Camera Demo github repo is showing my device orientation to be 'landscape-left', instead of' landscape-right', like in my own project. Does this have to do with the older version of vision camera + skia in your repo?

Also, there is a discrepancy between what vision camera tells my orientation is and what SkiaFrameProcessor tell my frame orientation is. VisCam says 'portrait', but SkiaFP says my frame is at 'landscape-right' at the same time. Why so?

@DragonDare
Copy link
Author

@mrousavy @wcandillon any updates on this issue?

@whalemare
Copy link

We discovered same issue after upgrading react-native, vision-camera, skia, worklet-core to the latest versions.
We don't use useSkiaFrameProcessor at all, but using codeScanner prop

This setup is showing white screen on preview:

    "react-native": "0.76.6",
    "@shopify/react-native-skia": "1.5.0",
    "react-native-worklets-core": "1.5.0",
    "react-native-vision-camera": "4.6.3",

This one (from your example) works perfectly:

    "react-native": "^0.75.4",
    "react-native-worklets-core": "^1.3.3",
    "@shopify/react-native-skia": "^1.4.2",
    "react-native-vision-camera": "4.6.3",

I can do any action if you need, like logs, device info, screenshots, reproducible demo etc.

@usamaabutt
Copy link

I am getting a black screen error on the Android RedMe 10C device while using the Skia frame processor. I am getting this error in the onError callback from the vision Camera tag.

session/recoverable-error: An unknown error occurred while creating the Camera Session, but the Camera can recover from it.

Image

@gonzaloripa
Copy link

In my case SkiaFrameProcessor is reporting 'landscape-left' when my phone is in 'portrait' orientation. I noticed that the black screen dissapeared when I rotates the phone, and modifying the canvas translation parameters for 'landscape-left' switch case did the trick:

case 'landscape-left':
        // rotate two flips on (0,0) origin and move X + Y into view again
        canvas.translate(0, frame.width)
        canvas.rotate(270, 0, 0)
        break

@DragonDare
Copy link
Author

In my case SkiaFrameProcessor is reporting 'landscape-left' when my phone is in 'portrait' orientation. I noticed that the black screen dissapeared when I rotates the phone, and modifying the canvas translation parameters for 'landscape-left' switch case did the trick:

case 'landscape-left':
        // rotate two flips on (0,0) origin and move X + Y into view again
        canvas.translate(0, frame.width)
        canvas.rotate(270, 0, 0)
        break

on what basis did you do the changes? What were the calculations involved?

@maxximee
Copy link

In my case SkiaFrameProcessor is reporting 'landscape-left' when my phone is in 'portrait' orientation. I noticed that the black screen dissapeared when I rotates the phone, and modifying the canvas translation parameters for 'landscape-left' switch case did the trick:

case 'landscape-left':
        // rotate two flips on (0,0) origin and move X + Y into view again
        canvas.translate(0, frame.width)
        canvas.rotate(270, 0, 0)
        break

on what basis did you do the changes? What were the calculations involved?

I've seen this patch on a few other github issues, tried it but didn't fix black screen for me.

@DragonDare
Copy link
Author

In my case SkiaFrameProcessor is reporting 'landscape-left' when my phone is in 'portrait' orientation. I noticed that the black screen dissapeared when I rotates the phone, and modifying the canvas translation parameters for 'landscape-left' switch case did the trick:

case 'landscape-left':
        // rotate two flips on (0,0) origin and move X + Y into view again
        canvas.translate(0, frame.width)
        canvas.rotate(270, 0, 0)
        break

on what basis did you do the changes? What were the calculations involved?

I've seen this patch on a few other github issues, tried it but didn't fix black screen for me.

same, reversing the translation and rotation didnt remove the black screen for me

@DragonDare
Copy link
Author

@mrousavy @wcandillon could we please get any updates on this issue? Is that something which is worked on for the next package version or it won't be? I'm running this on a production app, it's affecting us quite a lot.

@mrousavy
Copy link
Owner

mrousavy commented Jan 18, 2025

@mrousavy @wcandillon could we please get any updates on this issue? Is that something which is worked on for the next package version or it won't be? I'm running this on a production app, it's affecting us quite a lot.

@DragonDare if you're running this in a production app and your business depends on this, maybe you should consider supporting me or William through GitHub sponsors or finding an enterprise support plan that works for you.
The more people that would do this, the more time I can dedicate to build software like this for you and everyone.

I am not working on a fix for this in the next few days, I suggested what I thought could be the issue (rotation switch/case, try playing with that!), but I don't have time to work on this as my priority is focused towards Nitro right now.
If anyone finds a fix (or wants to pay me to fix this) , we can find a solution that works for everyone :)

@mrousavy
Copy link
Owner

Also - we don't know yet if it is a RN Skia or a VisionCamera bug. We'd need to figure out if the texture (SkImage) is being created successfully - if not, it's a Skia bug, if yes it's a VisionCamera bug (because apparently we don't render it correctly later on)

@DragonDare
Copy link
Author

everyone

I see. I'll surely look into if my company can hop on one of the enterprise plans. I understand why it won't be your priority right now.

Also, I did play with the orientation switch cases, it didn't help except just rotate my stick figure to the correct position, which is portrait. Earlier it was showing in landscape-right even if I was holding phone in portrait. Still getting the black screen nonetheless.

@maxximee
Copy link

maxximee commented Jan 19, 2025

My productive app is free and not bringing me anything, so I don't have any money to put in the plugin sadly. I did add a very ugly workaround for android, basically disabling the skia frame processor by default, that means users won't see negative films in the correct colors but it's better than a black screen.
I hope to find time to see if I can debug the plugin to find the source of the error, but from what I see it's something to do with " Failed to convert NativeBuffer to SkImage!". Full message:
Frame Processor Error: Exception in HostFunction: Failed to convert NativeBuffer to SkImage!, js engine: VisionCamera, stack: useSkiaFrameProcessorTs7@1:167 useSkiaFrameProcessorTs10@1:282 withFrameRefCountingTs1@1:161

@mrousavy
Copy link
Owner

but from what I see it's something to do with " Failed to convert NativeBuffer to SkImage!".

Oh I didn't see this - well that's definitely coming from react-native-skia, see MakeImageFromNativeBuffer(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants