mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	module-rtp: Stop any ongoing timer when starting stream
This commit is contained in:
		
							parent
							
								
									5f3ae4376e
								
							
						
					
					
						commit
						2f22c1d595
					
				
					 2 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -111,6 +111,7 @@ struct impl {
 | 
			
		|||
	 * requires filling the ring buffer with something other than nullbytes
 | 
			
		||||
	 * (this can happen with DSD for example). */
 | 
			
		||||
	void (*reset_ringbuffer)(struct impl *impl);
 | 
			
		||||
	void (*stop_timer)(struct impl *impl);
 | 
			
		||||
	void (*flush_timeout)(struct impl *impl, uint64_t expirations);
 | 
			
		||||
	void (*deinit)(struct impl *impl, enum spa_direction direction);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -195,6 +196,14 @@ static int stream_start(struct impl *impl)
 | 
			
		|||
 | 
			
		||||
	impl->first = true;
 | 
			
		||||
 | 
			
		||||
	/* Stop the timer now (if the timer is used). Any lingering timer
 | 
			
		||||
	 * will try to send data that is stale at this point, especially
 | 
			
		||||
	 * after the ring buffer contents get reset. Worse, the timer might
 | 
			
		||||
	 * emit a "stopped" state change after a "started" state change
 | 
			
		||||
	 * is emitted here, causing undefined behavior. */
 | 
			
		||||
	if (impl->stop_timer)
 | 
			
		||||
		impl->stop_timer(impl);
 | 
			
		||||
 | 
			
		||||
	impl->reset_ringbuffer(impl);
 | 
			
		||||
 | 
			
		||||
	rtp_stream_emit_state_changed(impl, true, NULL);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue