d3d11vp9dec: Drop frames on non-keyframe format change
authorSeungha Yang <seungha@centricular.com>
Thu, 2 Dec 2021 07:26:08 +0000 (16:26 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 2 Dec 2021 19:19:59 +0000 (19:19 +0000)
... in case of NVIDIA GPU

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

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

index eff86f6..2592214 100644 (file)
@@ -67,6 +67,7 @@
 #endif
 
 #include "gstd3d11vp9dec.h"
+#include "gstd3d11pluginutils.h"
 
 #include <gst/codecs/gstvp9decoder.h>
 #include <string.h>
@@ -252,6 +253,7 @@ gst_d3d11_vp9_dec_set_context (GstElement * element, GstContext * context)
 static gboolean
 gst_d3d11_vp9_dec_open (GstVideoDecoder * decoder)
 {
+  GstVp9Decoder *vp9dec = GST_VP9_DECODER (decoder);
   GstD3D11Vp9Dec *self = GST_D3D11_VP9_DEC (decoder);
   GstD3D11Vp9DecInner *inner = self->inner;
   GstD3D11Vp9DecClass *klass = GST_D3D11_VP9_DEC_GET_CLASS (self);
@@ -263,6 +265,16 @@ gst_d3d11_vp9_dec_open (GstVideoDecoder * decoder)
     return FALSE;
   }
 
+  /* XXX: ConfigDecoderSpecific bit 12 indicates whether accelerator can
+   * support non-keyframe format change or not, but it doesn't seem to be
+   * reliable, since 1b means that it's supported and 0b indicates it may not be
+   * supported. Because some GPUs can support it even if the bit 12 is not
+   * set, do filtering by vendor for now (AMD and Intel looks fine) */
+  if (gst_d3d11_get_device_vendor (inner->device) ==
+      GST_D3D11_DEVICE_VENDOR_NVIDIA) {
+    gst_vp9_decoder_set_non_keyframe_format_change_support (vp9dec, FALSE);
+  }
+
   return TRUE;
 }