adapter:handle -ENOENT when enumerating buffers

When the follower has no buffer suggestion, it can return -ENOENT, which
should not generate an error but simply use the converter buffer
suggestion instead.
This commit is contained in:
Wim Taymans 2025-05-27 15:00:43 +02:00
parent eda42ef2fc
commit 62a719d71a
2 changed files with 20 additions and 12 deletions

View file

@ -449,8 +449,9 @@ static int negotiate_buffers(struct impl *this)
if (res == -ENOENT) if (res == -ENOENT)
param = NULL; param = NULL;
else { else {
debug_params(this, this->follower, this->direction, 0, debug_params(this, this->target,
SPA_PARAM_Buffers, param, "follower buffers", res); SPA_DIRECTION_REVERSE(this->direction), 0,
SPA_PARAM_Buffers, param, "target buffers", res);
return res; return res;
} }
} }
@ -460,10 +461,13 @@ static int negotiate_buffers(struct impl *this)
this->direction, 0, this->direction, 0,
SPA_PARAM_Buffers, &state, SPA_PARAM_Buffers, &state,
param, &param, &b)) != 1) { param, &param, &b)) != 1) {
debug_params(this, this->target, if (res == -ENOENT)
SPA_DIRECTION_REVERSE(this->direction), 0, res = 0;
SPA_PARAM_Buffers, param, "convert buffers", res); else {
return -ENOTSUP; debug_params(this, this->follower, this->direction, 0,
SPA_PARAM_Buffers, param, "follower buffers", res);
return res < 0 ? res : -ENOTSUP;
}
} }
if (param == NULL) if (param == NULL)
return -ENOTSUP; return -ENOTSUP;

View file

@ -423,8 +423,9 @@ static int negotiate_buffers(struct impl *this)
if (res == -ENOENT) if (res == -ENOENT)
param = NULL; param = NULL;
else { else {
debug_params(this, this->follower, this->direction, 0, debug_params(this, this->target,
SPA_PARAM_Buffers, param, "follower buffers", res); SPA_DIRECTION_REVERSE(this->direction), 0,
SPA_PARAM_Buffers, param, "target buffers", res);
return res; return res;
} }
} }
@ -434,10 +435,13 @@ static int negotiate_buffers(struct impl *this)
this->direction, 0, this->direction, 0,
SPA_PARAM_Buffers, &state, SPA_PARAM_Buffers, &state,
param, &param, &b)) != 1) { param, &param, &b)) != 1) {
debug_params(this, this->target, if (res == -ENOENT)
SPA_DIRECTION_REVERSE(this->direction), 0, res = 0;
SPA_PARAM_Buffers, param, "convert buffers", res); else {
return -ENOTSUP; debug_params(this, this->follower, this->direction, 0,
SPA_PARAM_Buffers, param, "follower buffers", res);
return res < 0 ? res : -ENOTSUP;
}
} }
if (param == NULL) if (param == NULL)
return -ENOTSUP; return -ENOTSUP;