mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	module-rtp: Rename timestamp to actual_timestamp for clarity
This commit is contained in:
		
							parent
							
								
									6c4cd0f1b2
								
							
						
					
					
						commit
						2a460e18e3
					
				
					 1 changed files with 8 additions and 8 deletions
				
			
		| 
						 | 
					@ -462,7 +462,7 @@ static void rtp_audio_process_capture(void *data)
 | 
				
			||||||
	struct impl *impl = data;
 | 
						struct impl *impl = data;
 | 
				
			||||||
	struct pw_buffer *buf;
 | 
						struct pw_buffer *buf;
 | 
				
			||||||
	struct spa_data *d;
 | 
						struct spa_data *d;
 | 
				
			||||||
	uint32_t offs, size, timestamp, expected_timestamp, stride;
 | 
						uint32_t offs, size, actual_timestamp, expected_timestamp, stride;
 | 
				
			||||||
	int32_t filled, wanted;
 | 
						int32_t filled, wanted;
 | 
				
			||||||
	uint32_t pending, num_queued;
 | 
						uint32_t pending, num_queued;
 | 
				
			||||||
	struct spa_io_position *pos;
 | 
						struct spa_io_position *pos;
 | 
				
			||||||
| 
						 | 
					@ -489,7 +489,7 @@ static void rtp_audio_process_capture(void *data)
 | 
				
			||||||
	pos = impl->io_position;
 | 
						pos = impl->io_position;
 | 
				
			||||||
	if (SPA_LIKELY(pos)) {
 | 
						if (SPA_LIKELY(pos)) {
 | 
				
			||||||
		uint32_t rate = pos->clock.rate.denom;
 | 
							uint32_t rate = pos->clock.rate.denom;
 | 
				
			||||||
		timestamp = pos->clock.position * impl->rate / rate;
 | 
							actual_timestamp = pos->clock.position * impl->rate / rate;
 | 
				
			||||||
		next_nsec = pos->clock.next_nsec;
 | 
							next_nsec = pos->clock.next_nsec;
 | 
				
			||||||
		quantum = (uint64_t)(pos->clock.duration * SPA_NSEC_PER_SEC / (rate * pos->clock.rate_diff));
 | 
							quantum = (uint64_t)(pos->clock.duration * SPA_NSEC_PER_SEC / (rate * pos->clock.rate_diff));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -501,18 +501,18 @@ static void rtp_audio_process_capture(void *data)
 | 
				
			||||||
			impl->sink_quantum = (uint64_t)(pos->clock.duration * SPA_NSEC_PER_SEC / rate);
 | 
								impl->sink_quantum = (uint64_t)(pos->clock.duration * SPA_NSEC_PER_SEC / rate);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		timestamp = expected_timestamp;
 | 
							actual_timestamp = expected_timestamp;
 | 
				
			||||||
		next_nsec = 0;
 | 
							next_nsec = 0;
 | 
				
			||||||
		quantum = 0;
 | 
							quantum = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!impl->have_sync) {
 | 
						if (!impl->have_sync) {
 | 
				
			||||||
		pw_log_info("sync to timestamp:%u seq:%u ts_offset:%u SSRC:%u",
 | 
							pw_log_info("sync to timestamp:%u seq:%u ts_offset:%u SSRC:%u",
 | 
				
			||||||
				timestamp, impl->seq, impl->ts_offset, impl->ssrc);
 | 
									actual_timestamp, impl->seq, impl->ts_offset, impl->ssrc);
 | 
				
			||||||
		impl->ring.readindex = impl->ring.writeindex = timestamp;
 | 
							impl->ring.readindex = impl->ring.writeindex = actual_timestamp;
 | 
				
			||||||
		memset(impl->buffer, 0, BUFFER_SIZE);
 | 
							memset(impl->buffer, 0, BUFFER_SIZE);
 | 
				
			||||||
		impl->have_sync = true;
 | 
							impl->have_sync = true;
 | 
				
			||||||
		expected_timestamp = timestamp;
 | 
							expected_timestamp = actual_timestamp;
 | 
				
			||||||
		filled = 0;
 | 
							filled = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (impl->separate_sender) {
 | 
							if (impl->separate_sender) {
 | 
				
			||||||
| 
						 | 
					@ -521,8 +521,8 @@ static void rtp_audio_process_capture(void *data)
 | 
				
			||||||
			impl->refilling = true;
 | 
								impl->refilling = true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if (SPA_ABS((int)expected_timestamp - (int)timestamp) > (int)quantum) {
 | 
							if (SPA_ABS((int)expected_timestamp - (int)actual_timestamp) > (int)quantum) {
 | 
				
			||||||
			pw_log_warn("expected %u != timestamp %u", expected_timestamp, timestamp);
 | 
								pw_log_warn("timestamp: expected %u != actual %u", expected_timestamp, actual_timestamp);
 | 
				
			||||||
			impl->have_sync = false;
 | 
								impl->have_sync = false;
 | 
				
			||||||
		} else if (filled + wanted > (int32_t)SPA_MIN(impl->target_buffer * 8, BUFFER_SIZE / stride)) {
 | 
							} else if (filled + wanted > (int32_t)SPA_MIN(impl->target_buffer * 8, BUFFER_SIZE / stride)) {
 | 
				
			||||||
			pw_log_warn("sender write overrun %u + %u > %u/%u", filled, wanted,
 | 
								pw_log_warn("sender write overrun %u + %u > %u/%u", filled, wanted,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue