mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	audioadapter: ask more data when converter empty
When we are actively driving the stream and the converter needs more data, call the stream process function again to get it so that we don't underrun. Fixes #2494
This commit is contained in:
		
							parent
							
								
									987784b629
								
							
						
					
					
						commit
						651f4af0ae
					
				
					 2 changed files with 18 additions and 2 deletions
				
			
		| 
						 | 
					@ -1153,8 +1153,21 @@ static int follower_ready(void *data, int status)
 | 
				
			||||||
	if (this->target != this->follower) {
 | 
						if (this->target != this->follower) {
 | 
				
			||||||
		this->driver = true;
 | 
							this->driver = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (this->direction == SPA_DIRECTION_OUTPUT)
 | 
							if (this->direction == SPA_DIRECTION_OUTPUT) {
 | 
				
			||||||
 | 
								int retry = 8;
 | 
				
			||||||
 | 
								while (retry--) {
 | 
				
			||||||
				status = spa_node_process(this->convert);
 | 
									status = spa_node_process(this->convert);
 | 
				
			||||||
 | 
									if (status & SPA_STATUS_HAVE_DATA)
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									if (status & SPA_STATUS_NEED_DATA) {
 | 
				
			||||||
 | 
										status = spa_node_process(this->follower);
 | 
				
			||||||
 | 
										if (!(status & SPA_STATUS_HAVE_DATA))
 | 
				
			||||||
 | 
											break;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return spa_node_call_ready(&this->callbacks, status);
 | 
						return spa_node_call_ready(&this->callbacks, status);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2273,6 +2273,9 @@ static int impl_node_process(void *object)
 | 
				
			||||||
			io->status = -EINVAL;
 | 
								io->status = -EINVAL;
 | 
				
			||||||
			buf = NULL;
 | 
								buf = NULL;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
 | 
								spa_log_trace_fp(this->log, "%p: input buffer port %d io:%p status:%d id:%d n:%d",
 | 
				
			||||||
 | 
										this, port->id, io, io->status, io->buffer_id,
 | 
				
			||||||
 | 
										port->n_buffers);
 | 
				
			||||||
			buf = &port->buffers[io->buffer_id];
 | 
								buf = &port->buffers[io->buffer_id];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue