mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	spa: libcamera: source: reset ring buffer when stopping
Presently, the ring buffer of completed requests is only cleared
when the buffers are removed from the port. This is not entirely
correct since pause/start commands do not clear the buffers but
they stop the camera. As a consequence, it is possible that some
completed requests stay in the ring buffer, causing them to be
mistakenly processed when the camera is started next.
So reset the ring buffer after the camera is stopped, the same time
as the queue of free buffers is cleared.
(cherry picked from commit c01a2977a5)
			
			
This commit is contained in:
		
							parent
							
								
									1d0a1cbf12
								
							
						
					
					
						commit
						746805d30b
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -362,7 +362,6 @@ int spa_libcamera_clear_buffers(struct impl *impl, struct port *port)
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	port->n_buffers = 0;
 | 
			
		||||
	impl->completed_requests_rb = SPA_RINGBUFFER_INIT();
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1388,6 +1387,7 @@ int spa_libcamera_stream_off(struct impl *impl)
 | 
			
		|||
		impl->source.fd = -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	impl->completed_requests_rb = SPA_RINGBUFFER_INIT();
 | 
			
		||||
	spa_list_init(&port->queue);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue