mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	gst: interpollate clock times
This commit is contained in:
		
							parent
							
								
									0f66716de9
								
							
						
					
					
						commit
						009f23abaa
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -48,17 +48,19 @@ gst_pipewire_clock_get_internal_time (GstClock * clock)
 | 
				
			||||||
  GstPipeWireClock *pclock = (GstPipeWireClock *) clock;
 | 
					  GstPipeWireClock *pclock = (GstPipeWireClock *) clock;
 | 
				
			||||||
  GstClockTime result;
 | 
					  GstClockTime result;
 | 
				
			||||||
  struct pw_time t;
 | 
					  struct pw_time t;
 | 
				
			||||||
 | 
					  struct timespec ts;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (pclock->stream == NULL ||
 | 
					  if (pclock->stream == NULL ||
 | 
				
			||||||
      pw_stream_get_time (pclock->stream, &t) < 0 ||
 | 
					      pw_stream_get_time (pclock->stream, &t) < 0 ||
 | 
				
			||||||
      t.rate.denom == 0)
 | 
					      t.rate.denom == 0)
 | 
				
			||||||
    return pclock->last_time;
 | 
					    return pclock->last_time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  GST_DEBUG ("%"PRId64", %d/%d", t.ticks, t.rate.num, t.rate.denom);
 | 
					  result = gst_util_uint64_scale_int (t.ticks, GST_SECOND * t.rate.num, t.rate.denom);
 | 
				
			||||||
 | 
					  clock_gettime(CLOCK_MONOTONIC, &ts);
 | 
				
			||||||
 | 
					  result += SPA_TIMESPEC_TO_TIME(&ts) - t.now;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  result = gst_util_uint64_scale_int (t.ticks * GST_SECOND, t.rate.num, t.rate.denom);
 | 
					  GST_DEBUG ("%"PRId64", %d/%d %"PRId64" %"PRId64,
 | 
				
			||||||
 | 
							  t.ticks, t.rate.num, t.rate.denom, t.now, result);
 | 
				
			||||||
  GST_DEBUG ("%"PRId64", %d/%d %"PRId64, t.ticks, t.rate.num, t.rate.denom, result);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return result;
 | 
					  return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue