mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	sco-sink: fix buffer reuse
When reusing buffers, do it in the same way as the other sinks. The previous code did not set a valid next buffer for the i/o, possibly causing it to hang.
This commit is contained in:
		
							parent
							
								
									d1b1b84935
								
							
						
					
					
						commit
						33be40ac2e
					
				
					 1 changed files with 16 additions and 8 deletions
				
			
		| 
						 | 
					@ -344,9 +344,19 @@ static void flush_data(struct impl *this)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* otherwise request a new buffer */
 | 
						/* otherwise request a new buffer */
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
		spa_list_remove(&port->current_buffer->link);
 | 
							struct buffer *b;
 | 
				
			||||||
		port->current_buffer->outstanding = true;
 | 
					
 | 
				
			||||||
 | 
							b = port->current_buffer;
 | 
				
			||||||
		port->current_buffer = NULL;
 | 
							port->current_buffer = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* reuse buffer */
 | 
				
			||||||
 | 
							spa_list_remove(&b->link);
 | 
				
			||||||
 | 
							b->outstanding = true;
 | 
				
			||||||
 | 
							spa_log_trace(this->log, "sco-sink %p: reuse buffer %u", this, b->id);
 | 
				
			||||||
 | 
							port->io->buffer_id = b->id;
 | 
				
			||||||
 | 
							spa_node_call_reuse_buffer(&this->callbacks, 0, b->id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* notify we need more data */
 | 
				
			||||||
		port->io->status = SPA_STATUS_NEED_DATA;
 | 
							port->io->status = SPA_STATUS_NEED_DATA;
 | 
				
			||||||
		spa_node_call_ready(&this->callbacks, SPA_STATUS_NEED_DATA);
 | 
							spa_node_call_ready(&this->callbacks, SPA_STATUS_NEED_DATA);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -975,9 +985,6 @@ static int impl_node_process(void *object)
 | 
				
			||||||
	io = port->io;
 | 
						io = port->io;
 | 
				
			||||||
	spa_return_val_if_fail(io != NULL, -EIO);
 | 
						spa_return_val_if_fail(io != NULL, -EIO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!spa_list_is_empty(&port->ready))
 | 
					 | 
				
			||||||
		flush_data(this);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (io->status == SPA_STATUS_HAVE_DATA && io->buffer_id < port->n_buffers) {
 | 
						if (io->status == SPA_STATUS_HAVE_DATA && io->buffer_id < port->n_buffers) {
 | 
				
			||||||
		struct buffer *b = &port->buffers[io->buffer_id];
 | 
							struct buffer *b = &port->buffers[io->buffer_id];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -991,12 +998,13 @@ static int impl_node_process(void *object)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		spa_list_append(&port->ready, &b->link);
 | 
							spa_list_append(&port->ready, &b->link);
 | 
				
			||||||
		b->outstanding = false;
 | 
							b->outstanding = false;
 | 
				
			||||||
 | 
							io->buffer_id = SPA_ID_INVALID;
 | 
				
			||||||
		flush_data(this);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		io->status = SPA_STATUS_OK;
 | 
							io->status = SPA_STATUS_OK;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!spa_list_is_empty(&port->ready))
 | 
				
			||||||
 | 
							flush_data(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return SPA_STATUS_HAVE_DATA;
 | 
						return SPA_STATUS_HAVE_DATA;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue