mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
d3d11memory, d3d12memory: Fix outstanding memory count tracing
Gets being released memory back to queue even if allocator is flushing in order to count the number of outstanding memory objects. Also, clear queue if there's no outstanding memory object and allocator is flushing Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6240>
This commit is contained in:
parent
27d5e269cc
commit
d0713e029c
3 changed files with 5 additions and 16 deletions
|
@ -243,9 +243,9 @@ gst_d3d11_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
|||
|
||||
pool_alloc = GST_D3D11_POOL_ALLOCATOR (alloc);
|
||||
flow_ret = gst_d3d11_pool_allocator_acquire_memory (pool_alloc, &mem);
|
||||
gst_d3d11_allocator_set_active (alloc, FALSE);
|
||||
if (flow_ret != GST_FLOW_OK) {
|
||||
GST_ERROR_OBJECT (self, "Failed to allocate initial memory");
|
||||
gst_d3d11_allocator_set_active (alloc, FALSE);
|
||||
gst_object_unref (alloc);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -254,7 +254,6 @@ gst_d3d11_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
|||
&stride) || stride < desc[i].Width) {
|
||||
GST_ERROR_OBJECT (self, "Failed to calculate stride");
|
||||
|
||||
gst_d3d11_allocator_set_active (alloc, FALSE);
|
||||
gst_object_unref (alloc);
|
||||
gst_memory_unref (mem);
|
||||
|
||||
|
|
|
@ -2208,6 +2208,8 @@ gst_d3d11_pool_allocator_release_memory (GstD3D11PoolAllocator * self,
|
|||
/* keep it around in our queue */
|
||||
priv->queue.push (mem);
|
||||
priv->outstanding--;
|
||||
if (priv->outstanding == 0 && priv->flushing)
|
||||
gst_d3d11_pool_allocator_stop (self);
|
||||
WakeAllConditionVariable (&priv->cond);
|
||||
ReleaseSRWLockExclusive (&priv->lock);
|
||||
|
||||
|
@ -2232,13 +2234,6 @@ gst_d3d11_memory_release (GstMiniObject * object)
|
|||
priv = alloc->priv;
|
||||
|
||||
AcquireSRWLockExclusive (&priv->lock);
|
||||
/* if flushing, free this memory */
|
||||
if (alloc->priv->flushing) {
|
||||
ReleaseSRWLockExclusive (&priv->lock);
|
||||
GST_LOG_OBJECT (alloc, "allocator is flushing, free %p", mem);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* return the memory to the allocator */
|
||||
gst_memory_ref (mem);
|
||||
gst_d3d11_pool_allocator_release_memory (alloc, mem);
|
||||
|
|
|
@ -1100,6 +1100,8 @@ gst_d3d12_pool_allocator_release_memory (GstD3D12PoolAllocator * self,
|
|||
/* keep it around in our queue */
|
||||
priv->queue.push (mem);
|
||||
priv->outstanding--;
|
||||
if (priv->outstanding == 0 && priv->flushing)
|
||||
gst_d3d12_pool_allocator_stop (self);
|
||||
priv->cond.notify_all ();
|
||||
priv->lock.unlock ();
|
||||
|
||||
|
@ -1124,13 +1126,6 @@ gst_d3d12_memory_release (GstMiniObject * mini_object)
|
|||
priv = alloc->priv;
|
||||
|
||||
priv->lock.lock ();
|
||||
/* if flushing, free this memory */
|
||||
if (alloc->priv->flushing) {
|
||||
priv->lock.unlock ();
|
||||
GST_LOG_OBJECT (alloc, "allocator is flushing, free %p", mem);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* return the memory to the allocator */
|
||||
gst_memory_ref (mem);
|
||||
gst_d3d12_pool_allocator_release_memory (alloc, mem);
|
||||
|
|
Loading…
Reference in a new issue