ivfparse: Don't set zero resolution on caps
authorSeungha Yang <seungha@centricular.com>
Tue, 30 Mar 2021 10:23:12 +0000 (19:23 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 10 Feb 2022 20:30:40 +0000 (20:30 +0000)
It could be zero if the information is not available at ivfparse
side, or not implemented. In that case, simply don't set
width/height on caps, otherwise downstream would be confused

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1649>

subprojects/gst-plugins-bad/gst/ivfparse/gstivfparse.c

index 35c0bd5..efc9825 100644 (file)
@@ -225,8 +225,11 @@ gst_ivf_parse_update_src_caps (GstIvfParse * ivf)
   media_type = fourcc_to_media_type (ivf->fourcc);
 
   /* Create src pad caps */
-  caps = gst_caps_new_simple (media_type, "width", G_TYPE_INT, ivf->width,
-      "height", G_TYPE_INT, ivf->height, NULL);
+  caps = gst_caps_new_empty_simple (media_type);
+  if (ivf->width > 0 && ivf->height > 0) {
+    gst_caps_set_simple (caps, "width", G_TYPE_INT, ivf->width,
+        "height", G_TYPE_INT, ivf->height, NULL);
+  }
 
   if (ivf->fps_n > 0 && ivf->fps_d > 0) {
     gst_base_parse_set_frame_rate (GST_BASE_PARSE_CAST (ivf),