相机拍照无响应问题分析一:【MEMORY_NOT_ENOUGH导致】持续快拍,一会儿无法拍照了

【关注我,后续持续新增专题博文,谢谢!!!】

上一篇我们讲了:

这一篇我们开始讲: 相机拍照无响应问题分析一:【MEMORY_NOT_ENOUGH导致】持续快拍,一会儿无法拍照了

目录

一、问题背景

二、问题分析过程

2.1:基于原理分析

[2.2 :分析拍照是否失败](#2.2 :分析拍照是否失败)

[2.3 :查看内存状态](#2.3 :查看内存状态)

[2.4 :继续查看拍照状态](#2.4 :继续查看拍照状态)

[2.5 :解决方案](#2.5 :解决方案)


一、问题背景

使用快拍模式,持续快拍一段时间后,无法继续拍照,拍照无响应了

二、问题分析过程

2.1:基于原理分析

从现象看,拍照流程出现了问题,我们需要分析整个拍照过程流程,而无法拍照,是相机APP上层的一种表现,我们可以先从相机APP角度分析日志,看流程哪里出现问题。

2.2 :分析拍照是否失败

1:参考HAL3一级日志关键字:相机Camera日志分析之三十一:高通Camx HAL十种流程基础分析关键字汇总(后续持续更新中)

2:我们搜索CaptureFailed关键字,看看是否拍照失败

cpp 复制代码
	行 9988: 08-02 17:00:51.731  7484  7712 E CameraAutoLogHelper: tryCatchCaptureFailedLog, reason: CF_MEMORY_IS_NOT_ENOUGH, reasonIndex: 2
	行 9989: 08-02 17:00:51.731  7484  7712 E CameraAutoLogHelper: tryCatchCaptureFailedLog inner, reason: CF_MEMORY_IS_NOT_ENOUGH
	行 9998: 08-02 17:00:51.744  7484  7712 E CameraService: onCaptureFailed
	行 10001: 08-02 17:00:51.745  7484  7484 E CameraCaptureProcessor: onCaptureFailed, capture: 20

从日志看,确实拍照失败,且是内存不足,我们进一步看拍照场景情况。

2.3 :查看内存状态

从日志看,进入低内存LMK状态,available memory:1038,有效内存为1G左右,而当前机型是12G,因此内存极度匮乏。

cpp 复制代码
10065 08-02 17:00:51.808   961   961 E lowmemorykiller: device memory 258676 free 56992 file 247714
10103 08-02 17:00:51.864   961   961 E lowmemorykiller: device memory 261903 free 58109 file 248987
10133 08-02 17:00:51.927  2645  4214 W : AthenaLocalService: requestId:904, type:force-speed, [available{1037, 1600, 69, 500, 99, 1037, true}]
10136 08-02 17:00:51.928  2645  4654 I : MemoryGuardAction: [START] clear_type=392[4012], available memory:1038, fast=true, [available{1037, 1600, 69, 500, 99, 1037, true}]

2.4 :继续查看拍照状态

从日志看:

  1. 拍照前只有不到1G内存:available memory:1008MB,
  2. 拍照失败这次之前已经拍照12张:Shutter Respond Start, count: 12
  3. 此次拍照为快拍状态,快拍6张:capture, burstCapture with picture count: 6
  4. 此次拍照提示拍照内存不足:isAllowedToTakePicture, MEMORY_NOT_ENOUGH。
  5. 返回拍照失败:onCaptureFailed
  6. 提示无法继续拍照:takePicture, not allow take picture。
cpp 复制代码
 08-02 17:00:51.183  2645  4654 I   : MemoryGuardAction: [FINISH] clear_type: 392[4012], available memory:1008MB, reclaimMem:3MB, fast:true, 44ms, [available{1005, 1600, 69, 500, 99, 1005, true}]
08-02 17:00:51.663  7484  7484 E Camera_CameraControlUI: onShutterButtonClick, ShutterButton.id: 2131297623
08-02 17:00:51.663  7484  7484 W Camera_CommonCapMode: onCameraShutterButtonClick
08-02 17:00:51.666  7484  7712 E Camera_y1_BaseMode: CameraTest Shutter Respond Start, count: 12
08-02 17:00:51.666  7484  7712 E Camera_y1_BaseMode: CameraTest Shutter Respond Start
08-02 17:00:51.669  7484  7712 E Camera_LivePhotoPresenter: onCaptureStageChanged,  at least one of [mediaCodec audioRecorder audioEncoder] is not prepare, stage: 1
08-02 17:00:51.669  7484  7712 W Camera_CaptureProcessor: capture, ID: 20, request burst-shot: false, supportEv: false, zslFrameCount: 0
08-02 17:00:51.671  7484  7712 E Camera_LivePhotoPresenter: onCaptureStageChanged,  at least one of [mediaCodec audioRecorder audioEncoder] is not prepare, stage: 2
08-02 17:00:51.707   961   961 E lowmemorykiller: device memory 262445 free 56294 file 246765
08-02 17:00:51.724  7484  7712 E Camera_LivePhotoPresenter: onCaptureStageChanged,  at least one of [mediaCodec audioRecorder audioEncoder] is not prepare, stage: 3
08-02 17:00:51.728  7484  7712 E Camera_LivePhotoPresenter: onCaptureStageChanged,  at least one of [mediaCodec audioRecorder audioEncoder] is not prepare, stage: 4
08-02 17:00:51.729  7484  7712 W Camera_CaptureProcessor: capture, burstCapture with picture count: 6
08-02 17:00:51.729  7484  7712 E Camera_LivePhotoPresenter: onCaptureStageChanged,  at least one of [mediaCodec audioRecorder audioEncoder] is not prepare, stage: 5
08-02 17:00:51.730  7484  7712 E Camera_TRACE: traceBeginSection, msg: CameraPerformance.MEMORY_NOT_ENOUGH
08-02 17:00:51.730  7484  7712 E Camera_TRACE: traceEndSection, msg: CameraPerformance.MEMORY_NOT_ENOUGH
08-02 17:00:51.730  7484  7712 W Camera, BaseMode: isAllowedToTakePicture, MEMORY_NOT_ENOUGH
08-02 17:00:51.731  7484  7712 E Camera, ProducerImpl: onCameraCaptureFailError, error result: CF_MEMORY_IS_NOT_ENOUGH
08-02 17:00:51.731  7484  7712 E Camera_OneCameraImpl: onCameraCaptureFailError, error: CF_MEMORY_IS_NOT_ENOUGH
08-02 17:00:51.731  7484  7712 E Camera_AutoLogHelper: tryCatchCaptureFailedLog, reason: CF_MEMORY_IS_NOT_ENOUGH, reasonIndex: 2
08-02 17:00:51.731  7484  7712 E Camera_AutoLogHelper: tryCatchCaptureFailedLog inner, reason: CF_MEMORY_IS_NOT_ENOUGH
08-02 17:00:51.744  7484  7712 E Camera_Service: onCaptureFailed
08-02 17:00:51.745  7484  7712 E Camera, ProducerImpl: takePicture, not allow take picture, mbFinishAddFrame: true, isCaptureAlgoInitializing: false, checkResult: 2, isCShot: false
08-02 17:00:51.745  7484  7484 E Camera_CaptureProcessor: onCaptureFailed, capture: 20
10001 08-02 17:00:51.745  7484  7484 E Camera_CaptureProcessor: onCaptureFailed, capture: 20
10002 08-02 17:00:51.745  7484  7712 E Camera_LivePhotoPresenter: onCaptureStageChanged,  at least one of [mediaCodec audioRecorder audioEncoder] is not prepare, stage: 6
10005 08-02 17:00:51.748  7484  7712 W Camera_y1_BaseMode: capture, ID: 20
10006 08-02 17:00:51.752  7484  7484 E Camera_y1_BaseMode: resetCaptureDecisionCaptureState, isResetDecision: true
10026 08-02 17:00:51.780  7484  8083 E Camera_LogCatcher: doCatch, request: Request{requestReason='CF_MEMORY_IS_NOT_ENOUGH', mLux=-1, mExceptionID=268505089, mMemoryAvailable=-1.0, mRunningMemoryAvailable=-1.0, mTemperature=-1.0, mCaptureModeName='common', mTimeStamp=1754125251731'}
10029 08-02 17:00:51.783  7484  7484 E Camera_LivePhotoPresenter: onCaptureStageChanged,  at least one of [mediaCodec audioRecorder audioEncoder] is not prepare, stage: -1
10030 08-02 17:00:51.784  7484  7484 W Camera_CaptureProcessor: completeCapture, capture: 20, success: false, mForegroundCaptureId: 20
10031 08-02 17:00:51.784  7484  7484 E Camera_y1_BaseMode: resetCaptureDecisionCaptureState, isResetDecision: true
10033 08-02 17:00:51.785  7484  7484 E Camera_LivePhotoPresenter: onCaptureStageChanged,  at least one of [mediaCodec audioRecorder audioEncoder] is not prepare, stage: 20
10035 08-02 17:00:51.786  7484  7484 E Camera_LivePhotoPresenter: onCaptureStageChanged,  at least one of [mediaCodec audioRecorder audioEncoder] is not prepare, stage: 100

2.5 :解决方案

解决方案:

  1. 分析是否存在内存泄漏,并解决内存泄漏。
  2. 进行内存占用峰值优化。
  3. 在拍照逻辑上调整策略,如果处于低内存状态下,拍照从多帧切为单帧拍照,当内存充足的情况下,再切为多帧拍照。
  4. 调整查杀策略,是否内存。
  5. 调整算法不允许拍照的阀值。
  6. 低内存状态下切换算法,或减少算法处理。

【关注我,后续持续新增专题博文,谢谢!!!】

下一篇讲解:

相关推荐
敢敢のwings26 分钟前
只靠一台相机飞完五个站点:jev-drone 把“判断”放进 3 Hz 那一层
数码相机
普密斯科技27 分钟前
倾斜安装长工作距离:14X变倍镜头用于激光开封芯片腔体观测案例
人工智能·数码相机·计算机视觉
-梅2 小时前
linux(番外)线程,锁,条件变量封装;日志与线程池
linux·c语言·前端·c++
S_WEAN2 小时前
【C++】STL - Priority_queue的使用及模拟实现与仿函数
开发语言·c++
俊俊几年的3 小时前
嵌入式 Linux 应用开发:CMake 详解与交叉编译实践
linux·c++·嵌入式·cmake·linux应用开发
wefg113 小时前
【项目】C++ 基于 Vibe Coding 的 OJ 平台
开发语言·c++
StarsGreen15 小时前
Android中的seccomp相关信息介绍
android
郝学胜-神的一滴19 小时前
Effective STL 条款 07:指针容器销毁前先删除
开发语言·c++·vscode·leetcode·rpc·visual studio
阿杰m20 小时前
Android源码第二十四章:OTA 与 APEX——重启后换了什么?
android
用户0812680374120 小时前
差点格式化一台 Redmi K80:一次 WebView 翻车的无损救援实录
android·debug·webview