mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
plugins: fix buffer pool reset_buffer() to reset memory resources.
Fix GstVaapiVideoBufferPool::reset_buffer() to reset the underlying memory resources, and more particularly the VA surface proxy. Most importantly, the GstVaapiVideoMeta is retained. Cached surface in memory are released, thus triggering a new allocation the next time we need to map the buffer.
This commit is contained in:
parent
4df68163dc
commit
f361d4a23d
3 changed files with 16 additions and 2 deletions
|
@ -234,10 +234,10 @@ error_create_memory:
|
|||
static void
|
||||
gst_vaapi_video_buffer_pool_reset_buffer(GstBufferPool *pool, GstBuffer *buffer)
|
||||
{
|
||||
GstVaapiVideoMeta * const meta = gst_buffer_get_vaapi_video_meta(buffer);
|
||||
GstMemory * const mem = gst_buffer_peek_memory(buffer, 0);
|
||||
|
||||
/* Release the underlying surface proxy */
|
||||
gst_vaapi_video_meta_set_surface_proxy(meta, NULL);
|
||||
gst_vaapi_video_memory_reset_surface(GST_VAAPI_VIDEO_MEMORY_CAST(mem));
|
||||
|
||||
GST_BUFFER_POOL_CLASS(gst_vaapi_video_buffer_pool_parent_class)->
|
||||
reset_buffer(pool, buffer);
|
||||
|
|
|
@ -258,6 +258,16 @@ gst_vaapi_video_memory_free(GstVaapiVideoMemory *mem)
|
|||
g_slice_free(GstVaapiVideoMemory, mem);
|
||||
}
|
||||
|
||||
void
|
||||
gst_vaapi_video_memory_reset_surface(GstVaapiVideoMemory *mem)
|
||||
{
|
||||
mem->surface = NULL;
|
||||
gst_vaapi_surface_proxy_replace(&mem->proxy, NULL);
|
||||
if (mem->use_direct_rendering)
|
||||
gst_vaapi_object_replace(&mem->image, NULL);
|
||||
gst_vaapi_video_meta_set_surface_proxy(mem->meta, NULL);
|
||||
}
|
||||
|
||||
static gpointer
|
||||
gst_vaapi_video_memory_map(GstVaapiVideoMemory *mem, gsize maxsize, guint flags)
|
||||
{
|
||||
|
|
|
@ -96,6 +96,10 @@ gboolean
|
|||
gst_video_meta_unmap_vaapi_memory(GstVideoMeta *meta, guint plane,
|
||||
GstMapInfo *info);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void
|
||||
gst_vaapi_video_memory_reset_surface(GstVaapiVideoMemory *mem);
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* --- GstVaapiVideoAllocator --- */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
|
Loading…
Reference in a new issue