mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
alsa-utils: update the threshold also for capture
This commit is contained in:
parent
0f9594e119
commit
1bbb144b59
1 changed files with 15 additions and 14 deletions
|
|
@ -885,14 +885,14 @@ int spa_alsa_read(struct state *state, snd_pcm_uframes_t silence)
|
||||||
snd_pcm_uframes_t read, frames, offset;
|
snd_pcm_uframes_t read, frames, offset;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (state->position && !state->slaved) {
|
if (state->position) {
|
||||||
uint64_t position, duration;
|
if (state->duration != state->position->clock.duration) {
|
||||||
|
state->duration = state->position->clock.duration;
|
||||||
duration = state->position->clock.duration;
|
state->threshold = (state->duration * state->rate + state->rate_denom-1) / state->rate_denom;
|
||||||
if (state->duration != duration) {
|
|
||||||
state->duration = duration;
|
|
||||||
state->threshold = (duration * state->rate + state->rate_denom-1) / state->rate_denom;
|
|
||||||
}
|
}
|
||||||
|
if (!state->slaved) {
|
||||||
|
uint64_t position;
|
||||||
|
|
||||||
position = state->position->clock.position;
|
position = state->position->clock.position;
|
||||||
if (state->last_position && state->last_position + state->last_duration != position) {
|
if (state->last_position && state->last_position + state->last_duration != position) {
|
||||||
state->alsa_sync = true;
|
state->alsa_sync = true;
|
||||||
|
|
@ -900,7 +900,8 @@ int spa_alsa_read(struct state *state, snd_pcm_uframes_t silence)
|
||||||
state->last_position, position, state->last_duration);
|
state->last_position, position, state->last_duration);
|
||||||
}
|
}
|
||||||
state->last_position = position;
|
state->last_position = position;
|
||||||
state->last_duration = duration;
|
state->last_duration = state->duration;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state->slaved && state->alsa_started) {
|
if (state->slaved && state->alsa_started) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue