d3d11compositor: Don't try to read empty buffer
authorSeungha Yang <seungha@centricular.com>
Thu, 6 Jan 2022 13:00:11 +0000 (22:00 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 13 Jan 2022 20:27:50 +0000 (20:27 +0000)
The queued buffer may not be readable buffer in case that
upstream sends GAP event or so.

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

subprojects/gst-plugins-bad/sys/d3d11/gstd3d11compositor.cpp

index 0c70873..aa319ee 100644 (file)
@@ -2429,6 +2429,12 @@ gst_d3d11_compositor_check_device_update (GstElement * agg,
   if (!buf)
     return TRUE;
 
+  /* Ignore gap buffer */
+  if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP) ||
+      gst_buffer_get_size (buf) == 0) {
+    return TRUE;
+  }
+
   mem = gst_buffer_peek_memory (buf, 0);
   /* FIXME: we should be able to accept non-d3d11 memory later once
    * we remove intermediate elements (d3d11upload and d3d11colorconvert)