mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-16 07:00:00 -05:00
node: handle state change errors
Keep the last error around when it's actually an error When we get the sync reply from the state change, check if we have an error. Keep the node in SUSPENDED on error.
This commit is contained in:
parent
2c2bb381b3
commit
915fba1eee
1 changed files with 14 additions and 4 deletions
|
|
@ -1294,6 +1294,7 @@ static void node_result(void *data, int seq, int res, uint32_t type, const void
|
|||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||
|
||||
pw_log_trace(NAME" %p: result seq:%d res:%d type:%u", node, seq, res, type);
|
||||
if (res < 0)
|
||||
impl->last_error = res;
|
||||
|
||||
if (SPA_RESULT_IS_ASYNC(seq))
|
||||
|
|
@ -1840,14 +1841,23 @@ error:
|
|||
static void on_state_complete(void *obj, void *data, int res, uint32_t seq)
|
||||
{
|
||||
struct pw_impl_node *node = obj;
|
||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||
enum pw_node_state state = SPA_PTR_TO_INT(data);
|
||||
char *error = NULL;
|
||||
|
||||
pw_log_debug(NAME" %p: state complete %d", node, res);
|
||||
pw_log_debug(NAME" %p: state complete res:%d seq:%d", node, res, seq);
|
||||
if (impl->last_error < 0) {
|
||||
res = impl->last_error;
|
||||
impl->last_error = 0;
|
||||
}
|
||||
if (SPA_RESULT_IS_ERROR(res)) {
|
||||
if (node->info.state == PW_NODE_STATE_SUSPENDED) {
|
||||
state = PW_NODE_STATE_SUSPENDED;
|
||||
} else {
|
||||
error = spa_aprintf("error changing node state: %s", spa_strerror(res));
|
||||
state = PW_NODE_STATE_ERROR;
|
||||
}
|
||||
}
|
||||
node_update_state(node, state, error);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue