Revert "libv4l-rockchip_v2: Don't produce IDR frames periodically"
This reverts f3a47f0 because one GTS test starts failing from
the commit due to an unexpected bitrate of a produced bitstream.
BUG=b:187483451, b:190582833
TEST=com.google.android.media.gts.RtcVideoCodecTest#testSimulcastBitrateSyncH264
Change-Id: I24b8e08ad99c339f6936380acdff5556fbff49a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/libv4lplugins/+/2955426
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
diff --git a/libv4l-rockchip_v2/libv4l-encplugin-rockchip.c b/libv4l-rockchip_v2/libv4l-encplugin-rockchip.c
index 796fd8c..c2d9abb 100644
--- a/libv4l-rockchip_v2/libv4l-encplugin-rockchip.c
+++ b/libv4l-rockchip_v2/libv4l-encplugin-rockchip.c
@@ -519,10 +519,6 @@
ctx->init_param.h264e.v4l2_h264_level =
ext_ctrls->controls[i].value;
break;
- case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
- ctx->init_param.h264e.gop_len =
- ext_ctrls->controls[i].value;
- break;
case V4L2_CID_MPEG_VIDEO_H264_I_PERIOD:
/*
* RK3399 cannot produce intra-only frame other than IDR
@@ -828,8 +824,6 @@
memset(&init_param, 0, sizeof(init_param));
/* The default value of h264 level is 4.0. */
init_param.h264e.v4l2_h264_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_0;
- /* The default value of h264 gop length is 12. (V4L2 default value) */
- init_param.h264e.gop_len = 12;
/* Get the input format. */
struct v4l2_format format;
diff --git a/libv4l-rockchip_v2/libvepu/h264e/h264e.c b/libv4l-rockchip_v2/libvepu/h264e/h264e.c
index 1593c75..52876aa 100644
--- a/libv4l-rockchip_v2/libvepu/h264e/h264e.c
+++ b/libv4l-rockchip_v2/libvepu/h264e/h264e.c
@@ -178,7 +178,7 @@
slice->slice_beta_offset_div2 = 0;
}
-static void h264e_init_rc(struct rk_venc *ictx, int32_t gop_len)
+static void h264e_init_rc(struct rk_venc *ictx)
{
struct rk_h264_encoder *ctx = (struct rk_h264_encoder *)ictx;
struct mb_qpctrl *qp_ctrl = &ctx->mbrc.qp_ctrl;
@@ -201,11 +201,7 @@
rc->vb.virt_bits_cnt = 0;
rc->vb.bucket_fullness = 0;
rc->vb.pic_time_inc = 0;
- /*
- * gop_len == 0 means a key frame is never produced periodically. We
- * achieve this by setting the period to a sufficiently large value.
- */
- rc->gop_len = gop_len > 0 ? gop_len : (1 << 30);
+ rc->gop_len = 150;
rc->qp_min = 10;
rc->qp_max = 51;
rc->mb_per_pic = MB_PER_PIC(ctx);
@@ -498,7 +494,7 @@
>> 1;
}
- h264e_init_rc(ictx, param->h264e.gop_len);
+ h264e_init_rc(ictx);
/* if level is 31 or greater, we prefer disable 4x4 mv mode
to limit max mv count per 2mb */
diff --git a/libv4l-rockchip_v2/libvepu/h264e/h264e.h b/libv4l-rockchip_v2/libvepu/h264e/h264e.h
index fe8cec9..32b8bf7 100644
--- a/libv4l-rockchip_v2/libvepu/h264e/h264e.h
+++ b/libv4l-rockchip_v2/libvepu/h264e/h264e.h
@@ -51,7 +51,7 @@
int slice_size_mb_rows;
int h264_inter4x4_disabled;
- int32_t frm_in_gop;
+ int frm_in_gop;
uint32_t rk_ctrl_ids[H264E_NUM_CTRLS];
void *rk_payloads[H264E_NUM_CTRLS];
diff --git a/libv4l-rockchip_v2/libvepu/rk_vepu_interface.h b/libv4l-rockchip_v2/libvepu/rk_vepu_interface.h
index 06fbdf3..4936618 100644
--- a/libv4l-rockchip_v2/libvepu/rk_vepu_interface.h
+++ b/libv4l-rockchip_v2/libvepu/rk_vepu_interface.h
@@ -37,7 +37,6 @@
bool h264_sps_pps_before_idr;
uint8_t v4l2_h264_profile;
uint8_t v4l2_h264_level;
- int32_t gop_len;
uint8_t disable_deblocking_filter_idc;
bool entropy_coding_mode_flag;
bool transform_8x8_mode_flag;