amc/videodec: only retrieve the stride/slice-height for raw output
authorMatthew Waters <matthew@centricular.com>
Tue, 19 May 2020 04:58:35 +0000 (14:58 +1000)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 21 May 2020 12:40:21 +0000 (12:40 +0000)
When outputting to a surface, these values may not exist.

As found on a Google Pixel 3.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1284>

sys/androidmedia/gstamcvideodec.c

index 73c7c2b..79c2f20 100644 (file)
@@ -758,14 +758,6 @@ gst_amc_video_dec_set_src_caps (GstAmcVideoDec * self, GstAmcFormat * format)
     return FALSE;
   }
 
-  if (!gst_amc_format_get_int (format, "stride", &stride, &err) ||
-      !gst_amc_format_get_int (format, "slice-height", &slice_height, &err)) {
-    GST_ERROR_OBJECT (self, "Failed to get stride and slice-height: %s",
-        err->message);
-    g_clear_error (&err);
-    return FALSE;
-  }
-
   if (gst_amc_format_get_int (format, "crop-left", &crop_left, NULL) &&
       gst_amc_format_get_int (format, "crop-right", &crop_right, NULL)) {
     width = crop_right + 1 - crop_left;
@@ -835,6 +827,14 @@ gst_amc_video_dec_set_src_caps (GstAmcVideoDec * self, GstAmcFormat * format)
     goto out;
   }
 
+  if (!gst_amc_format_get_int (format, "stride", &stride, &err) ||
+      !gst_amc_format_get_int (format, "slice-height", &slice_height, &err)) {
+    GST_ERROR_OBJECT (self, "Failed to get stride and slice-height: %s",
+        err->message);
+    g_clear_error (&err);
+    return FALSE;
+  }
+
   self->format = gst_format;
   self->width = width;
   self->height = height;