mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-07-04 00:06:43 -04:00
module-rtp: Correctly scale device_delay in constant latency mode
This commit is contained in:
parent
6c3fd1f07f
commit
20f17c73de
1 changed files with 7 additions and 0 deletions
|
|
@ -217,6 +217,13 @@ static void rtp_audio_process_playback(void *data)
|
||||||
|
|
||||||
avail = spa_ringbuffer_get_read_index(&impl->ring, ×tamp);
|
avail = spa_ringbuffer_get_read_index(&impl->ring, ×tamp);
|
||||||
|
|
||||||
|
if (impl->io_position) {
|
||||||
|
uint32_t clock_rate = impl->io_position->clock.rate.denom;
|
||||||
|
/* Device delay is reported in clock rate units. If this does not
|
||||||
|
* match the RTP rate, the device delay must be transformed first. */
|
||||||
|
device_delay = scale_u64(device_delay, impl->rate, clock_rate);
|
||||||
|
}
|
||||||
|
|
||||||
/* Reduce target buffer by the delay amount to start playback sooner.
|
/* Reduce target buffer by the delay amount to start playback sooner.
|
||||||
* This compensates for the delay to the device. */
|
* This compensates for the delay to the device. */
|
||||||
if (SPA_UNLIKELY(impl->target_buffer < device_delay)) {
|
if (SPA_UNLIKELY(impl->target_buffer < device_delay)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue