pod: first compare, then advance to next item

This commit is contained in:
Wim Taymans 2017-11-14 16:49:07 +01:00
parent 0534571f7d
commit 49d8f6792e
2 changed files with 7 additions and 6 deletions

View file

@ -367,7 +367,6 @@ int pod_filter(struct spa_pod_builder *b,
if (!spa_pod_is_inside(filter, filter_size, pf)) if (!spa_pod_is_inside(filter, filter_size, pf))
pf = NULL; pf = NULL;
} }
if (res < 0) if (res < 0)
break; break;
} }
@ -462,17 +461,17 @@ int pod_compare(const struct spa_pod *pod1, uint32_t pod1_size,
do_advance = true; do_advance = true;
break; break;
} }
if (do_advance) {
p2 = spa_pod_next(p2);
if (!spa_pod_is_inside(pod2, pod2_size, p2))
p2 = NULL;
}
if (recurse_offset) { if (recurse_offset) {
res = pod_compare(SPA_MEMBER(p1,recurse_offset,void), res = pod_compare(SPA_MEMBER(p1,recurse_offset,void),
SPA_POD_SIZE(p1) - recurse_offset, SPA_POD_SIZE(p1) - recurse_offset,
SPA_MEMBER(p2,recurse_offset,void), SPA_MEMBER(p2,recurse_offset,void),
SPA_POD_SIZE(p2) - recurse_offset); SPA_POD_SIZE(p2) - recurse_offset);
} }
if (do_advance) {
p2 = spa_pod_next(p2);
if (!spa_pod_is_inside(pod2, pod2_size, p2))
p2 = NULL;
}
if (res != 0) if (res != 0)
return res; return res;
} }

View file

@ -155,6 +155,7 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
out_state = PW_PORT_STATE_CONFIGURE; out_state = PW_PORT_STATE_CONFIGURE;
} }
else { else {
pw_log_debug("link %p: format was already set", this);
pw_node_update_state(output->node, PW_NODE_STATE_RUNNING, NULL); pw_node_update_state(output->node, PW_NODE_STATE_RUNNING, NULL);
changed = false; changed = false;
} }
@ -175,6 +176,7 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
in_state = PW_PORT_STATE_CONFIGURE; in_state = PW_PORT_STATE_CONFIGURE;
} }
else { else {
pw_log_debug("link %p: format was already set", this);
pw_node_update_state(input->node, PW_NODE_STATE_RUNNING, NULL); pw_node_update_state(input->node, PW_NODE_STATE_RUNNING, NULL);
changed = false; changed = false;
} }