mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
plugins: reset allocators if video info changed
If the frame size or format, change, the allocators are reset, so a new ones can be created with the new video info.
This commit is contained in:
parent
01b5ed3edb
commit
773eea0db0
1 changed files with 18 additions and 2 deletions
|
@ -492,10 +492,26 @@ gst_vaapi_buffer_pool_caps_is_equal (GstBufferPool * pool, GstCaps * newcaps)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
reset_allocator (GstAllocator * allocator, GstVideoInfo * vinfo)
|
||||
{
|
||||
const GstVideoInfo *orig_vi;
|
||||
|
||||
if (!allocator)
|
||||
return TRUE;
|
||||
|
||||
orig_vi = gst_allocator_get_vaapi_video_info (allocator, NULL);
|
||||
if (!gst_video_info_changed (orig_vi, vinfo))
|
||||
return FALSE;
|
||||
|
||||
gst_object_unref (allocator);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
ensure_sinkpad_allocator (GstVaapiPluginBase * plugin, GstVideoInfo * vinfo)
|
||||
{
|
||||
if (plugin->sinkpad_allocator)
|
||||
if (!reset_allocator (plugin->sinkpad_allocator, vinfo))
|
||||
return TRUE;
|
||||
|
||||
plugin->sinkpad_allocator =
|
||||
|
@ -506,7 +522,7 @@ ensure_sinkpad_allocator (GstVaapiPluginBase * plugin, GstVideoInfo * vinfo)
|
|||
static gboolean
|
||||
ensure_srcpad_allocator (GstVaapiPluginBase * plugin, GstVideoInfo * vinfo)
|
||||
{
|
||||
if (plugin->srcpad_allocator)
|
||||
if (!reset_allocator (plugin->srcpad_allocator, vinfo))
|
||||
return TRUE;
|
||||
|
||||
plugin->srcpad_allocator =
|
||||
|
|
Loading…
Reference in a new issue