mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
plugins: store the first downstream allocator if available
The allocator will be required if we need to allocate a buffer to store the frame with the expected strides. https://bugzilla.gnome.org/show_bug.cgi?id=785054
This commit is contained in:
parent
bcc480b70e
commit
f0fd2aeb04
2 changed files with 18 additions and 1 deletions
|
@ -327,6 +327,7 @@ gst_vaapi_plugin_base_close (GstVaapiPluginBase * plugin)
|
||||||
|
|
||||||
g_clear_object (&plugin->sinkpad_allocator);
|
g_clear_object (&plugin->sinkpad_allocator);
|
||||||
g_clear_object (&plugin->srcpad_allocator);
|
g_clear_object (&plugin->srcpad_allocator);
|
||||||
|
g_clear_object (&plugin->other_srcpad_allocator);
|
||||||
|
|
||||||
gst_caps_replace (&plugin->srcpad_caps, NULL);
|
gst_caps_replace (&plugin->srcpad_caps, NULL);
|
||||||
gst_video_info_init (&plugin->srcpad_info);
|
gst_video_info_init (&plugin->srcpad_info);
|
||||||
|
@ -929,10 +930,24 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin,
|
||||||
num_allocators = gst_query_get_n_allocation_params (query);
|
num_allocators = gst_query_get_n_allocation_params (query);
|
||||||
for (i = 0; i < num_allocators; i++) {
|
for (i = 0; i < num_allocators; i++) {
|
||||||
GstAllocator *allocator = NULL;
|
GstAllocator *allocator = NULL;
|
||||||
|
GstAllocationParams params;
|
||||||
|
|
||||||
gst_query_parse_nth_allocation_param (query, i, &allocator, NULL);
|
gst_query_parse_nth_allocation_param (query, i, &allocator, ¶ms);
|
||||||
if (!allocator)
|
if (!allocator)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* Let's keep the the first allocator if it is not VA-API. It
|
||||||
|
* might be used if it is required to copy the output frame to a
|
||||||
|
* new buffer */
|
||||||
|
if (i == 0
|
||||||
|
&& g_strcmp0 (allocator->mem_type, GST_VAAPI_VIDEO_MEMORY_NAME) != 0) {
|
||||||
|
if (plugin->other_srcpad_allocator)
|
||||||
|
gst_object_unref (plugin->other_srcpad_allocator);
|
||||||
|
plugin->other_srcpad_allocator = allocator;
|
||||||
|
plugin->other_allocator_params = params;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (g_strcmp0 (allocator->mem_type, GST_VAAPI_VIDEO_MEMORY_NAME) == 0) {
|
if (g_strcmp0 (allocator->mem_type, GST_VAAPI_VIDEO_MEMORY_NAME) == 0) {
|
||||||
GST_DEBUG_OBJECT (plugin, "found vaapi allocator in query %"
|
GST_DEBUG_OBJECT (plugin, "found vaapi allocator in query %"
|
||||||
GST_PTR_FORMAT, allocator);
|
GST_PTR_FORMAT, allocator);
|
||||||
|
|
|
@ -147,6 +147,8 @@ struct _GstVaapiPluginBase
|
||||||
gboolean srcpad_can_dmabuf;
|
gboolean srcpad_can_dmabuf;
|
||||||
|
|
||||||
gboolean enable_direct_rendering;
|
gboolean enable_direct_rendering;
|
||||||
|
GstAllocator *other_srcpad_allocator;
|
||||||
|
GstAllocationParams other_allocator_params;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstVaapiPluginBaseClass
|
struct _GstVaapiPluginBaseClass
|
||||||
|
|
Loading…
Reference in a new issue