问题描述
Log 分析:
12-31 18:13:49.889 523 957 I mtkcam-dev3: 2[CameraDevice3Impl::open] open camera3 device (device@3.4/internal/2) systraceLevel(1)
12-31 18:14:02.105 523 8612 I MtkCam/ppl_context: [dump] [APP ] 09 176x144 OUT t:0/r:0 maxBuffers:11 d/s:0x00000000(UNKNOWN) Hal-Client-usage:0x900(0|HW_TEXTURE|HW_COMPOSER) Real:0x32315659(YV12) Request:0x22(IMPLEMENTATION_DEFINED) Override:0x32315659(YV12) Hal-usage:0x20033(0|SW_READ_OFTEN|SW_WRITE_OFTEN|HW_CAMERA_WRITE) HalStream::(consumer/producer)Usage:0/0x20033 bufOffset: 0 rowStrideInBytes/sizeInBytes: 176/25344 96/6912 96/14112 s9:d2:App:YV12:0|HW_TEXTURE|HW_COMPOSER 0x7231e0d140
12-31 18:14:02.105 523 8612 I MtkCam/ppl_context: [dump] [APP ] 10 176x144 OUT t:0/r:0 maxBuffers:8 d/s:0x00000103(BT601_525) Hal-Client-usage:0x10000(0|HW_VIDEO_ENCODER) Real:0x32315659(YV12) Request:0x22(IMPLEMENTATION_DEFINED) Override:0x22(IMPLEMENTATION_DEFINED) Hal-usage:0x20033(0|SW_READ_OFTEN|SW_WRITE_OFTEN|HW_CAMERA_WRITE) HalStream::(consumer/producer)Usage:0/0x20033 bufOffset: 0 rowStrideInBytes/sizeInBytes: 176/25344 96/6912 96/14112 s10:d2:App:YV12:0|HW_VIDEO_ENCODER 0x725e7fd380
18:14:05.361 457 490 I BufferQueueProducer: [SurfaceView - android.camera.cts/android.hardware.camera2.cts.Camera2SurfaceViewCtsActivity#0](this:0x761ecc7800,id:46,api:4,p:502,c:457) queueBuffer: fps=30.25 dur=1024.82 max=35.76 min=25.20
从Log分析出,在测试176x144这一组size的时候,录像的帧率为30,然后看CTS源码:
Recorded的获取:
MediaExtractor extractor = new MediaExtractor();
extractor.setDataSource(mOutMediaFileName);
MediaFormat format = extractor.getTrackFormat(i);
durationUs = format.getLong(MediaFormat.KEY_DURATION);
float duration = (float) (durationUs / 1000);
Expected的获取:
CamcorderProfile profile = CamcorderProfile.get(cameraId, profileId);
float frameDurationMs = 1000.0f / profile.videoFrameRate;
float durationMs = resultListener.getTotalNumFrames() * frameDurationMs;
期望的帧率是从Profile里面获取的,找到media profiles对应的camera2配置的176x144这组size,frameRate配置为20,因此fail。
解决方案
有两种修改方法
第一种修改media profiles对应Camera ,对应fail项size的frameRate和drvier输出的帧率一致;
第二种修改drvier对应video size的帧率和media profiles一致