alsa: add extra checks

Check if the device is opened when doing _prepare or _start. When it was
a follower but failed to open, we might otherwise crash.

Fixes #3554
This commit is contained in:
Wim Taymans 2023-10-11 11:39:45 +02:00
parent 45bab72abc
commit 77651e130e

View file

@ -3020,6 +3020,9 @@ int spa_alsa_prepare(struct state *state)
struct state *follower;
int err;
if (!state->opened)
return -EIO;
spa_alsa_pause(state);
if (state->prepared)
@ -3052,6 +3055,8 @@ int spa_alsa_start(struct state *state)
if (state->started)
return 0;
else if (!state->opened)
return -EIO;
spa_alsa_prepare(state);