mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
node: add xrun counter in clock io
Add an xrun counter in the clock that accumulated the duration of xruns. Fill this in in alsa-pcm. A client could use this to dectect xruns (when it changes) and to align the position and nsec after an xrun.
This commit is contained in:
parent
f134abdac0
commit
e90cab1cde
2 changed files with 9 additions and 5 deletions
|
|
@ -1931,14 +1931,18 @@ static int alsa_recover(struct state *state, int err)
|
|||
|
||||
delay = SPA_TIMEVAL_TO_USEC(&diff);
|
||||
missing = delay * state->rate / SPA_USEC_PER_SEC;
|
||||
if (missing == 0)
|
||||
missing = state->threshold;
|
||||
|
||||
spa_log_trace(state->log, "%p: xrun of %"PRIu64" usec %"PRIu64,
|
||||
state, delay, missing);
|
||||
|
||||
if (state->clock)
|
||||
state->clock->xrun += missing;
|
||||
state->sample_count += missing;
|
||||
|
||||
spa_node_call_xrun(&state->callbacks,
|
||||
SPA_TIMEVAL_TO_USEC(&trigger), delay, NULL);
|
||||
|
||||
state->sample_count += missing ? missing : state->threshold;
|
||||
break;
|
||||
}
|
||||
case SND_PCM_STATE_SUSPENDED:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue