mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: disable htimestamp when it seems to error too much
This commit is contained in:
parent
f76191c792
commit
2963e7fd4c
2 changed files with 15 additions and 3 deletions
|
|
@ -2028,9 +2028,18 @@ static int get_avail_htimestamp(struct state *state, uint64_t current_time, snd_
|
||||||
|
|
||||||
if (SPA_ABS(diff) < state->threshold) {
|
if (SPA_ABS(diff) < state->threshold) {
|
||||||
*delay += diff;
|
*delay += diff;
|
||||||
} else if ((missed = ratelimit_test(&state->rate_limit, current_time)) >= 0) {
|
state->htimestamp_error = 0;
|
||||||
spa_log_warn(state->log, "%s: (%d missed) impossible htimestamp diff:%"PRIi64,
|
} else {
|
||||||
state->props.device, missed, diff);
|
if (++state->htimestamp_error > MAX_HTIMESTAMP_ERROR) {
|
||||||
|
spa_log_error(state->log, "%s: wrong htimestamps from driver, disabling",
|
||||||
|
state->props.device);
|
||||||
|
state->htimestamp_error = 0;
|
||||||
|
state->htimestamp = false;
|
||||||
|
}
|
||||||
|
else if ((missed = ratelimit_test(&state->rate_limit, current_time)) >= 0) {
|
||||||
|
spa_log_warn(state->log, "%s: (%d missed) impossible htimestamp diff:%"PRIi64,
|
||||||
|
state->props.device, missed, diff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SPA_MIN(avail, state->buffer_frames);
|
return SPA_MIN(avail, state->buffer_frames);
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ extern "C" {
|
||||||
#define DEFAULT_CHANNELS 2u
|
#define DEFAULT_CHANNELS 2u
|
||||||
#define DEFAULT_USE_CHMAP false
|
#define DEFAULT_USE_CHMAP false
|
||||||
|
|
||||||
|
#define MAX_HTIMESTAMP_ERROR 64
|
||||||
|
|
||||||
struct props {
|
struct props {
|
||||||
char device[64];
|
char device[64];
|
||||||
char device_name[128];
|
char device_name[128];
|
||||||
|
|
@ -185,6 +187,7 @@ struct state {
|
||||||
uint32_t start_delay;
|
uint32_t start_delay;
|
||||||
uint32_t min_delay;
|
uint32_t min_delay;
|
||||||
uint32_t max_delay;
|
uint32_t max_delay;
|
||||||
|
uint32_t htimestamp_error;
|
||||||
|
|
||||||
uint32_t duration;
|
uint32_t duration;
|
||||||
unsigned int alsa_started:1;
|
unsigned int alsa_started:1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue