mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	module-rtp: only stop timer when it was running
This commit is contained in:
		
							parent
							
								
									49e7e3a0f0
								
							
						
					
					
						commit
						5082e9f458
					
				
					 2 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
					@ -201,6 +201,7 @@ static void set_timer(struct impl *impl, uint64_t time, uint64_t itime)
 | 
				
			||||||
	ts.it_interval.tv_nsec = itime % SPA_NSEC_PER_SEC;
 | 
						ts.it_interval.tv_nsec = itime % SPA_NSEC_PER_SEC;
 | 
				
			||||||
	spa_system_timerfd_settime(impl->data_loop->system,
 | 
						spa_system_timerfd_settime(impl->data_loop->system,
 | 
				
			||||||
			impl->timer->fd, SPA_FD_TIMER_ABSTIME, &ts, NULL);
 | 
								impl->timer->fd, SPA_FD_TIMER_ABSTIME, &ts, NULL);
 | 
				
			||||||
 | 
						impl->timer_running = time != 0 && itime != 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void
 | 
					static inline void
 | 
				
			||||||
| 
						 | 
					@ -263,7 +264,7 @@ static void rtp_audio_flush_packets(struct impl *impl, uint32_t num_packets)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	spa_ringbuffer_read_update(&impl->ring, timestamp);
 | 
						spa_ringbuffer_read_update(&impl->ring, timestamp);
 | 
				
			||||||
done:
 | 
					done:
 | 
				
			||||||
	if (avail < tosend)
 | 
						if (avail < tosend && impl->timer_running)
 | 
				
			||||||
		set_timer(impl, 0, 0);
 | 
							set_timer(impl, 0, 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,6 +87,7 @@ struct impl {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct pw_loop *data_loop;
 | 
						struct pw_loop *data_loop;
 | 
				
			||||||
	struct spa_source *timer;
 | 
						struct spa_source *timer;
 | 
				
			||||||
 | 
						bool timer_running;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int (*receive_rtp)(struct impl *impl, uint8_t *buffer, ssize_t len);
 | 
						int (*receive_rtp)(struct impl *impl, uint8_t *buffer, ssize_t len);
 | 
				
			||||||
	void (*flush_timeout)(struct impl *impl, uint64_t expirations);
 | 
						void (*flush_timeout)(struct impl *impl, uint64_t expirations);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue