mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: also cleanup sample when error
Remove the separate error event and merge with the done event with error code. This then also marks the sample as done when in error so that it gets cleaned up properly. Fixes #486
This commit is contained in:
		
							parent
							
								
									1a690a0cbb
								
							
						
					
					
						commit
						d2a5f5c1ae
					
				
					 2 changed files with 11 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -2312,27 +2312,24 @@ static void sample_play_ready(void *data, uint32_t index)
 | 
			
		|||
	send_message(client, reply);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void sample_play_done(void *data)
 | 
			
		||||
static void sample_play_done(void *data, int res)
 | 
			
		||||
{
 | 
			
		||||
	struct pending_sample *ps = data;
 | 
			
		||||
	struct client *client = ps->client;
 | 
			
		||||
	struct impl *impl = client->impl;
 | 
			
		||||
	pw_log_info(NAME" %p: sample done tag:%u", client, ps->tag);
 | 
			
		||||
 | 
			
		||||
	if (res < 0)
 | 
			
		||||
		reply_error(client, COMMAND_PLAY_SAMPLE, ps->tag, res);
 | 
			
		||||
	else
 | 
			
		||||
		pw_log_info(NAME" %p: PLAY_SAMPLE done tag:%u", client, ps->tag);
 | 
			
		||||
 | 
			
		||||
	ps->done = true;
 | 
			
		||||
	pw_loop_signal_event(impl->loop, client->cleanup);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void sample_play_error(void *data, int err)
 | 
			
		||||
{
 | 
			
		||||
	struct pending_sample *ps = data;
 | 
			
		||||
	struct client *client = ps->client;
 | 
			
		||||
	reply_error(client, COMMAND_PLAY_SAMPLE, ps->tag, err);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct sample_play_events sample_play_events = {
 | 
			
		||||
	VERSION_SAMPLE_PLAY_EVENTS,
 | 
			
		||||
	.ready = sample_play_ready,
 | 
			
		||||
	.error = sample_play_error,
 | 
			
		||||
	.done = sample_play_done,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue