mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	sco-sink: fix no sound issue if first port buffur size is less than write MTU
No data is written because 'sco_on_timeout' always reset 'write_buffer_size' to 0.
This commit is contained in:
		
							parent
							
								
									5cddd61c6c
								
							
						
					
					
						commit
						8b7502c8db
					
				
					 1 changed files with 2 additions and 7 deletions
				
			
		| 
						 | 
					@ -488,13 +488,6 @@ static void sco_on_timeout(struct spa_source *source)
 | 
				
			||||||
	if (this->started && spa_system_timerfd_read(this->data_system, this->timerfd, &exp) < 0)
 | 
						if (this->started && spa_system_timerfd_read(this->data_system, this->timerfd, &exp) < 0)
 | 
				
			||||||
		spa_log_warn(this->log, "error reading timerfd: %s", strerror(errno));
 | 
							spa_log_warn(this->log, "error reading timerfd: %s", strerror(errno));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Reset if start time is 0 */
 | 
					 | 
				
			||||||
	if (this->start_time == 0) {
 | 
					 | 
				
			||||||
		this->total_samples = 0;
 | 
					 | 
				
			||||||
		port->ready_offset = 0;
 | 
					 | 
				
			||||||
		port->write_buffer_size = 0;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* delay if no buffers available */
 | 
						/* delay if no buffers available */
 | 
				
			||||||
	if (spa_list_is_empty(&port->ready)) {
 | 
						if (spa_list_is_empty(&port->ready)) {
 | 
				
			||||||
		set_timeout(this, this->transport->write_mtu / port->frame_size * SPA_NSEC_PER_SEC / port->current_format.info.raw.rate);
 | 
							set_timeout(this, this->transport->write_mtu / port->frame_size * SPA_NSEC_PER_SEC / port->current_format.info.raw.rate);
 | 
				
			||||||
| 
						 | 
					@ -593,6 +586,7 @@ static void drop_port_output(struct impl *this)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	port->write_buffer_size = 0;
 | 
						port->write_buffer_size = 0;
 | 
				
			||||||
	port->current_buffer = NULL;
 | 
						port->current_buffer = NULL;
 | 
				
			||||||
 | 
						port->ready_offset = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (!spa_list_is_empty(&port->ready)) {
 | 
						while (!spa_list_is_empty(&port->ready)) {
 | 
				
			||||||
		struct buffer *b;
 | 
							struct buffer *b;
 | 
				
			||||||
| 
						 | 
					@ -615,6 +609,7 @@ static int do_remove_source(struct spa_loop *loop,
 | 
				
			||||||
	struct impl *this = user_data;
 | 
						struct impl *this = user_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->start_time = 0;
 | 
						this->start_time = 0;
 | 
				
			||||||
 | 
						this->total_samples = 0;
 | 
				
			||||||
	set_timeout(this, 0);
 | 
						set_timeout(this, 0);
 | 
				
			||||||
	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);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue