Skip to content
Snippets Groups Projects

Fix leak of dmabuf fds when VAImage is destroyed before releasing its buffer handler

Closed Val Doroshchuk requested to merge valbok/gstreamer-vaapi:master into master

Since gst_vaapi_surface_get_dma_buf_handle() creates proxy buffer object with buffer id from VAImage, and acquires (via vaAcquireBufferHandle) its fd.

And calling gst_vaapi_buffer_proxy_release_data() from gst_vaapi_dmabuf_memory_new() will free VAImage and thus its internal buffer.

But its dmabuf fd still remains opened.

This buffer handle must be released (via vaReleaseBufferHandle) before calling vaDestroyImage()

Since vaAcquireBufferHandle() (acquiring the fd) is called together with gst_vaapi_buffer_proxy_new_from_object() and thus proxy->va_buf != VA_INVALID_ID,

suggesting to call gst_vaapi_buffer_proxy_release_handle() when user's data is released.

It will check proxy->va_buf and make sure that vaReleaseBufferHandle() will be called only after vaAcquireBufferHandle().

#106

Edited by Tim-Philipp Müller

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading