Commit 42f401e7 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Mauro Carvalho Chehab

media: mtk-vcodec: venc: fix invalid time per frame in S_PARM

v4l2-compliance expects the driver to adjust the time per frame if it is
invalid (numerator or denominator set to 0). Adjust it to the default
value in these cases.
Signed-off-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Acked-by: default avatarTiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 7ee20328
...@@ -200,14 +200,18 @@ static int vidioc_venc_s_parm(struct file *file, void *priv, ...@@ -200,14 +200,18 @@ static int vidioc_venc_s_parm(struct file *file, void *priv,
struct v4l2_streamparm *a) struct v4l2_streamparm *a)
{ {
struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv); struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv);
struct v4l2_fract *timeperframe = &a->parm.output.timeperframe;
if (a->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) if (a->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
return -EINVAL; return -EINVAL;
ctx->enc_params.framerate_num = if (timeperframe->numerator == 0 || timeperframe->denominator == 0) {
a->parm.output.timeperframe.denominator; timeperframe->numerator = MTK_DEFAULT_FRAMERATE_NUM;
ctx->enc_params.framerate_denom = timeperframe->denominator = MTK_DEFAULT_FRAMERATE_DENOM;
a->parm.output.timeperframe.numerator; }
ctx->enc_params.framerate_num = timeperframe->denominator;
ctx->enc_params.framerate_denom = timeperframe->numerator;
ctx->param_change |= MTK_ENCODE_PARAM_FRAMERATE; ctx->param_change |= MTK_ENCODE_PARAM_FRAMERATE;
a->parm.output.capability = V4L2_CAP_TIMEPERFRAME; a->parm.output.capability = V4L2_CAP_TIMEPERFRAME;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment