Skip to content

Commit

Permalink
Use received frames for period calculation
Browse files Browse the repository at this point in the history
out.frames was clock.duration at some point but it changed, and this
didn't
  • Loading branch information
dimtpap committed Oct 6, 2024
1 parent d5d51d4 commit 965a50b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/pipewire-audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ static void on_process_cb(void *data)
* (https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/0.3.52/pipewire-jack/src/pipewire-jack.c#L5639)
* which is used in the linux-jack plugin to correctly set the timestamp
* (https://github.com/obsproject/obs-studio/blob/27.2.4/plugins/linux-jack/jack-wrapper.c#L87) */
double period_nsecs =
s->pos->clock.duration * (double)SPA_NSEC_PER_SEC / (s->info.sample_rate * s->pos->clock.rate_diff);
double period_nsecs = out.frames * (double)SPA_NSEC_PER_SEC / (s->info.sample_rate * s->pos->clock.rate_diff);

out.timestamp = now - (uint64_t)period_nsecs;
} else {
Expand Down

0 comments on commit 965a50b

Please sign in to comment.