mm-video: vidc: Correct the Intraperiod for non B-frame codec
For a codec profile that doesn't support B-frame, Intraperiod should
be set based on number of Pframes. This change ensures that Intraperiod
is obeyed for codec that doesn't support B-frame encoding.
CRs-Fixed: 622373
Change-Id: Ia1412909e4118b1e1c40f30cea4c7d7b57f97310
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 cf24aac..c8c7cdf 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
@@ -3028,8 +3028,11 @@
}
control.id = V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES;
- control.value = (m_sVenc_cfg.fps_num /m_sVenc_cfg.fps_den) - (nBFrames+1);
-
+ if (!nBFrames) {
+ control.value = nPFrames;
+ } else {
+ control.value = (m_sVenc_cfg.fps_num /m_sVenc_cfg.fps_den) - (nBFrames+1);
+ }
rc = ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control);
if (rc) {