media: Fix Qualcomm's key frame interval bug.
am: 6872194db0
Change-Id: Ifeb8b6e61cfa699f29b450086ec05cb0ccd20a92
diff --git a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
index e7d56ef..6db4993 100644
--- a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
+++ b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
@@ -404,7 +404,7 @@
struct ion_fd_data ion_alloc_fd;
#endif
};
-
+ int nPframes_cache;
int stopped;
int resume_in_stopped;
bool m_max_allowed_bitrate_check;
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
index bd1e9ef..bedeaba 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -4157,6 +4157,7 @@
m_sVenc_cfg.inputformat != V4L2_PIX_FMT_NV12_UBWC)) {
if (bframe_implicitly_enabled) {
DEBUG_PRINT_HIGH("Disabling implicitly enabled B-frames");
+ intra_period.num_pframes = nPframes_cache;
if (!_venc_set_intra_period(intra_period.num_pframes, 0)) {
DEBUG_PRINT_ERROR("Failed to set nPframes/nBframes");
return OMX_ErrorUndefined;
@@ -5073,6 +5074,7 @@
if (enableBframes && intra_period.num_bframes == 0) {
intra_period.num_bframes = VENC_BFRAME_MAX_COUNT;
+ nPframes_cache = intra_period.num_pframes;
intra_period.num_pframes = intra_period.num_pframes / (1 + intra_period.num_bframes);
bframe_implicitly_enabled = true;
} else if (!enableBframes && intra_period.num_bframes > 0) {