From 3de2fd9b5378a9c472433baa7556c8fef61a482e Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 9 Dec 2019 00:36:54 -0600 Subject: Re-read actual capture timebase from V4L2 after framerate request Sometimes V4L2 drivers can change the actual capture timebase after a framerate request is made. Ensure the actual capture timebase is read / reported instead of what ffmpeg tried to use. --- libavdevice/v4l2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 365bacd..15e1258 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -740,6 +740,13 @@ static int v4l2_set_parameters(AVFormatContext *ctx) return ret; } + if (v4l2_ioctl(s->fd, VIDIOC_G_PARM, &streamparm) < 0) { + ret = AVERROR(errno); + av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_G_PARM): %s\n", + av_err2str(ret)); + return ret; + } + if (framerate_q.num != tpf->denominator || framerate_q.den != tpf->numerator) { av_log(ctx, AV_LOG_INFO, -- cgit v1.1