summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2021-02-24 13:25:43 +0100
committerTim-Philipp Müller <tim@centricular.com>2021-02-25 12:35:19 +0000
commit613e0a50fe0c3bd87b8e866ab65bc497dc8e9fc8 (patch)
treef03b56cece6b581ef43cdcbfb9a9d3346f075e17
parent6cd14fdb166fc66c7d2b1367a5c1aed67d6b9bc9 (diff)
downloadgstreamer-plugins-good-613e0a50fe0c3bd87b8e866ab65bc497dc8e9fc8.tar.gz
v4l2videodec: fix src side frame rate negotiation
Negotiating v4l2h264dec ! v4l2h264enc transcoding pipelines fails in case the encoder does not accept framerate=(fraction)0/1. The acquired caps used for downstream negotiation are determined from gst_v4l2_object_acquire_format(), which sets the GstVideoInfo::fps_n and ::fps_d fields to 0. To fix this, copy the frame rate from the sink side. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/884>
-rw-r--r--sys/v4l2/gstv4l2videodec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/v4l2/gstv4l2videodec.c b/sys/v4l2/gstv4l2videodec.c
index 8c06c9013..1420bd362 100644
--- a/sys/v4l2/gstv4l2videodec.c
+++ b/sys/v4l2/gstv4l2videodec.c
@@ -682,6 +682,10 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder,
if (!gst_v4l2_object_acquire_format (self->v4l2capture, &info))
goto not_negotiated;
+ /* gst_v4l2_object_acquire_format() does not set fps, copy from sink */
+ info.fps_n = self->v4l2output->info.fps_n;
+ info.fps_d = self->v4l2output->info.fps_d;
+
/* Create caps from the acquired format, remove the format field */
acquired_caps = gst_video_info_to_caps (&info);
GST_DEBUG_OBJECT (self, "Acquired caps: %" GST_PTR_FORMAT, acquired_caps);