improve error handling

This commit is contained in:
Wim Taymans 2019-06-18 10:47:12 -04:00
parent c30d938034
commit 5850044599
6 changed files with 45 additions and 15 deletions

View file

@ -36,11 +36,20 @@ static int spa_alsa_open(struct state *state)
state->timerfd = spa_system_timerfd_create(state->data_system,
CLOCK_MONOTONIC, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK);
if (state->timerfd == -1) {
err = -errno;
goto err_close;
}
state->opened = true;
state->sample_count = 0;
state->sample_time = 0;
return 0;
err_close:
snd_pcm_close(state->hndl);
return err;
}
int spa_alsa_close(struct state *state)