mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-18 08:56:45 -05:00
alsa: make sure we are started when draining
We need to be started before waiting for drain. Fixes #787
This commit is contained in:
parent
1a12d6082a
commit
555d5db384
1 changed files with 12 additions and 4 deletions
|
|
@ -396,14 +396,25 @@ static const struct pw_stream_events stream_events = {
|
||||||
.drained = on_stream_drained,
|
.drained = on_stream_drained,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int pipewire_start(snd_pcm_pipewire_t *pw)
|
||||||
|
{
|
||||||
|
if (!pw->activated && pw->stream != NULL) {
|
||||||
|
pw_stream_set_active(pw->stream, true);
|
||||||
|
pw->activated = true;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int snd_pcm_pipewire_drain(snd_pcm_ioplug_t *io)
|
static int snd_pcm_pipewire_drain(snd_pcm_ioplug_t *io)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
snd_pcm_pipewire_t *pw = io->private_data;
|
snd_pcm_pipewire_t *pw = io->private_data;
|
||||||
|
|
||||||
pw_thread_loop_lock(pw->main_loop);
|
pw_thread_loop_lock(pw->main_loop);
|
||||||
|
pw_log_debug(NAME" %p: drain", pw);
|
||||||
pw->drained = false;
|
pw->drained = false;
|
||||||
pw->draining = false;
|
pw->draining = false;
|
||||||
|
pipewire_start(pw);
|
||||||
while (!pw->drained && pw->error >= 0 && pw->activated) {
|
while (!pw->drained && pw->error >= 0 && pw->activated) {
|
||||||
pw_thread_loop_wait(pw->main_loop);
|
pw_thread_loop_wait(pw->main_loop);
|
||||||
}
|
}
|
||||||
|
|
@ -511,10 +522,7 @@ static int snd_pcm_pipewire_start(snd_pcm_ioplug_t *io)
|
||||||
|
|
||||||
pw_thread_loop_lock(pw->main_loop);
|
pw_thread_loop_lock(pw->main_loop);
|
||||||
pw_log_debug(NAME" %p:", pw);
|
pw_log_debug(NAME" %p:", pw);
|
||||||
if (!pw->activated && pw->stream != NULL) {
|
pipewire_start(pw);
|
||||||
pw_stream_set_active(pw->stream, true);
|
|
||||||
pw->activated = true;
|
|
||||||
}
|
|
||||||
pw_thread_loop_unlock(pw->main_loop);
|
pw_thread_loop_unlock(pw->main_loop);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue