Disable frameskip for low bitrate exported movie

BZ: 55820

When the exported movie has low bitrates such as 1Mbps, frame
drop will be observed. In these situations, we disable the
frame skip in video encoder to improve the export video quality.

Change-Id: Idba9ff925374cefb402895fda6bf2616367cf8ce
Signed-off-by: wfeng6 <wei.feng@intel.com>
Reviewed-on: http://android.intel.com:8080/69193
Reviewed-by: Gu, Wangyi <wangyi.gu@intel.com>
Reviewed-by: Tang, Richard <richard.tang@intel.com>
Reviewed-by: Wang, Elaine <elaine.wang@intel.com>
Reviewed-by: Jiang, Fei <fei.jiang@intel.com>
Reviewed-by: Shi, PingX <pingx.shi@intel.com>
Tested-by: Shi, PingX <pingx.shi@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
diff --git a/frameworks/videoedit/stagefrightshells/IntelVideoEditorAVCEncoder.cpp b/frameworks/videoedit/stagefrightshells/IntelVideoEditorAVCEncoder.cpp
index d7e0529..a63dfd5 100644
--- a/frameworks/videoedit/stagefrightshells/IntelVideoEditorAVCEncoder.cpp
+++ b/frameworks/videoedit/stagefrightshells/IntelVideoEditorAVCEncoder.cpp
@@ -71,7 +71,7 @@
     LOGV("initCheck");
 
     Encode_Status   encStatus;
-
+    uint32_t        disableFrameSkip = 0;
     sp<MetaData> sourceFormat = mSource->getFormat();
 
     CHECK(sourceFormat->findInt32(kKeyWidth, &mVideoWidth));
@@ -104,6 +104,12 @@
     LOGI("mVideoWidth = %d, mVideoHeight = %d, mVideoFrameRate = %d, mVideoColorFormat = %d, mVideoBitRate = %d",
         mVideoWidth, mVideoHeight, mVideoFrameRate, mVideoColorFormat, mVideoBitRate);
 
+    // disable frame skip for low bitrate clips
+    if (mVideoBitRate < BITRATE_2M) {
+        LOGI("Frameskip is disabled for low bitrate clips");
+        disableFrameSkip = 1;
+    }
+
     if (mVideoColorFormat != OMX_COLOR_FormatYUV420SemiPlanar) {
         LOGE("Color format %d is not supported", mVideoColorFormat);
         return BAD_VALUE;
@@ -124,6 +130,7 @@
     mEncParamsCommon.frameRate.frameRateDenom = 1;
     mEncParamsCommon.rcMode = RATE_CONTROL_VBR;
     mEncParamsCommon.rcParams.bitRate = mVideoBitRate;
+    mEncParamsCommon.rcParams.disableFrameSkip = disableFrameSkip;
     mEncParamsCommon.rawFormat =  RAW_FORMAT_NV12;
 
     mEncParamsCommon.rcParams.minQP  = 0;