mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	module-loopback: connect playback before capture
Connect the playback stream before the capture stream since the capture stream can otherwise trigger playback_process() before the playback node has been activated.
This commit is contained in:
		
							parent
							
								
									dee2a51eb0
								
							
						
					
					
						commit
						83f1de95c0
					
				
					 1 changed files with 14 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -451,25 +451,11 @@ static int setup_streams(struct impl *impl)
 | 
			
		|||
			&impl->playback_listener,
 | 
			
		||||
			&out_stream_events, impl);
 | 
			
		||||
 | 
			
		||||
	n_params = 0;
 | 
			
		||||
	spa_pod_builder_init(&b, buffer, sizeof(buffer));
 | 
			
		||||
	params[n_params++] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat,
 | 
			
		||||
			&impl->capture_info);
 | 
			
		||||
 | 
			
		||||
	if ((res = pw_stream_connect(impl->capture,
 | 
			
		||||
			PW_DIRECTION_INPUT,
 | 
			
		||||
			PW_ID_ANY,
 | 
			
		||||
			PW_STREAM_FLAG_AUTOCONNECT |
 | 
			
		||||
			PW_STREAM_FLAG_MAP_BUFFERS |
 | 
			
		||||
			PW_STREAM_FLAG_RT_PROCESS,
 | 
			
		||||
			params, n_params)) < 0)
 | 
			
		||||
		return res;
 | 
			
		||||
 | 
			
		||||
	/* connect playback first to activate it before capture triggers it */
 | 
			
		||||
	n_params = 0;
 | 
			
		||||
	spa_pod_builder_init(&b, buffer, sizeof(buffer));
 | 
			
		||||
	params[n_params++] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat,
 | 
			
		||||
			&impl->playback_info);
 | 
			
		||||
 | 
			
		||||
	if ((res = pw_stream_connect(impl->playback,
 | 
			
		||||
			PW_DIRECTION_OUTPUT,
 | 
			
		||||
			PW_ID_ANY,
 | 
			
		||||
| 
						 | 
				
			
			@ -480,6 +466,19 @@ static int setup_streams(struct impl *impl)
 | 
			
		|||
			params, n_params)) < 0)
 | 
			
		||||
		return res;
 | 
			
		||||
 | 
			
		||||
	n_params = 0;
 | 
			
		||||
	spa_pod_builder_init(&b, buffer, sizeof(buffer));
 | 
			
		||||
	params[n_params++] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat,
 | 
			
		||||
			&impl->capture_info);
 | 
			
		||||
	if ((res = pw_stream_connect(impl->capture,
 | 
			
		||||
			PW_DIRECTION_INPUT,
 | 
			
		||||
			PW_ID_ANY,
 | 
			
		||||
			PW_STREAM_FLAG_AUTOCONNECT |
 | 
			
		||||
			PW_STREAM_FLAG_MAP_BUFFERS |
 | 
			
		||||
			PW_STREAM_FLAG_RT_PROCESS,
 | 
			
		||||
			params, n_params)) < 0)
 | 
			
		||||
		return res;
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue