mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	gst: pipewirepool:fix lock evasion in release_buffer
This commit is contained in:
		
							parent
							
								
									0c8f803d59
								
							
						
					
					
						commit
						180967bb64
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
					@ -283,25 +283,26 @@ release_buffer (GstBufferPool * pool, GstBuffer *buffer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  GstPipeWirePoolData *data = gst_pipewire_pool_get_data(buffer);
 | 
					  GstPipeWirePoolData *data = gst_pipewire_pool_get_data(buffer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  GST_OBJECT_LOCK (pool);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!data->queued && data->b != NULL)
 | 
					  if (!data->queued && data->b != NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    GstPipeWirePool *p = GST_PIPEWIRE_POOL (pool);
 | 
					    GstPipeWirePool *p = GST_PIPEWIRE_POOL (pool);
 | 
				
			||||||
    GST_OBJECT_LOCK (pool);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    g_autoptr (GstPipeWireStream) s = g_weak_ref_get (&p->stream);
 | 
					    g_autoptr (GstPipeWireStream) s = g_weak_ref_get (&p->stream);
 | 
				
			||||||
    int res;
 | 
					    int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pw_thread_loop_lock (s->core->loop);
 | 
					    pw_thread_loop_lock (s->core->loop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((res = pw_stream_return_buffer (s->pwstream, data->b)) < 0) {
 | 
					    if ((res = pw_stream_return_buffer (s->pwstream, data->b)) < 0) {
 | 
				
			||||||
      GST_ERROR_OBJECT (pool,"can't return buffer %p; gstbuffer : %p, %s",data->b, buffer, spa_strerror(res));
 | 
					      GST_ERROR_OBJECT (pool,"can't return buffer %p; gstbuffer : %p, %s",data->b, buffer, spa_strerror(res));
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      data->queued = TRUE;
 | 
					      data->queued = TRUE;
 | 
				
			||||||
      GST_DEBUG_OBJECT (pool, "returned buffer %p; gstbuffer:%p", data->b, buffer);
 | 
					      GST_DEBUG_OBJECT (pool, "returned buffer %p; gstbuffer:%p", data->b, buffer);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    pw_thread_loop_unlock (s->core->loop);
 | 
					 | 
				
			||||||
    GST_OBJECT_UNLOCK (pool);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pw_thread_loop_unlock (s->core->loop);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  GST_OBJECT_UNLOCK (pool);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static gboolean
 | 
					static gboolean
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue