msdkdec: fix buffer leaks during drain and a leak of videobufferpool
https://bugzilla.gnome.org/show_bug.cgi?id=790312
This commit is contained in:
parent
ddd9355767
commit
0933b8b45a
@ -615,7 +615,6 @@ gst_msdkdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
|
|||||||
/* Check if the pool's caps will meet msdk's alignment
|
/* Check if the pool's caps will meet msdk's alignment
|
||||||
requirements by default. */
|
requirements by default. */
|
||||||
gst_video_info_from_caps (&info_from_caps, pool_caps);
|
gst_video_info_from_caps (&info_from_caps, pool_caps);
|
||||||
gst_caps_unref (pool_caps);
|
|
||||||
memcpy (&info_aligned, &info_from_caps, sizeof (info_aligned));
|
memcpy (&info_aligned, &info_from_caps, sizeof (info_aligned));
|
||||||
msdk_video_alignment (&alignment, &info_from_caps);
|
msdk_video_alignment (&alignment, &info_from_caps);
|
||||||
gst_video_info_align (&info_aligned, &alignment);
|
gst_video_info_align (&info_aligned, &alignment);
|
||||||
@ -645,7 +644,7 @@ gst_msdkdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
|
|||||||
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT)) {
|
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT)) {
|
||||||
/* The aligned pool config can be used directly. */
|
/* The aligned pool config can be used directly. */
|
||||||
if (!gst_buffer_pool_set_config (pool, pool_config))
|
if (!gst_buffer_pool_set_config (pool, pool_config))
|
||||||
return FALSE;
|
goto error_set_config;
|
||||||
} else {
|
} else {
|
||||||
/* The aligned pool config cannot be used directly so we will
|
/* The aligned pool config cannot be used directly so we will
|
||||||
make a side-pool that will be decoded into and the copied
|
make a side-pool that will be decoded into and the copied
|
||||||
@ -657,14 +656,23 @@ gst_msdkdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
|
|||||||
memcpy (&thiz->pool_info, &info_aligned, sizeof (GstVideoInfo));
|
memcpy (&thiz->pool_info, &info_aligned, sizeof (GstVideoInfo));
|
||||||
if (!gst_buffer_pool_set_config (thiz->pool, pool_config) ||
|
if (!gst_buffer_pool_set_config (thiz->pool, pool_config) ||
|
||||||
!gst_buffer_pool_set_active (thiz->pool, TRUE))
|
!gst_buffer_pool_set_active (thiz->pool, TRUE))
|
||||||
return FALSE;
|
goto error_set_config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_query_set_nth_allocation_pool (query, 0, pool, size, min_buffers,
|
gst_query_set_nth_allocation_pool (query, 0, pool, size, min_buffers,
|
||||||
max_buffers);
|
max_buffers);
|
||||||
|
|
||||||
|
if (pool)
|
||||||
|
gst_object_unref (pool);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
error_set_config:
|
||||||
|
GST_ERROR_OBJECT (decoder, "failed to set buffer pool config");
|
||||||
|
if (pool)
|
||||||
|
gst_object_unref (pool);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -693,8 +701,9 @@ gst_msdkdec_drain (GstVideoDecoder * decoder)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
task = &g_array_index (thiz->tasks, MsdkDecTask, thiz->next_task);
|
task = &g_array_index (thiz->tasks, MsdkDecTask, thiz->next_task);
|
||||||
if (!gst_msdkdec_finish_task (thiz, task))
|
if ((flow = gst_msdkdec_finish_task (thiz, task)) != GST_FLOW_OK)
|
||||||
return GST_FLOW_ERROR;
|
return flow;
|
||||||
|
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
flow = allocate_output_buffer (thiz, &buffer);
|
flow = allocate_output_buffer (thiz, &buffer);
|
||||||
if (flow != GST_FLOW_OK)
|
if (flow != GST_FLOW_OK)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user