mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	export-sink: don't block for render
Pass the buffer to the render function in the main thread but don't block the data thread
This commit is contained in:
		
							parent
							
								
									153bf51ef1
								
							
						
					
					
						commit
						d655d9e0bf
					
				
					 1 changed files with 12 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -493,7 +493,7 @@ static int do_render(struct spa_loop *loop, bool async, uint32_t seq,
 | 
			
		|||
		     const void *_data, size_t size, void *user_data)
 | 
			
		||||
{
 | 
			
		||||
	struct data *d = user_data;
 | 
			
		||||
	struct spa_buffer *buf;
 | 
			
		||||
	const struct spa_buffer *buf = *(struct spa_buffer**)_data;
 | 
			
		||||
	uint8_t *map;
 | 
			
		||||
	void *sdata, *ddata;
 | 
			
		||||
	int sstride, dstride, ostride;
 | 
			
		||||
| 
						 | 
				
			
			@ -502,14 +502,6 @@ static int do_render(struct spa_loop *loop, bool async, uint32_t seq,
 | 
			
		|||
 | 
			
		||||
	handle_events(d);
 | 
			
		||||
 | 
			
		||||
	if (d->io->status != SPA_STATUS_HAVE_BUFFER)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	if (d->io->buffer_id > d->n_buffers)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	buf = d->buffers[d->io->buffer_id];
 | 
			
		||||
 | 
			
		||||
	if (buf->datas[0].type == d->t->data.MemFd ||
 | 
			
		||||
	    buf->datas[0].type == d->t->data.DmaBuf) {
 | 
			
		||||
		map = mmap(NULL, buf->datas[0].maxsize + buf->datas[0].mapoffset, PROT_READ,
 | 
			
		||||
| 
						 | 
				
			
			@ -550,10 +542,20 @@ static int do_render(struct spa_loop *loop, bool async, uint32_t seq,
 | 
			
		|||
static int impl_node_process_input(struct spa_node *node)
 | 
			
		||||
{
 | 
			
		||||
	struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
 | 
			
		||||
	struct spa_buffer *buf;
 | 
			
		||||
	int res;
 | 
			
		||||
 | 
			
		||||
	if (d->io->status != SPA_STATUS_HAVE_BUFFER)
 | 
			
		||||
		return SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
 | 
			
		||||
	if (d->io->buffer_id > d->n_buffers)
 | 
			
		||||
		return SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
 | 
			
		||||
	buf = d->buffers[d->io->buffer_id];
 | 
			
		||||
 | 
			
		||||
	if ((res = pw_loop_invoke(pw_main_loop_get_loop(d->loop), do_render,
 | 
			
		||||
				  SPA_ID_INVALID, NULL, 0, true, d)) < 0)
 | 
			
		||||
				  SPA_ID_INVALID, &buf, sizeof(struct spa_buffer *),
 | 
			
		||||
				  false, d)) < 0)
 | 
			
		||||
		return res;
 | 
			
		||||
 | 
			
		||||
	update_param(d);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue