mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-06 06:46:29 -04:00
alsa: clean up the pitch element on errors
This commit is contained in:
parent
9946f5ec77
commit
c8b9b44d40
1 changed files with 18 additions and 11 deletions
|
|
@ -1158,25 +1158,32 @@ static int probe_pitch_ctl(struct state *state)
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
spa_log_debug(state->log, "%s: did not find ctl: %s",
|
spa_log_debug(state->log, "%s: did not find ctl: %s",
|
||||||
elem_name, snd_strerror(err));
|
elem_name, snd_strerror(err));
|
||||||
|
|
||||||
snd_ctl_elem_value_free(state->pitch_elem);
|
|
||||||
state->pitch_elem = NULL;
|
|
||||||
|
|
||||||
if (opened) {
|
|
||||||
snd_ctl_close(state->ctl);
|
|
||||||
state->ctl = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_ctl_elem_value_set_integer(state->pitch_elem, 0, 1000000);
|
snd_ctl_elem_value_set_integer(state->pitch_elem, 0, 1000000);
|
||||||
CHECK(snd_ctl_elem_write(state->ctl, state->pitch_elem), "snd_ctl_elem_write");
|
err = snd_ctl_elem_write(state->ctl, state->pitch_elem);
|
||||||
|
if (err < 0) {
|
||||||
|
spa_log_error(state->log, "snd_ctl_elem_write: %s", snd_strerror(err));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
state->last_rate = 1.0;
|
state->last_rate = 1.0;
|
||||||
|
|
||||||
spa_log_info(state->log, "found ctl %s", elem_name);
|
spa_log_info(state->log, "found ctl %s", elem_name);
|
||||||
err = 0;
|
|
||||||
|
snd_lib_error_set_handler(NULL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
if (state->pitch_elem != NULL) {
|
||||||
|
snd_ctl_elem_value_free(state->pitch_elem);
|
||||||
|
state->pitch_elem = NULL;
|
||||||
|
}
|
||||||
|
if (opened) {
|
||||||
|
snd_ctl_close(state->ctl);
|
||||||
|
state->ctl = NULL;
|
||||||
|
}
|
||||||
snd_lib_error_set_handler(NULL);
|
snd_lib_error_set_handler(NULL);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue