Message ID | 20200317112923.31053-1-ming.qian@nxp.com |
---|---|
State | Accepted |
Headers | show |
Series | [FFmpeg-devel,v2] avcodec/v4l2_m2m: fix setting the frame rate | expand |
Context | Check | Description |
---|---|---|
andriy/ffmpeg-patchwork | success | Make fate finished |
On Tue, 17. Mar 19:29, Ming Qian wrote: > v4l2 set the frame rate through frame intervals, > not set frame rate directly. > the frame rate and frame intervals are reciprocal. > so in libavdevice/v4l2.c we can see the following code: > tpf->numerator = framerate_q.den; > tpf->denominator = framerate_q.num; > > Signed-off-by: Ming Qian <ming.qian@nxp.com> > --- > libavcodec/v4l2_m2m_enc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c > index c9f1741bfd..84de63ec9d 100644 > --- a/libavcodec/v4l2_m2m_enc.c > +++ b/libavcodec/v4l2_m2m_enc.c > @@ -172,7 +172,7 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s) > * settingss > */ > if (avctx->framerate.num || avctx->framerate.den) > - v4l2_set_timeperframe(s, avctx->framerate.num, avctx->framerate.den); > + v4l2_set_timeperframe(s, avctx->framerate.den, avctx->framerate.num); > > /* set ext ctrls */ > v4l2_set_ext_ctrl(s, MPEG_CID(HEADER_MODE), MPEG_VIDEO(HEADER_MODE_SEPARATE), "header mode"); > -- > 2.17.1 v4l2m2m doesn't have a maintainer. Any objections if I apply this patch? I'd set commit message to: "The driver's frame period is incorrectly set to the frame rate. This is fixed in the commit." Thanks
On Sun, 29. Mar 10:53, Andriy Gelman wrote: > On Tue, 17. Mar 19:29, Ming Qian wrote: > > v4l2 set the frame rate through frame intervals, > > not set frame rate directly. > > the frame rate and frame intervals are reciprocal. > > so in libavdevice/v4l2.c we can see the following code: > > tpf->numerator = framerate_q.den; > > tpf->denominator = framerate_q.num; > > > > Signed-off-by: Ming Qian <ming.qian@nxp.com> > > --- > > libavcodec/v4l2_m2m_enc.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c > > index c9f1741bfd..84de63ec9d 100644 > > --- a/libavcodec/v4l2_m2m_enc.c > > +++ b/libavcodec/v4l2_m2m_enc.c > > @@ -172,7 +172,7 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s) > > * settingss > > */ > > if (avctx->framerate.num || avctx->framerate.den) > > - v4l2_set_timeperframe(s, avctx->framerate.num, avctx->framerate.den); > > + v4l2_set_timeperframe(s, avctx->framerate.den, avctx->framerate.num); > > > > /* set ext ctrls */ > > v4l2_set_ext_ctrl(s, MPEG_CID(HEADER_MODE), MPEG_VIDEO(HEADER_MODE_SEPARATE), "header mode"); > > -- > > 2.17.1 > > v4l2m2m doesn't have a maintainer. > Any objections if I apply this patch? > > I'd set commit message to: > "The driver's frame period is incorrectly set to the frame rate. This > is fixed in the commit." > Applied. Thanks,
diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c index c9f1741bfd..84de63ec9d 100644 --- a/libavcodec/v4l2_m2m_enc.c +++ b/libavcodec/v4l2_m2m_enc.c @@ -172,7 +172,7 @@ static int v4l2_prepare_encoder(V4L2m2mContext *s) * settingss */ if (avctx->framerate.num || avctx->framerate.den) - v4l2_set_timeperframe(s, avctx->framerate.num, avctx->framerate.den); + v4l2_set_timeperframe(s, avctx->framerate.den, avctx->framerate.num); /* set ext ctrls */ v4l2_set_ext_ctrl(s, MPEG_CID(HEADER_MODE), MPEG_VIDEO(HEADER_MODE_SEPARATE), "header mode");
v4l2 set the frame rate through frame intervals, not set frame rate directly. the frame rate and frame intervals are reciprocal. so in libavdevice/v4l2.c we can see the following code: tpf->numerator = framerate_q.den; tpf->denominator = framerate_q.num; Signed-off-by: Ming Qian <ming.qian@nxp.com> --- libavcodec/v4l2_m2m_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)