alsa: refactor a bit

Make spa_alsa_close() do spa_alsa_pause() first and also clear the
format.
This commit is contained in:
Wim Taymans 2021-11-23 12:20:27 +01:00
parent 13923416e0
commit 25bfc9c63d
3 changed files with 9 additions and 11 deletions

View file

@ -644,11 +644,8 @@ static int port_set_format(void *object,
return 0;
spa_log_debug(this->log, "clear format");
this->card->format_ref--;
spa_alsa_pause(this);
clear_buffers(this);
spa_alsa_close(this);
this->have_format = false;
clear_buffers(this);
} else {
struct spa_audio_info info = { 0 };
@ -679,7 +676,6 @@ static int port_set_format(void *object,
return err;
this->current_format = info;
this->have_format = true;
}
this->info.change_mask |= SPA_NODE_CHANGE_MASK_PROPS;
@ -1025,7 +1021,6 @@ impl_init(const struct spa_handle_factory *factory,
this->multi_rate = spa_atob(s);
}
}
return spa_alsa_init(this);
}