alsa: handle errors from get status

And skip a cycle.
This commit is contained in:
Wim Taymans 2023-10-12 15:17:48 +02:00
parent 162f90ac3a
commit 080c40d938

View file

@ -2402,8 +2402,11 @@ static int alsa_write_sync(struct state *state, uint64_t current_time)
if (SPA_UNLIKELY((res = check_position_config(state)) < 0))
return res;
if (SPA_UNLIKELY((res = get_status(state, current_time, &avail, &delay, &target)) < 0))
if (SPA_UNLIKELY((res = get_status(state, current_time, &avail, &delay, &target)) < 0)) {
spa_log_error(state->log, "get_status error");
state->next_time += state->threshold * 1e9 / state->rate;
return res;
}
if (SPA_UNLIKELY(!following && delay > target + state->max_error)) {
spa_log_trace(state->log, "%p: early wakeup %ld %lu %lu", state,
@ -2658,8 +2661,11 @@ static int alsa_read_sync(struct state *state, uint64_t current_time)
if (SPA_UNLIKELY((res = check_position_config(state)) < 0))
return res;
if (SPA_UNLIKELY((res = get_status(state, current_time, &avail, &delay, &target)) < 0))
if (SPA_UNLIKELY((res = get_status(state, current_time, &avail, &delay, &target)) < 0)) {
spa_log_error(state->log, "get_status error");
state->next_time += state->threshold * 1e9 / state->rate;
return res;
}
if (SPA_UNLIKELY(!following && avail < state->read_size)) {
spa_log_trace(state->log, "%p: early wakeup %ld %ld %ld %d", state,