mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	sco-sink: clear port buffers when stopping
Dequeue all buffered data when stopping, so that it won't be output later when starting next time.
This commit is contained in:
		
							parent
							
								
									33be40ac2e
								
							
						
					
					
						commit
						4f63db4936
					
				
					 1 changed files with 22 additions and 0 deletions
				
			
		| 
						 | 
					@ -533,6 +533,25 @@ static int do_start(struct impl *this)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Drop any buffered data remaining in the port */
 | 
				
			||||||
 | 
					static void drop_port_output(struct impl *this)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct port *port = &this->port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						port->write_buffer_size = 0;
 | 
				
			||||||
 | 
						port->current_buffer = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						while (!spa_list_is_empty(&port->ready)) {
 | 
				
			||||||
 | 
							struct buffer *b;
 | 
				
			||||||
 | 
							b = spa_list_first(&port->ready, struct buffer, link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							spa_list_remove(&b->link);
 | 
				
			||||||
 | 
							b->outstanding = true;
 | 
				
			||||||
 | 
							port->io->buffer_id = b->id;
 | 
				
			||||||
 | 
							spa_node_call_reuse_buffer(&this->callbacks, 0, b->id);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int do_remove_source(struct spa_loop *loop,
 | 
					static int do_remove_source(struct spa_loop *loop,
 | 
				
			||||||
			    bool async,
 | 
								    bool async,
 | 
				
			||||||
			    uint32_t seq,
 | 
								    uint32_t seq,
 | 
				
			||||||
| 
						 | 
					@ -547,6 +566,9 @@ static int do_remove_source(struct spa_loop *loop,
 | 
				
			||||||
	if (this->source.loop)
 | 
						if (this->source.loop)
 | 
				
			||||||
		spa_loop_remove_source(this->data_loop, &this->source);
 | 
							spa_loop_remove_source(this->data_loop, &this->source);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Drop buffered data in the ready queue. Ideally there shouldn't be any. */
 | 
				
			||||||
 | 
						drop_port_output(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue