mrousavy / react-native-vision-camera

๐Ÿ“ธ A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.37k stars 1.08k forks source link

๐Ÿ› Camera preview doesn't show the full image even with resizeMode='contain' #2954

Closed tomerh2001 closed 3 months ago

tomerh2001 commented 3 months ago

What's happening?

https://github.com/mrousavy/react-native-vision-camera/assets/45624804/a1124b39-7aed-4ff4-a2b5-59cc260f867f

Notice the "Razer" logo on my laptop; in the preview, it's almost at the bottom, but when I grab a photo, I can see the sticker below it and nearly the keyboard

Reproduceable Code

import ImageUtils from 'react-native-photo-manipulator';

const [isCameraInitialized, setIsCameraInitialized] = useState(Platform.OS !== 'ios');
const [cameraLayout, setCameraLayout] = useState({});
const [isCameraActive, setIsCameraActive] = useState(false);
const [reviewImage, setReviewImage] = useState(null);

const {hasPermission, requestPermission} = useCameraPermission();
const device = useCameraDevice('back');
const format = useCameraFormat(device, Templates.FrameProcessing);
const camera = useRef();

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

    frame.render();
    const paint = Skia.Paint();
    paint.setColor(Skia.Color(Colors.yellow));
    paint.setStyle(PaintStyle.Stroke);
    paint.setStrokeWidth(8);

    frame.drawRect({
        x: RECT_PERCENTAGE.x1 * frame.width,
        y: RECT_PERCENTAGE.y1 * frame.height,
        width: (RECT_PERCENTAGE.x2 - RECT_PERCENTAGE.x1) * frame.width,
        height: (RECT_PERCENTAGE.y2 - RECT_PERCENTAGE.y1) * frame.height,
    }, paint);
},
[
    isCameraInitialized,
    isCameraActive,
    setIsCameraActiveWorklet,
]);

async function grabImage(autoDetected) {
    if (!isCameraInitialized || !isCameraActive || !camera?.current) {
        return;
    }

    try {
        const photo = await camera?.current.takePhoto({enableShutterSound: true});
        const croppedPhotoPath = await ImageUtils.crop('file://' + photo.path, {
            x: RECT_PERCENTAGE.x1 * photo.width,
            y: 0,
            width: photo.width,
            height: photo.height,
        });
        const base64 = await Image.compress(croppedPhotoPath, {
            input: 'uri',
            returnableOutputType: 'base64',
            quality: 0.9,
        });

        setIsCameraActiveWorklet(false);
        setReviewImageWorklet({autoDetected, base64, ...photo});
    } catch (error) {
        console.error(error);
        crashlyticsRecordErrorWorklet(new Error(error));
    }
}

<Camera
    ref={camera}
    photo
    isActive={isCameraActive}
    style={styles.camera}
    device={device}
    pixelFormat='yuv'
    frameProcessor={frameProcessor}
    format={format}
    resizeMode='contain'
    outputOrientation='landscape-right'
    {...properties}
    onLayout={event => setCameraLayout(event.nativeEvent.layout)}
    onInitialized={() => setIsCameraInitialized(true)}
/>

### Relevant log output

```shell
$ adb logcat | grep -e camera -e vision
06-09 18:24:38.027   913 27495 I Lyric   : auto_focus_meta_node.cc:150: The camera_id = 2; The total number of frames received after exposure time is 909
06-09 18:24:43.016   913 27495 I Lyric   : auto_focus_meta_node.cc:150: The camera_id = 2; The total number of frames received after exposure time is 1058
06-09 18:24:48.004   913 27495 I Lyric   : auto_focus_meta_node.cc:150: The camera_id = 2; The total number of frames received after exposure time is 1207
06-09 18:24:49.792  1383  1535 W ProcessStats: Tracking association SourceState{45c2060 com.xmobile/10529 Top #17039} whose proc state 1 is better than process ProcessState{d439920 com.google.android.apps.camera.services/10193 pkg=com.google.android.apps.camera.services} proc state 15 (46 skipped)
06-09 18:24:53.025   913 27495 I Lyric   : auto_focus_meta_node.cc:150: The camera_id = 2; The total number of frames received after exposure time is 1357
06-09 18:24:58.014   913 27495 I Lyric   : auto_focus_meta_node.cc:150: The camera_id = 2; The total number of frames received after exposure time is 1506
06-09 18:24:59.816  1383  1871 W ProcessStats: Tracking association SourceState{45c2060 com.xmobile/10529 Top #17114} whose proc state 1 is better than process ProcessState{d439920 com.google.android.apps.camera.services/10193 pkg=com.google.android.apps.camera.services} proc state 15 (1535 skipped)
06-09 18:25:03.003   913 27495 I Lyric   : auto_focus_meta_node.cc:150: The camera_id = 2; The total number of frames received after exposure time is 1655
06-09 18:25:08.024   913 27495 I Lyric   : auto_focus_meta_node.cc:150: The camera_id = 2; The total number of frames received after exposure time is 1805
06-09 18:25:09.284   913   913 I Lyric   : camera_device_session_hwl_impl.cc:1198: Flush entered, camera_id: 0
06-09 18:25:09.284   913   913 I Lyric   : camera_device_session_manager_base.cc:1243: Attempting to flush graph:top_graph_for_camera_RearMultiFov
06-09 18:25:09.285   913 27472 W Lyric   : camera_interface_node.cc:933: cam2_camera_interface to drop frame 1844 framework request id 1844 due to front end abort processing or still recovering: ABORTED: graph flush; Error signaled on ready-to-start for fence #0; whi-front-end-controller: Wait the ready-to-process fence failed!
06-09 18:25:09.286   913 27496 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: RearMultiFov, request id: 1843, partial result count: 1 
06-09 18:25:09.286   913 27496 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: RearMultiFov, request id: 1844, partial result count: 1 
06-09 18:25:09.287   913 27500 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: RearMultiFov, request id: 1845, partial result count: 1 
06-09 18:25:09.288   913 27472 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: RearMultiFov, request id: 1841, partial result count: 2 
06-09 18:25:09.288   913   913 I Lyric   : auto_exposure_node.cc:1006: {type: Node, name: top_graph_for_camera_RearMultiFov.cam2_ae, class_name: AutoExposureNode}: AE input statistics: {process_input_count = 1846, dropped_requests = 1, stats_not_ready_count = 0, motion_stats_not_ready_count = 0, face_detect_data_not_ready_count = 0, eis_result_not_ready_count = 0, segmentation_mask_not_ready_count = 0, stage_detection_result_not_ready_count = 0, saliency_data_not_ready_count = 0, valid_flash_state = 1845, valid_exposure_timestamp = 1842, valid_lens_info = 1845, valid_sensor_properties = 1842, valid_crop_roi = 0, valid_ae_stats = 1842, valid_uae_stats = 0, valid_awb_stats = 1842, valid_histogram = 1842, valid_flicker_stats = 1842, valid_motion_stats = 1842, valid_wb_config = 1844, valid_color_correction = 1844, valid_face_rois = 1840}
06-09 18:25:09.289   913 27440 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: RearMultiFov, request id: 1842, partial result count: 2 
06-09 18:25:09.290   913 27440 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: RearMultiFov, request id: 1843, partial result count: 2 
06-09 18:25:09.290   913 27438 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: RearMultiFov, request id: 1844, partial result count: 2 
06-09 18:25:09.290   913 27438 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: RearMultiFov, request id: 1845, partial result count: 2 
06-09 18:25:09.292   913   913 I Lyric   : camera_device_session_manager_base.cc:1292: Finished flushing graph:top_graph_for_camera_RearMultiFov
06-09 18:25:09.292   913   913 I Lyric   : camera_device_session_hwl_impl.cc:884: DestroyPipelines entered, camera_id: 0
06-09 18:25:09.292   913   913 I Lyric   : camera_powerhal.cc:281: CAMERA_STREAMING_STANDARD mode unset
06-09 18:25:09.301   913   913 I Lyric   : camera_powerhal.cc:281: CAMERA_GPU_STANDARD mode unset
06-09 18:25:09.301   913   913 I Lyric   : camera_device_session_manager_base.cc:990: Attempting to stop graph:top_graph_for_camera_RearMultiFov
06-09 18:25:09.306   913 27502 W Lyric   : telemetry_node.cc:66: No telemetry statistics available from camera ID 3
06-09 18:25:09.306   913 27502 W Lyric   : telemetry_node.cc:78: No ISP telemetry statistics available from camera ID 3
06-09 18:25:09.308   913 27491 W Lyric   : telemetry_node.cc:66: No telemetry statistics available from camera ID 4
06-09 18:25:09.308   913 27491 W Lyric   : telemetry_node.cc:78: No ISP telemetry statistics available from camera ID 4
06-09 18:25:09.308   913 27491 I Lyric   : multisensor_controller.cc:793: Resetting stream_on_framework_request_id for camera 2
06-09 18:25:09.309   913 27485 I Lyric   : per_camera_barrier_impl.cc:52: Blocker for CsiBlockCam2ToStop released with status: OK
06-09 18:25:09.309   913 27485 I Lyric   : per_camera_barrier_impl.cc:47: Blocker for CsiBlockCam2ToStart acquired
06-09 18:25:09.309   913 27485 I Lyric   : per_camera_barrier_impl.cc:52: Blocker for IppBlockCam2ToStop released with status: OK
06-09 18:25:09.318   913 27491 I Lyric   : per_camera_barrier_impl.cc:52: Blocker for MultiSensorController_Stop released with status: OK
06-09 18:25:09.330   913 27502 I Lyric   : per_camera_barrier_impl.cc:52: Blocker for FrontEndBlockCam4ToStart released with status: OK
06-09 18:25:09.330   913 27441 I Lyric   : per_camera_barrier_impl.cc:52: Blocker for FrontEndBlockCam3ToStart released with status: OK
06-09 18:25:09.346   913   913 I Lyric   : camera_device_session_manager_base.cc:994: Successfully stopped graph:top_graph_for_camera_RearMultiFov
06-09 18:25:09.346   913   913 I Lyric   : camera_device_session_manager_base.cc:810: Attempting to destroy graph:top_graph_for_camera_RearMultiFov
06-09 18:25:09.378   913   913 I Lyric   : camera_device_session_manager_base.cc:817: Successfully destroyed graph:top_graph_for_camera_RearMultiFov
06-09 18:25:09.378   913   913 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_LAUNCH
06-09 18:25:09.378   913   913 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_BACKEND_BOOST
06-09 18:25:09.378   913   913 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_CAPTURE_CPU_THROTTLE
06-09 18:25:09.378   913   913 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_LAUNCH_EXTENDED
06-09 18:25:09.378   913   913 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_VIDEO_RECORDING
06-09 18:25:09.378   913   913 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_ZOOMING_BOOST
06-09 18:25:09.378   913   913 I Lyric   : camera_device_session_hwl_impl.cc:383: Destroyed CameraDeviceSessionHwlImpl for camera 0
06-09 18:25:09.391   913 27473 W Lyric   : device_context.cc:377: NotifyCaptureSessionClose: No OisController found for physical camera RearWide. Status: NOT_FOUND: Failed to find controller by type and camera id(RearWide); Controller with ID: optical image stabilization controller for camera: RearWide not present in device_context
06-09 18:25:09.391   913 27473 I G3ACoordinator: coordinator.cc:1574: Coordinator NotifyCaptureSessionClose called for camera: {position: rear, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:25:09.391   913 27473 I G3ACoordinator: coordinator.cc:1550: Coordinator::NotifyCaptureSessionClose called for camera: {position: rear, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:25:09.391   913 27473 I G3ACoordinator: coordinator.cc:1550: Coordinator::NotifyCaptureSessionClose called for camera: {position: rear, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:25:09.391   913 27473 I G3ACoordinator: coordinator.cc:1550: Coordinator::NotifyCaptureSessionClose called for camera: {position: rear, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:25:09.391   913 27473 I G3ACoordinator: coordinator.cc:1550: Coordinator::NotifyCaptureSessionClose called for camera: {position: rear, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:25:10.416  1383  1535 W ProcessStats: Tracking association SourceState{45c2060 com.xmobile/10529 Top #17160} whose proc state 1 is better than process ProcessState{d439920 com.google.android.apps.camera.services/10193 pkg=com.google.android.apps.camera.services} proc state 15 (1002 skipped)
06-09 18:25:20.479  1383  1871 W ProcessStats: Tracking association SourceState{45c2060 com.xmobile/10529 Top #17188} whose proc state 1 is better than process ProcessState{d439920 com.google.android.apps.camera.services/10193 pkg=com.google.android.apps.camera.services} proc state 15 (354 skipped)
06-09 18:25:41.086  1383  1871 W ProcessStats: Tracking association SourceState{45c2060 com.xmobile/10529 Top #17236} whose proc state 1 is better than process ProcessState{d439920 com.google.android.apps.camera.services/10193 pkg=com.google.android.apps.camera.services} proc state 15 (65 skipped)
06-09 18:25:51.705  1383  1535 W ProcessStats: Tracking association SourceState{45c2060 com.xmobile/10529 Top #17240} whose proc state 1 is better than process ProcessState{d439920 com.google.android.apps.camera.services/10193 pkg=com.google.android.apps.camera.services} proc state 15 (46 skipped)
06-09 18:26:00.942   913  1899 I Lyric   : camera_thermal_manager.cc:63: notifyThrottling with ThermalType: 3, name: VIRTUAL-SKIN, value: 40.9338, throttlingStatus: 1
06-09 18:26:01.558  1383  3435 W ActivityManager: Foreground service started from background can not have location/camera/microphone access: service io.homeassistant.companion.android/androidx.work.impl.foreground.SystemForegroundService
06-09 18:26:04.890   913  1899 I Lyric   : camera_powerhal.cc:168: SetPowerBoost Trigger CAMERA_LAUNCH for 1000ms
06-09 18:26:04.891   913 27864 W Lyric   : device_context.cc:332: NotifyCaptureSessionOpen: No OisController found for physical camera Front. Status: NOT_FOUND: Failed to find controller by type and camera id(Front); Controller with ID: optical image stabilization controller for camera: Front not present in device_context
06-09 18:26:04.891   913 27864 W Lyric   : device_context.cc:332: NotifyCaptureSessionOpen: No OisController found for physical camera FrontVirtual. Status: NOT_FOUND: Failed to find controller by type and camera id(FrontVirtual); Controller with ID: optical image stabilization controller for camera: FrontVirtual not present in device_context
06-09 18:26:04.891   913 27864 I G3ACoordinator: coordinator.cc:1562: Coordinator::AeNotifyCaptureSessionOpen called for camera: {position: front, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:26:04.892   913 27864 I G3ACoordinator: coordinator.cc:1537: Coordinator::NotifyCaptureSessionOpen called for camera: {position: front, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:26:04.892   913 27864 I G3ACoordinator: coordinator.cc:1537: Coordinator::NotifyCaptureSessionOpen called for camera: {position: front, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:26:04.892   913 27864 I G3ACoordinator: coordinator.cc:1537: Coordinator::NotifyCaptureSessionOpen called for camera: {position: front, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:26:04.892   913 27864 I G3ACoordinator: coordinator.cc:1537: Coordinator::NotifyCaptureSessionOpen called for camera: {position: front, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:26:04.892   913  1899 I Lyric   : camera_device_session_manager_base.cc:472: CameraDeviceSessionManager for camera id(FrontMultiFov) is created.
06-09 18:26:04.892   913  1899 I Lyric   : camera_device_session_hwl_impl.cc:318: Created CameraDeviceSessionHwlImpl for camera 1
06-09 18:26:04.977   913  1899 I Lyric   : whi_pro_multicam_controller.cc:110: Stream configuration has one camera fov present: FrontWide. returning all participants.
06-09 18:26:04.977   913  1899 I Lyric   : multicam_whi_coordinator.cc:182: camera id 7
06-09 18:26:04.977   913  1899 I Lyric   : multicam_whi_coordinator.cc:182: camera id 8
06-09 18:26:04.977   913  1899 I Lyric   : multicam_whi_coordinator.cc:233: logical camera_id: 1, [Camera FrontWide,  FOV 1.70978,  camera_id 7,  focal length 2.74, sensor size (4.6848, 3.33792)  active array ( 0, 0, 3839, 2735)], [Camera FrontVirtual,  FOV 1.53168,  camera_id 8,  focal length 2.74, sensor size (4.1968, 2.98656)  active array ( 0, 0, 3439, 2447)],    
06-09 18:26:04.978   913  1899 I Lyric   : camera_powerhal.cc:243: SetPowerStreamingMode CAMERA_STREAMING_STANDARD mode
06-09 18:26:04.978   913  1899 I Lyric   : camera_powerhal.cc:243: SetPowerStreamingMode CAMERA_GPU_STANDARD mode
06-09 18:26:04.978   913  1899 I Lyric   : camera_device_session_hwl_impl.cc:777: BuildPipelines entered, camera_id: 1
06-09 18:26:04.978   913  1899 I Lyric   : active_camera_device_tracker.cc:51: Adding camera: 1, is_logical_camera1, is_front_camera: 1, is_1p_camera_app: 1, only_config_logical_stream: 0, active devices: 0, is_tele_camera_participant: 0
06-09 18:26:04.978   913  1899 I Lyric   : active_camera_device_tracker.cc:193: No specific graph requested, allowing lyric to select based on stream configuration.
06-09 18:26:04.978   913  1899 I Lyric   : camera_device_session_manager_base.cc:671: Attempting to build graph with configuration:
06-09 18:26:04.978   913  1899 I Lyric   : graph_configuration.cc:361: {type: Streaminfo, stream_id: 0, camera_id: Front, format: YCBCR_420_888, width: 1600, height: 1200, usage: [Protected], stream_type: Output, use_case: Default, data_space: DataSpace(Color)::(Standard: BT601_625, Transfer: SMPTE_170M, Range: Full), is_framework_physical_stream: 1, dynamic_range_profile: Standard, intended_for_max_resolution_mode: 0, group_id: -1, is_tunable: 1}
06-09 18:26:04.978   913  1899 I Lyric   : graph_configuration.cc:361: {type: Streaminfo, stream_id: 1, camera_id: Front, format: RAW10, width: 3648, height: 684, usage: [Protected], stream_type: Output, use_case: Default, data_space: DataSpace(Custom)::Depth, is_framework_physical_stream: 1, dynamic_range_profile: Standard, intended_for_max_resolution_mode: 0, group_id: -1, is_tunable: 0}
06-09 18:26:04.978   913  1899 I Lyric   : generic_graph.cc:124: Attempting to configure GenericGraph for computer vision mode: secure
06-09 18:26:04.978   913  1899 W Lyric   : generic_subgraph.cc:914: Output Stream {type: Streaminfo, stream_id: 0, camera_id: Front, format: YCBCR_420_888, width: 1600, height: 1200, usage: [Protected], stream_type: Output, use_case: Default, data_space: DataSpace(Color)::(Standard: BT601_625, Transfer: SMPTE_170M, Range: Full), is_framework_physical_stream: 1, dynamic_range_profile: Standard, intended_for_max_resolution_mode: 0, group_id: -1, is_tunable: 1} does not fall in any known use case under ParseStreamInfoYuv
06-09 18:26:04.978   913  1899 I Lyric   : generic_power_throttle_controller.cc:656: camera thermal: updated config max fps: 30 min fps: 30 portrait mode? 0 video bokeh mode? 0 camera app 1p? 1 has preview stream only? 0
06-09 18:26:04.978   913  1899 I Lyric   : generic_subgraph.cc:2344: ILK is disabled for camera Front
06-09 18:26:04.979   913  1899 I Lyric   : sensor_generic_driver.cc:1478: DOKKAEBI GetModeIndex requirement {size = {width: 3648, height: 2736}, frame_rate_range = [30, 30], request_binning_mode = false, request_pd_stream = true, only_config_logical_cam_stream = false, camera_id = [<recursive>], require_full_fov = true, is_high_frame_rate = false, crop_margin = 0, is_sibling_camera_participating = false, sub_image_count = 1, is_face_auth = true, is_video_mode = false, is_high_resolution_mode = false, is_roshi_enabled = false, is_specific_aspect_ratio_video = false, require_exact_size = false, force_sensor_mode_index = -1, is_multi_cam_usecase = false, raw_stream_usecase = 0} required aspect ratio 1.40351 pick_transition_mode 0 require exact size 0
06-09 18:26:04.979   913  1899 I Lyric   : sensor_generic_driver.cc:2015: dpm: camera DOKKAEBI, line time: 11.59425us, pixel_rate_vt: 809370000, width: 3648, height: 2736, dual pd size: {width: 3648, height: 684}, sparse pd size: {width: 0, height: 0}, emb height: 0, hblanking: 5736, mode.hblanking: 5736, vblanking: 136, mode.vblanking: 136, frame lines: 2874, frame lines for required fps: 2874, line pixels: 9384, FPS: 30, requested FPS: 30, binning factor: {x: 1, y: 1}, analog_gain_range: [1, 16], digital_gain_range: [1, 6], mode index = 6, size = {width: 3648, height: 2736}, pd = 1, frame rate range = [7.5, 30]
06-09 18:26:04.979   913  1899 I Lyric   : dpm_bandwidth_controller_v1.cc:291: dpm: camera 7, csis_required_clock: 250271280, img_preprocessor_required_clock: 250271280
06-09 18:26:04.979   913  1899 I Lyric   : generic_subgraph.cc:3126: enable_eis_blur_refinement_mask_data_flow=0 camera=7
06-09 18:26:05.993   913  1899 I Lyric   : generic_subgraph.cc:4179: camera_id = 7; is_front_camera = 1; is_1p_camera_app = 1; video_call = 0
06-09 18:26:05.995   913  1899 I Lyric   : camera_device_session_manager_impl.cc:288: Successfully constructed graph: top_graph_for_camera_FrontMultiFov, graph class: GenericGraph      
06-09 18:26:05.995   913  1899 I Lyric   : camera_performance_analyzer.cc:21: [CPA] CPA-Lite is enabled.
06-09 18:26:05.996   913  1899 I Lyric   : camera_device_session_manager_base.cc:956: Attempting to start graph:top_graph_for_camera_FrontMultiFov
06-09 18:26:05.997   913 27892 I Lyric   : sensor_node.cc:392: SensorNode starting for sensor: DOKKAEBI, camera: Front
06-09 18:26:05.997   913 27891 I Lyric   : front_end_controller.cc:1248: dpm: skipping acquire for camera 7
06-09 18:26:05.997   913 27891 I Lyric   : front_end_controller.cc:1550: dpm: storing context for csi link 0 camera 7 context: 0xb40000757165d0b8 sibling: 0x0 real context 0x0
06-09 18:26:05.997   913 27891 I Lyric   : per_camera_barrier_impl.cc:47: Blocker for FrontEndBlockCam7ToStart acquired
06-09 18:26:06.009   913 27893 I Lyric   : front_end_controller.cc:1218: dpm: skipping acquire for camera 7
06-09 18:26:06.010   913 27892 I Lyric   : front_end_controller.cc:1192: dpm: skipping acquire for camera 7
06-09 18:26:06.011   913 27891 I G3ACoordinator: awb_session_config_parser_lyric.cc:295: Fail to read calibration data for camera[front normal]]. Use the default LED decision in tuning!
06-09 18:26:06.011   913 27891 I G3ACoordinator: awb_engine.cc:327: Load lut file /apex/com.google.pixel.camera.hal/etc/camera/ghawb_para_lut_front_normal.binarypb
06-09 18:26:06.018   913 27892 I Lyric   : raw_to_yuv_node.cc:736: Starting node raw_to_yuv with Pipeline (ID: (instance_id: 27911), IPs: [ RawToYuv ], Max Outputs: 1, IPConnections: [ ) on camera 7
06-09 18:26:06.036   913  1899 I Lyric   : camera_device_session_manager_base.cc:960: Successfully started graph:top_graph_for_camera_FrontMultiFov
06-09 18:26:06.040   913  1899 I Lyric   : multicam_whi_request_processor.cc:841: ********************dpm: put camera 7 on NORMAL, frame 0, zoom ratio 1.00 ********************
06-09 18:26:06.040   913  1899 I Lyric   : multicam_whi_request_processor.cc:966: ******************** new lead: camera 7(FrontWide), frame 0, zoom ratio 1.00 *******************       
06-09 18:26:06.040   913  1899 I Lyric   : camera_powerhal.cc:168: SetPowerBoost Trigger CAMERA_LAUNCH_EXTENDED for 2000ms
06-09 18:26:06.041   913 27872 I Lyric   : generic_power_throttle_controller.cc:764: camera thermal status: global frame rate at 30fps for camera 7 at frame 0
06-09 18:26:06.042   913 27872 I Lyric   : generic_power_throttle_controller.cc:764: camera thermal status: 3A at 30fps for camera 7 at frame 0
06-09 18:26:06.043   913 27936 I Lyric   : generic_power_throttle_controller.cc:764: camera thermal status: AE Debug Data NoOp for camera 7 at frame 0
06-09 18:26:06.043   913 27936 I Lyric   : generic_power_throttle_controller.cc:764: camera thermal status: AE Topshot Motion Calculation NoOp for camera 7 at frame 0
06-09 18:26:06.043   913 27936 I Lyric   : generic_power_throttle_controller.cc:764: camera thermal status: AE True Light NoOp for camera 7 at frame 0
06-09 18:26:06.043   913 27936 I Lyric   : generic_power_throttle_controller.cc:764: camera thermal status: AE Flicker Detection NoOp for camera 7 at frame 0
06-09 18:26:06.057   913 27933 I Lyric   : multisensor_controller.cc:684: camera Front start prepare spend : 3.011us
06-09 18:26:06.057   913 27923 I Lyric   : g3aa_driver.cc:908: Acquiring context 1. Requirements: Context 1, Bayer Enabled-OTF at 3648x2736, PDAF Disabled-OTF at 3648x684. Sensor DOKKAEBI, max-fps 30, batch size 1, camera_id=7
06-09 18:26:06.057   913 27923 I Lyric   : per_camera_barrier_impl.cc:47: Blocker for G3aaBayer1BlockCam7ToStart acquired
06-09 18:26:06.057   913 27923 I Lyric   : per_camera_barrier_impl.cc:47: Blocker for IppBlockCam7ToStart acquired
06-09 18:26:06.057   913 27923 I Lyric   : stream_interface_controller.cc:523: Compression(SBWC) enabled for CSIS -> DNS for camera Front with instance id 0
06-09 18:26:06.058   913 27923 I Lyric   : per_camera_barrier_impl.cc:47: Blocker for CsiBlockCam7ToStart acquired
06-09 18:26:06.058   913 27923 I Lyric   : csi_driver.cc:1581: Successfully configured EBUF for 3 cameras!
06-09 18:26:06.058   913 27923 I Lyric   : per_camera_barrier_impl.cc:47: Blocker for CsiBlockCam7ToStop acquired
06-09 18:26:06.058   913 27923 I Lyric   : per_camera_barrier_impl.cc:52: Blocker for FrontEndBlockCam7ToStart released with status: OK
06-09 18:26:06.062   913 27872 W Lyric   : tuning_provider_base.cc:578: Exact tuning usecase not found for: camera_sensor: 25 sensor_mode: FULL_4_3_FULL_15_30FPS camera_usecase: TUSCANY
06-09 18:26:06.067   913 27943 I Lyric   : per_camera_barrier_impl.cc:52: Blocker for G3aaBayer1BlockCam7ToStart released with status: OK
06-09 18:26:06.103   913  1899 I Lyric   : camera_device_session_hwl_impl.cc:1198: Flush entered, camera_id: 1
06-09 18:26:06.103   913  1899 I Lyric   : camera_device_session_manager_base.cc:1243: Attempting to flush graph:top_graph_for_camera_FrontMultiFov
06-09 18:26:06.104   913  1899 I Lyric   : per_camera_barrier_impl.cc:52: Blocker for CsiBlockCam7ToStart released with status: OK
06-09 18:26:06.104   913  1899 I Lyric   : auto_exposure_node.cc:1006: {type: Node, name: top_graph_for_camera_FrontMultiFov.ae, class_name: AutoExposureNode}: AE input statistics: {process_input_count = 2, dropped_requests = 0, stats_not_ready_count = 0, motion_stats_not_ready_count = 0, face_detect_data_not_ready_count = 0, eis_result_not_ready_count = 0, segmentation_mask_not_ready_count = 0, stage_detection_result_not_ready_count = 0, saliency_data_not_ready_count = 0, valid_flash_state = 0, valid_exposure_timestamp = 0, valid_lens_info = 2, valid_sensor_properties = 0, valid_crop_roi = 2, valid_ae_stats = 0, valid_uae_stats = 0, valid_awb_stats = 0, valid_histogram = 0, valid_flicker_stats = 0, valid_motion_stats = 0, valid_wb_config = 1, valid_color_correction = 1, valid_face_rois = 0}
06-09 18:26:06.124   913 27923 E Lyric   : camera_device_session_hwl_impl.h:444: Invalid buffer ID 0
06-09 18:26:06.124   913 27923 E Lyric   : camera_device_session_hwl_impl.cc:2192: Failed to set output buffer ID, errno: -22
06-09 18:26:06.124   913 27923 W Lyric   : camera_interface_node.cc:752: Failed to allocate PD DMA buffers: {type: AllocationSpec, request_id: 0, stream_id: 1}, producing frame drop, error: UNAVAILABLE: MultiAllocator unable to allocate: {type: AllocationSpec, request_id: 0, stream_id: 1}, no allocators were able to fulfill this allocation: framework: UNKNOWN: Failed to update intermediate result: Unknown error -38; Failed to request stream buffer from the framework for {type: AllocationSpec, request_id: 0, stream_id: 1}: 0 buffers already allocated; gralloc: NOT_FOUND: Size not available: {type: AllocationSpec, request_id: 0, stream_id: 1}; A specified size is required; gralloc received invalid allocation spec; sbwc-gralloc: NOT_FOUND: Flags not available:{type: AllocationSpec, request_id: 0, stream_id: 1}; SBWC allocation requires allocation flags; hardware: NOT_FOUND: Flags not available:{type: AllocationSpec, request_id: 0, stream_id: 1}; LwisClient expects allocation flags; HwAllocator: hardware failed to allocate {type: AllocationSpec, request_id: 0, stream_id: 1}; heap: NOT_FOUND: Flags not available:{type: AllocationSpec, request_id: 0, stream_id: 1}; HeapAllocator expects allocation flags;; Failed to allocate image from parent context; Failed to allocate image from parent context; Failed to allocate image from parent context
06-09 18:26:06.124   913 27923 I Lyric   : per_camera_barrier_impl.cc:52: Blocker for IppBlockCam7ToStart released with status: ABORTED: abort sensor because IPP OTF is not ready       
06-09 18:26:06.124   913 27933 I Lyric   : per_camera_barrier_impl.cc:150: Blocker owners abort the barrier to wait
06-09 18:26:06.124   913 27933 I Lyric   : multisensor_controller.cc:688: camera Front start wait for barrier spend : 67.33785ms
06-09 18:26:06.124   913 27933 I Lyric   : multisensor_controller.cc:696: camera Front abort start streaming
06-09 18:26:06.124   913 27933 I Lyric   : multisensor_controller.cc:793: Resetting stream_on_framework_request_id for camera 7
06-09 18:26:06.126   913 27923 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: Front, request id: 0, partial result count: 2
06-09 18:26:06.126   913 27923 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: Front, request id: 1, partial result count: 2
06-09 18:26:06.126   913 27929 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: Front, request id: 2, partial result count: 1
06-09 18:26:06.127   913 27925 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: Front, request id: 3, partial result count: 1
06-09 18:26:06.127   913 27925 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: Front, request id: 2, partial result count: 2
06-09 18:26:06.127   913 27872 I Lyric   : camera_device_session_manager_base.cc:1123: Reporting metadata frame drop for camera: Front, request id: 3, partial result count: 2
06-09 18:26:06.128   913  1899 I Lyric   : camera_device_session_manager_base.cc:1292: Finished flushing graph:top_graph_for_camera_FrontMultiFov
06-09 18:26:06.129   913  1899 I Lyric   : camera_device_session_hwl_impl.cc:884: DestroyPipelines entered, camera_id: 1
06-09 18:26:06.129   913  1899 I Lyric   : camera_powerhal.cc:281: CAMERA_STREAMING_STANDARD mode unset
06-09 18:26:06.129   913  1899 I Lyric   : camera_powerhal.cc:281: CAMERA_GPU_STANDARD mode unset
06-09 18:26:06.129   913  1899 I Lyric   : camera_device_session_manager_base.cc:990: Attempting to stop graph:top_graph_for_camera_FrontMultiFov
06-09 18:26:06.129   913  1899 I Lyric   : auto_exposure_node.cc:1006: {type: Node, name: top_graph_for_camera_FrontMultiFov.ae, class_name: AutoExposureNode}: AE input statistics: {process_input_count = 2, dropped_requests = 2, stats_not_ready_count = 0, motion_stats_not_ready_count = 0, face_detect_data_not_ready_count = 0, eis_result_not_ready_count = 0, segmentation_mask_not_ready_count = 0, stage_detection_result_not_ready_count = 0, saliency_data_not_ready_count = 0, valid_flash_state = 0, valid_exposure_timestamp = 0, valid_lens_info = 0, valid_sensor_properties = 0, valid_crop_roi = 0, valid_ae_stats = 0, valid_uae_stats = 0, valid_awb_stats = 0, valid_histogram = 0, valid_flicker_stats = 0, valid_motion_stats = 0, valid_wb_config = 0, valid_color_correction = 0, valid_face_rois = 0}
06-09 18:26:06.129   913 27873 I Lyric   : per_camera_barrier_impl.cc:52: Blocker for CsiBlockCam7ToStop released with status: OK
06-09 18:26:06.129   913 27873 I Lyric   : per_camera_barrier_impl.cc:47: Blocker for CsiBlockCam7ToStart acquired
06-09 18:26:06.129   913 27872 W Lyric   : telemetry_node.cc:66: No telemetry statistics available from camera ID 7
06-09 18:26:06.129   913 27872 W Lyric   : telemetry_node.cc:78: No ISP telemetry statistics available from camera ID 7
06-09 18:26:06.149   913  1899 I Lyric   : camera_device_session_manager_base.cc:994: Successfully stopped graph:top_graph_for_camera_FrontMultiFov
06-09 18:26:06.149   913  1899 I Lyric   : camera_device_session_manager_base.cc:810: Attempting to destroy graph:top_graph_for_camera_FrontMultiFov
06-09 18:26:06.156   913  1899 I Lyric   : camera_device_session_manager_base.cc:817: Successfully destroyed graph:top_graph_for_camera_FrontMultiFov
06-09 18:26:06.156   913  1899 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_LAUNCH
06-09 18:26:06.156   913  1899 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_BACKEND_BOOST
06-09 18:26:06.156   913  1899 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_CAPTURE_CPU_THROTTLE
06-09 18:26:06.156   913  1899 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_LAUNCH_EXTENDED
06-09 18:26:06.156   913  1899 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_VIDEO_RECORDING
06-09 18:26:06.156   913  1899 I Lyric   : camera_powerhal.cc:187: CancelPowerBoost CAMERA_ZOOMING_BOOST
06-09 18:26:06.156   913  1899 I Lyric   : camera_device_session_hwl_impl.cc:383: Destroyed CameraDeviceSessionHwlImpl for camera 1
06-09 18:26:06.156   913 27868 W Lyric   : device_context.cc:377: NotifyCaptureSessionClose: No OisController found for physical camera Front. Status: NOT_FOUND: Failed to find controller by type and camera id(Front); Controller with ID: optical image stabilization controller for camera: Front not present in device_context
06-09 18:26:06.156   913 27868 W Lyric   : device_context.cc:377: NotifyCaptureSessionClose: No OisController found for physical camera FrontVirtual. Status: NOT_FOUND: Failed to find controller by type and camera id(FrontVirtual); Controller with ID: optical image stabilization controller for camera: FrontVirtual not present in device_context
06-09 18:26:06.156   913 27868 I G3ACoordinator: coordinator.cc:1574: Coordinator NotifyCaptureSessionClose called for camera: {position: front, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:26:06.156   913 27868 I G3ACoordinator: coordinator.cc:1550: Coordinator::NotifyCaptureSessionClose called for camera: {position: front, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:26:06.156   913 27868 I G3ACoordinator: coordinator.cc:1550: Coordinator::NotifyCaptureSessionClose called for camera: {position: front, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:26:06.156   913 27868 I G3ACoordinator: coordinator.cc:1550: Coordinator::NotifyCaptureSessionClose called for camera: {position: front, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:26:06.156   913 27868 I G3ACoordinator: coordinator.cc:1550: Coordinator::NotifyCaptureSessionClose called for camera: {position: front, lens_type: multi_fov, spectrum: visible, instance: real}
06-09 18:26:16.779  2049  2077 V WindowManagerShell: Transition requested (#81): android.os.BinderProxy@2e87a22 TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=1061 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.xmobile/.MainActivity } baseActivity=ComponentInfo{com.xmobile/com.xmobile.MainActivity} topActivity=ComponentInfo{com.xmobile/com.xmobile.MainActivity} origActivity=null realActivity=ComponentInfo{com.xmobile/com.xmobile.MainActivity} numActivities=1 lastActiveTime=1982982 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@a7e8cb3} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=Rect(0, 144 - 0, 0) topActivityInfo=ActivityInfo{c32a270 com.xmobile.MainActivity} launchCookies=[android.os.BinderProxy@1ad79e9] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false locusId=null displayAreaFeatureId=1 isTopActivityTransparent=false appCompatTaskInfo=AppCompatTaskInfo { topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false isLetterboxDoubleTapEnabled= false topActivityEligibleForUserAspectRatioButton= false topActivityBoundsLetterboxed= false isFromLetterboxDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=-1 topActivityLetterboxHeight=-1 isUserFullscreenOverrideEnabled=false cameraCompatControlState=hidden}}, pipTask = null, remoteTransition = RemoteTransition { remoteTransition = android.window.IRemoteTransition$Stub$Proxy@538166e, appThread = android.app.IApplicationThread$Stub$Proxy@6cb410f, debugName = QuickstepLaunch }, displayChange = null, flags = 0, debugId = 81 }
06-09 18:26:16.808  1383  1518 V WindowManager: Sent Transition (#81) createdAt=06-09 18:26:16.771 via request=TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=1061 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.xmobile/.MainActivity } baseActivity=ComponentInfo{com.xmobile/com.xmobile.MainActivity} topActivity=ComponentInfo{com.xmobile/com.xmobile.MainActivity} origActivity=null realActivity=ComponentInfo{com.xmobile/com.xmobile.MainActivity} numActivities=1 lastActiveTime=1982982 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{RemoteToken{ffc7cb9 Task{f02327c #1061 type=standard A=10529:com.xmobile}}} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=Rect(0, 144 - 0, 0) topActivityInfo=ActivityInfo{c97a8fe com.xmobile.MainActivity} launchCookies=[android.os.BinderProxy@484885f] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false locusId=null displayAreaFeatureId=1 isTopActivityTransparent=false appCompatTaskInfo=AppCompatTaskInfo { topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false isLetterboxDoubleTapEnabled= false topActivityEligibleForUserAspectRatioButton= false topActivityBoundsLetterboxed= false isFromLetterboxDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=-1 topActivityLetterboxHeight=-1 isUserFullscreenOverrideEnabled=false cameraCompatControlState=hidden}}, pipTask = null, remoteTransition = RemoteTransition { remoteTransition = android.window.IRemoteTransition$Stub$Proxy@67532ac, appThread = android.app.IApplicationThread$Stub$Proxy@25f2b75, debugName = QuickstepLaunch }, displayChange = null, flags = 0, debugId = 81 }
06-09 18:26:16.855  1383  4544 I AppsFilter: interaction: PackageSetting{891a82 com.xmobile/10529} -> PackageSetting{a30828c com.android.managedprovisioning.overlay/10031} BLOCKED

### Camera Device

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

Device

Pixel 7 Pro

VisionCamera Version

4.1.0

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

j-jonathan commented 3 months ago

Hi! Probably related to https://github.com/mrousavy/react-native-vision-camera/pull/2964 You can test it to see if it solves your problem.

mrousavy commented 3 months ago

This has been fixed by #2964 ๐Ÿ‘

mlhtnc commented 3 months ago

Upgraded to 4.3.2 (latest now) and the preview issue is fixed for me ๐Ÿ‘๐Ÿป