[RK3288][Android6.0] 调试笔记 --- Camera丢帧检测

Platform: Rockchip
OS: Android 6.0
Kernel: 3.10.92

rk在camera hal提供了计算实际fps的接口,默认注释掉了.

static void debugShowFPS()
{
    static int mFrameCount = 0;
    static int mLastFrameCount = 0;
    static nsecs_t mLastFpsTime = 0;
    static float mFps = 0;
    mFrameCount++;
    if (!(mFrameCount & 0x1F)) {
        nsecs_t now = systemTime();
        nsecs_t diff = now - mLastFpsTime;
        mFps = ((mFrameCount - mLastFrameCount) * float(s2ns(1))) / diff;
        mLastFpsTime = now;
        mLastFrameCount = mFrameCount;
        LOGD("Camera %d Frames, %2.3f FPS", mFrameCount, mFps);
    }
    // XXX: mFPS has the value we want
}

通过前后计算一定时间内的总帧数和时间,计算出实际fps.

利用此方法和理论fps比较,可以得知上来的数据会不会丢帧现象.

你可能感兴趣的:(子类__Camera,camera,fps,hal,debug)