summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-07-19 20:02:54 +0200
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-07-29 15:54:50 +0200
commit773eea0db06f3a10d2ad1e3470f671507b39755f (patch)
tree2febc05546a1bcefef748050e3618e444436d902
parent01b5ed3edbab7bfad8d1c6464051799bc07a85ce (diff)
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.
-rw-r--r--gst/vaapi/gstvaapipluginbase.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gst/vaapi/gstvaapipluginbase.c b/gst/vaapi/gstvaapipluginbase.c
index f41d39a4..e80d2035 100644
--- a/gst/vaapi/gstvaapipluginbase.c
+++ b/gst/vaapi/gstvaapipluginbase.c
@@ -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 =