mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	libcamera: disconnect camera in spa_libcamera_stream_off()
The camera is connected in the spa_libcamera_stream_on() function but the disconnect happen in LibCamera::stop(). It makes more sense to have this two operations separated as it's done for the connection and start, since the camera then can be stopped/started without needing to do a reconnect. Move the camera disconnect to spa_libcamera_stream_off() for the reason mentioned above but also to make the code more consistent and symmetric.
This commit is contained in:
		
							parent
							
								
									ce9f75abaa
								
							
						
					
					
						commit
						439dc8eb2a
					
				
					 2 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -912,6 +912,10 @@ static int spa_libcamera_stream_off(struct impl *this)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	libcamera_stop_capture(dev->camera);
 | 
						libcamera_stop_capture(dev->camera);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spa_log_info(this->log, "disconnecting camera");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						libcamera_disconnect(dev->camera);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_loop_invoke(this->data_loop, do_remove_source, 0, NULL, 0, true, port);
 | 
						spa_loop_invoke(this->data_loop, do_remove_source, 0, NULL, 0, true, port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_init(&port->queue);
 | 
						spa_list_init(&port->queue);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -518,8 +518,6 @@ extern "C" {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void LibCamera::stop() {
 | 
						void LibCamera::stop() {
 | 
				
			||||||
		this->disconnect();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		StreamConfiguration &cfg = this->config_->at(0);
 | 
							StreamConfiguration &cfg = this->config_->at(0);
 | 
				
			||||||
		Stream *stream = cfg.stream();
 | 
							Stream *stream = cfg.stream();
 | 
				
			||||||
		uint32_t nbuffers = this->allocator_->buffers(stream).size();
 | 
							uint32_t nbuffers = this->allocator_->buffers(stream).size();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue