diff --git a/sys/d3d11/gstd3d11compositor.cpp b/sys/d3d11/gstd3d11compositor.cpp index a187b39df5..78525988d3 100644 --- a/sys/d3d11/gstd3d11compositor.cpp +++ b/sys/d3d11/gstd3d11compositor.cpp @@ -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) { diff --git a/sys/d3d11/gstd3d11convert.cpp b/sys/d3d11/gstd3d11convert.cpp index 4f6c2c04c7..8f272e614c 100644 --- a/sys/d3d11/gstd3d11convert.cpp +++ b/sys/d3d11/gstd3d11convert.cpp @@ -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; diff --git a/sys/d3d11/gstd3d11deinterlace.cpp b/sys/d3d11/gstd3d11deinterlace.cpp index 2ddd490682..f1315c314e 100644 --- a/sys/d3d11/gstd3d11deinterlace.cpp +++ b/sys/d3d11/gstd3d11deinterlace.cpp @@ -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; diff --git a/sys/d3d11/gstd3d11desktopdupsrc.cpp b/sys/d3d11/gstd3d11desktopdupsrc.cpp index ff47b5d0d2..372addc824 100644 --- a/sys/d3d11/gstd3d11desktopdupsrc.cpp +++ b/sys/d3d11/gstd3d11desktopdupsrc.cpp @@ -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); diff --git a/sys/d3d11/gstd3d11upload.cpp b/sys/d3d11/gstd3d11upload.cpp index 030f4aeaff..a0bce4c195 100644 --- a/sys/d3d11/gstd3d11upload.cpp +++ b/sys/d3d11/gstd3d11upload.cpp @@ -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;