mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	modules: handle stream trigger errors
When we get a process callback from the capture stream but we can't trigger the playback stream, simply consume the buffers from the capture stream. This can happen when the playback stream is not ready yet, for example. If we don't consume the buffers that are ready, the converter might run out of buffers and complain.
This commit is contained in:
		
							parent
							
								
									bc57b9ec86
								
							
						
					
					
						commit
						79baeb8d18
					
				
					 3 changed files with 28 additions and 3 deletions
				
			
		| 
						 | 
					@ -161,7 +161,15 @@ static void capture_destroy(void *d)
 | 
				
			||||||
static void capture_process(void *d)
 | 
					static void capture_process(void *d)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = d;
 | 
						struct impl *impl = d;
 | 
				
			||||||
	pw_stream_trigger_process(impl->playback);
 | 
						int res;
 | 
				
			||||||
 | 
						if ((res = pw_stream_trigger_process(impl->playback)) < 0) {
 | 
				
			||||||
 | 
							while (true) {
 | 
				
			||||||
 | 
								struct pw_buffer *t;
 | 
				
			||||||
 | 
								if ((t = pw_stream_dequeue_buffer(impl->capture)) == NULL)
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								pw_stream_queue_buffer(impl->capture, t);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void playback_process(void *d)
 | 
					static void playback_process(void *d)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -896,7 +896,16 @@ static void capture_destroy(void *d)
 | 
				
			||||||
static void capture_process(void *d)
 | 
					static void capture_process(void *d)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = d;
 | 
						struct impl *impl = d;
 | 
				
			||||||
	pw_stream_trigger_process(impl->playback);
 | 
						int res;
 | 
				
			||||||
 | 
						if ((res = pw_stream_trigger_process(impl->playback)) < 0) {
 | 
				
			||||||
 | 
							pw_log_debug("playback trigger error: %s", spa_strerror(res));
 | 
				
			||||||
 | 
							while (true) {
 | 
				
			||||||
 | 
								struct pw_buffer *t;
 | 
				
			||||||
 | 
								if ((t = pw_stream_dequeue_buffer(impl->capture)) == NULL)
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								pw_stream_queue_buffer(impl->capture, t);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void playback_process(void *d)
 | 
					static void playback_process(void *d)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -310,7 +310,15 @@ static void recalculate_delay(struct impl *impl)
 | 
				
			||||||
static void capture_process(void *d)
 | 
					static void capture_process(void *d)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = d;
 | 
						struct impl *impl = d;
 | 
				
			||||||
	pw_stream_trigger_process(impl->playback);
 | 
						int res;
 | 
				
			||||||
 | 
						if ((res = pw_stream_trigger_process(impl->playback)) < 0) {
 | 
				
			||||||
 | 
							while (true) {
 | 
				
			||||||
 | 
								struct pw_buffer *t;
 | 
				
			||||||
 | 
								if ((t = pw_stream_dequeue_buffer(impl->capture)) == NULL)
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								pw_stream_queue_buffer(impl->capture, t);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void playback_process(void *d)
 | 
					static void playback_process(void *d)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue