va: h264dec: don't copy frames if VAMemory capsfeature is negotiated

Otherwise the VASurfaceID is lost.
This commit is contained in:
Víctor Manuel Jáquez Leal 2020-08-03 13:44:23 +02:00
parent aa664a4eca
commit 0cc1dccd84

View file

@ -1037,6 +1037,15 @@ _caps_is_dmabuf (GstVaH264Dec * self, GstCaps * caps)
& VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME); & VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME);
} }
static inline gboolean
_caps_is_va_memory (GstCaps * caps)
{
GstCapsFeatures *features;
features = gst_caps_get_features (caps, 0);
return gst_caps_features_contains (features, "memory:VAMemory");
}
static inline void static inline void
_shall_copy_frames (GstVaH264Dec * self, GstVideoInfo * info) _shall_copy_frames (GstVaH264Dec * self, GstVideoInfo * info)
{ {
@ -1083,7 +1092,8 @@ _try_allocator (GstVaH264Dec * self, GstAllocator * allocator, GstCaps * caps,
} else if (GST_IS_VA_ALLOCATOR (allocator)) { } else if (GST_IS_VA_ALLOCATOR (allocator)) {
if (!gst_va_allocator_try (allocator, &params)) if (!gst_va_allocator_try (allocator, &params))
return FALSE; return FALSE;
_shall_copy_frames (self, &params.info); if (!_caps_is_va_memory (caps))
_shall_copy_frames (self, &params.info);
} else { } else {
return FALSE; return FALSE;
} }
@ -1191,7 +1201,7 @@ gst_va_h264_dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
} else { } else {
size = GST_VIDEO_INFO_SIZE (&info); size = GST_VIDEO_INFO_SIZE (&info);
if (!self->has_videometa) { if (!self->has_videometa && !_caps_is_va_memory (caps)) {
GST_DEBUG_OBJECT (self, "making new other pool for copy"); GST_DEBUG_OBJECT (self, "making new other pool for copy");
self->other_pool = gst_video_buffer_pool_new (); self->other_pool = gst_video_buffer_pool_new ();
config = gst_buffer_pool_get_config (self->other_pool); config = gst_buffer_pool_get_config (self->other_pool);