stream: allow NULL param and 0 buffers in disconnect

When we are disconnecting, cleanup code might clear the params
and buffers, make sure we allow this to happen and the call the
right callbacks.
This commit is contained in:
Wim Taymans 2020-06-01 15:36:09 +02:00
parent 7f60ebff27
commit fbaa4ddedd
2 changed files with 8 additions and 8 deletions

View file

@ -611,8 +611,8 @@ static int impl_port_set_param(void *object,
struct port *port;
int res;
if (impl->disconnecting)
return param == NULL ? 0 : -EIO;
if (impl->disconnecting && param != NULL)
return -EIO;
pw_log_debug(NAME" %p: param changed: %p %d", impl, param, impl->disconnecting);
@ -650,8 +650,8 @@ static int impl_port_use_buffers(void *object,
int prot, res;
int size = 0;
if (impl->disconnecting)
return n_buffers == 0 ? 0 : -EIO;
if (impl->disconnecting && n_buffers > 0)
return -EIO;
if ((port = get_port(impl, direction, port_id)) == NULL)
return -EINVAL;

View file

@ -610,8 +610,8 @@ static int impl_port_set_param(void *object,
struct pw_stream *stream = &impl->this;
int res;
if (impl->disconnecting)
return param == NULL ? 0 : -EIO;
if (impl->disconnecting && param != NULL)
return -EIO;
pw_log_debug(NAME" %p: param id %d (%s) changed: %p", impl, id,
spa_debug_type_find_name(spa_type_param, id), param);
@ -646,8 +646,8 @@ static int impl_port_use_buffers(void *object,
int prot, res;
int size = 0;
if (impl->disconnecting)
return n_buffers == 0 ? 0 : -EIO;
if (impl->disconnecting && n_buffers > 0)
return -EIO;
prot = PROT_READ | (direction == SPA_DIRECTION_OUTPUT ? PROT_WRITE : 0);