diff options
author | Haihao Xiang <haihao.xiang@intel.com> | 2019-01-18 15:14:59 +0800 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2019-02-24 17:59:43 +0000 |
commit | fffb3f628d8451e83635505218d7d442562c3acb (patch) | |
tree | b9043d7eb8e2d4d9a83b842a2dc530db3dfcff57 /sys | |
parent | 348a4b570d5c2d5352e8de9247f648077ee1632f (diff) | |
download | gstreamer-plugins-bad-fffb3f628d8451e83635505218d7d442562c3acb.tar.gz |
msdk: don't destroy an image twice
This gets rid of annoying message in the log, e.g. run the pipeline
below:
gst-launch-1.0 videotestsrc num-buffers=100 ! \
video/x-raw,format=NV12,width=352,height=288 ! msdkh264enc ! filesink \
location=test.h264
[LIBVA]:CRITICAL - DdiMedia_DestroyImage:4357: Invalid image
Diffstat (limited to 'sys')
-rw-r--r-- | sys/msdk/gstmsdkallocator_libva.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/msdk/gstmsdkallocator_libva.c b/sys/msdk/gstmsdkallocator_libva.c index 44fd578b7..7d237abd1 100644 --- a/sys/msdk/gstmsdkallocator_libva.c +++ b/sys/msdk/gstmsdkallocator_libva.c @@ -129,8 +129,12 @@ gst_msdk_frame_alloc (mfxHDL pthis, mfxFrameAllocRequest * req, if (MFX_ERR_NONE != status) { GST_ERROR ("failed to get dmabuf handle"); - vaDestroyImage (gst_msdk_context_get_handle (context), + va_status = vaDestroyImage (gst_msdk_context_get_handle (context), msdk_mids[i].image.image_id); + if (va_status == VA_STATUS_SUCCESS) { + msdk_mids[i].image.image_id = VA_INVALID_ID; + msdk_mids[i].image.buf = VA_INVALID_ID; + } } } else { /* useful to check the image mapping state later */ @@ -209,7 +213,11 @@ gst_msdk_frame_free (mfxHDL pthis, mfxFrameAllocResponse * resp) if (mem->info.mem_type == VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME) vaReleaseBufferHandle (dpy, mem->image.buf); - vaDestroyImage (dpy, mem->image.image_id); + if (mem->image.image_id != VA_INVALID_ID && + vaDestroyImage (dpy, mem->image.image_id) == VA_STATUS_SUCCESS) { + mem_id->image.image_id = VA_INVALID_ID; + mem_id->image.buf = VA_INVALID_ID; + } } va_status = @@ -265,6 +273,10 @@ gst_msdk_frame_lock (mfxHDL pthis, mfxMemId mid, mfxFrameData * data) if (status != MFX_ERR_NONE) { GST_WARNING ("failed to map"); + if (vaDestroyImage (dpy, mem_id->image.image_id) == VA_STATUS_SUCCESS) { + mem_id->image.image_id = VA_INVALID_ID; + mem_id->image.buf = VA_INVALID_ID; + } return status; } @@ -331,6 +343,11 @@ gst_msdk_frame_unlock (mfxHDL pthis, mfxMemId mid, mfxFrameData * ptr) if (mem_id->fourcc != MFX_FOURCC_P8) { vaUnmapBuffer (dpy, mem_id->image.buf); va_status = vaDestroyImage (dpy, mem_id->image.image_id); + + if (va_status == VA_STATUS_SUCCESS) { + mem_id->image.image_id = VA_INVALID_ID; + mem_id->image.buf = VA_INVALID_ID; + } } else { va_status = vaUnmapBuffer (dpy, *(mem_id->surface)); } |