mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
alsa: safely remove the source
This commit is contained in:
parent
c5385805bd
commit
c818ab78cf
1 changed files with 13 additions and 1 deletions
|
|
@ -667,6 +667,18 @@ int spa_alsa_start(struct state *state, bool xrun_recover)
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int do_remove_source(struct spa_loop *loop,
|
||||||
|
bool async,
|
||||||
|
uint32_t seq,
|
||||||
|
size_t size,
|
||||||
|
const void *data,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
struct state *state = user_data;
|
||||||
|
spa_loop_remove_source(state->data_loop, &state->source);
|
||||||
|
return SPA_RESULT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
int spa_alsa_pause(struct state *state, bool xrun_recover)
|
int spa_alsa_pause(struct state *state, bool xrun_recover)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
@ -676,7 +688,7 @@ int spa_alsa_pause(struct state *state, bool xrun_recover)
|
||||||
|
|
||||||
spa_log_trace(state->log, "alsa %p: pause", state);
|
spa_log_trace(state->log, "alsa %p: pause", state);
|
||||||
|
|
||||||
spa_loop_remove_source(state->data_loop, &state->source);
|
spa_loop_invoke(state->data_loop, do_remove_source, 0, 0, NULL, true, state);
|
||||||
|
|
||||||
if ((err = snd_pcm_drop(state->hndl)) < 0)
|
if ((err = snd_pcm_drop(state->hndl)) < 0)
|
||||||
spa_log_error(state->log, "snd_pcm_drop %s", snd_strerror(err));
|
spa_log_error(state->log, "snd_pcm_drop %s", snd_strerror(err));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue