d3d11: Don't accept buffer pool which holds different device

At the moment, d3d11 plugin doesn't support texture sharing between
different device

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2191>
This commit is contained in:
Seungha Yang 2021-04-23 18:44:41 +09:00
parent 41218dacec
commit 70c96cf0dd
5 changed files with 59 additions and 21 deletions

View file

@ -1844,9 +1844,14 @@ gst_d3d11_compositor_decide_allocation (GstAggregator * aggregator,
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
/* create our own pool */
if (pool && !GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_object_unref (pool);
pool = NULL;
if (pool) {
if (!GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_clear_object (&pool);
} else {
GstD3D11BufferPool *dpool = GST_D3D11_BUFFER_POOL (pool);
if (dpool->device != self->device)
gst_clear_object (&pool);
}
}
if (!pool) {

View file

@ -1211,9 +1211,14 @@ gst_d3d11_base_convert_propose_allocation (GstBaseTransform * trans,
n_pools = gst_query_get_n_allocation_pools (query);
for (i = 0; i < n_pools; i++) {
gst_query_parse_nth_allocation_pool (query, i, &pool, NULL, NULL, NULL);
if (!GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_object_unref (pool);
pool = NULL;
if (pool) {
if (!GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_clear_object (&pool);
} else {
GstD3D11BufferPool *dpool = GST_D3D11_BUFFER_POOL (pool);
if (dpool->device != filter->device)
gst_clear_object (&pool);
}
}
}
@ -1318,9 +1323,14 @@ gst_d3d11_base_convert_decide_allocation (GstBaseTransform * trans,
if (gst_query_get_n_allocation_pools (query) > 0) {
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
if (pool && !GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_object_unref (pool);
pool = NULL;
if (pool) {
if (!GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_clear_object (&pool);
} else {
GstD3D11BufferPool *dpool = GST_D3D11_BUFFER_POOL (pool);
if (dpool->device != filter->device)
gst_clear_object (&pool);
}
}
update_pool = TRUE;

View file

@ -887,9 +887,14 @@ gst_d3d11_deinterlace_propose_allocation (GstBaseTransform * trans,
n_pools = gst_query_get_n_allocation_pools (query);
for (i = 0; i < n_pools; i++) {
gst_query_parse_nth_allocation_pool (query, i, &pool, NULL, NULL, NULL);
if (!GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_object_unref (pool);
pool = NULL;
if (pool) {
if (!GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_clear_object (&pool);
} else {
GstD3D11BufferPool *dpool = GST_D3D11_BUFFER_POOL (pool);
if (dpool->device != self->device)
gst_clear_object (&pool);
}
}
}
@ -980,9 +985,14 @@ gst_d3d11_deinterlace_decide_allocation (GstBaseTransform * trans,
if (gst_query_get_n_allocation_pools (query) > 0) {
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
if (pool && !GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_object_unref (pool);
pool = NULL;
if (pool) {
if (!GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_clear_object (&pool);
} else {
GstD3D11BufferPool *dpool = GST_D3D11_BUFFER_POOL (pool);
if (dpool->device != self->device)
gst_clear_object (&pool);
}
}
update_pool = TRUE;

View file

@ -352,11 +352,19 @@ gst_d3d11_desktop_dup_src_decide_allocation (GstBaseSrc * bsrc,
update_pool = FALSE;
}
if (!pool || !GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_clear_object (&pool);
pool = gst_d3d11_buffer_pool_new (self->device);
if (pool) {
if (!GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_clear_object (&pool);
} else {
GstD3D11BufferPool *dpool = GST_D3D11_BUFFER_POOL (pool);
if (dpool->device != self->device)
gst_clear_object (&pool);
}
}
if (!pool)
pool = gst_d3d11_buffer_pool_new (self->device);
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set_params (config, caps, size, min, max);

View file

@ -404,9 +404,14 @@ gst_d3d11_upload_decide_allocation (GstBaseTransform * trans, GstQuery * query)
if (gst_query_get_n_allocation_pools (query) > 0) {
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
if (pool && !GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_object_unref (pool);
pool = NULL;
if (pool) {
if (!GST_IS_D3D11_BUFFER_POOL (pool)) {
gst_clear_object (&pool);
} else {
GstD3D11BufferPool *dpool = GST_D3D11_BUFFER_POOL (pool);
if (dpool->device != filter->device)
gst_clear_object (&pool);
}
}
update_pool = TRUE;