mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-27 21:37:37 -04:00
alsa: emit a node "error" event when snd_pcm_start() fails
This is meant to workaround a particular SoF firmware crash that requires the device to be closed and re-opened to recover. This works in combination with a WirePlumber monitor function that will destroy the node after it enters this error state and will re-create it.
This commit is contained in:
parent
7f9a00cd94
commit
6a0c0d45ff
1 changed files with 13 additions and 0 deletions
|
|
@ -2784,6 +2784,18 @@ static inline int do_drop(struct state *state)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int emit_node_error (struct spa_loop *loop,
|
||||
bool async, uint32_t seq, const void *data, size_t size, void *user_data)
|
||||
{
|
||||
struct state *state = user_data;
|
||||
struct spa_event event = SPA_EVENT_INIT(SPA_TYPE_EVENT_Node, SPA_NODE_EVENT_Error);
|
||||
|
||||
spa_log_info(state->log, "%s: emit SPA_NODE_EVENT_Error", state->name);
|
||||
|
||||
spa_node_emit_event(&state->hooks, &event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int do_start(struct state *state)
|
||||
{
|
||||
int res;
|
||||
|
|
@ -2792,6 +2804,7 @@ static inline int do_start(struct state *state)
|
|||
if (!state->linked && (res = snd_pcm_start(state->hndl)) < 0) {
|
||||
spa_log_error(state->log, "%s: snd_pcm_start: %s",
|
||||
state->name, snd_strerror(res));
|
||||
spa_loop_invoke(state->main_loop, emit_node_error, 0, NULL, 0, false, state);
|
||||
return res;
|
||||
}
|
||||
state->alsa_started = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue