mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
pod: handle NULL
This commit is contained in:
parent
e28b5f91b8
commit
3dba9f0fd4
10 changed files with 121 additions and 111 deletions
|
|
@ -277,6 +277,8 @@ again:
|
|||
*dt = buf->data;
|
||||
*sz = buf->size;
|
||||
|
||||
spa_debug_pod (data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -308,7 +310,7 @@ pinos_connection_end_write (PinosConnection *conn,
|
|||
|
||||
buf->buffer_size += 8 + size;
|
||||
|
||||
// spa_debug_pod (p);
|
||||
spa_debug_pod (p);
|
||||
|
||||
pinos_signal_emit (&conn->need_flush, conn);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -461,17 +461,11 @@ client_node_marshal_update (void *object,
|
|||
|
||||
core_update_map (proxy->context);
|
||||
|
||||
spa_pod_builder_add (&b.b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
spa_pod_builder_struct (&b.b, &f,
|
||||
SPA_POD_TYPE_INT, change_mask,
|
||||
SPA_POD_TYPE_INT, max_input_ports,
|
||||
SPA_POD_TYPE_INT, max_output_ports,
|
||||
SPA_POD_TYPE_INT, props ? 1 : 0,
|
||||
0);
|
||||
|
||||
if (props)
|
||||
spa_pod_builder_add (&b.b, SPA_POD_TYPE_POD, props, 0);
|
||||
spa_pod_builder_add (&b.b, -SPA_POD_TYPE_STRUCT, &f, 0);
|
||||
SPA_POD_TYPE_POD, props);
|
||||
|
||||
pinos_connection_end_write (connection, proxy->id, 0, b.b.offset);
|
||||
}
|
||||
|
|
@ -506,12 +500,11 @@ client_node_marshal_port_update (void *object,
|
|||
for (i = 0; i < n_possible_formats; i++)
|
||||
spa_pod_builder_add (&b.b, SPA_POD_TYPE_POD, possible_formats[i], 0);
|
||||
|
||||
spa_pod_builder_add (&b.b, SPA_POD_TYPE_INT, format ? 1 : 0, 0);
|
||||
if (format)
|
||||
spa_pod_builder_add (&b.b, SPA_POD_TYPE_POD, format, 0);
|
||||
spa_pod_builder_add (&b.b, SPA_POD_TYPE_INT, props ? 1 : 0, 0);
|
||||
if (props)
|
||||
spa_pod_builder_add (&b.b, SPA_POD_TYPE_POD, props, 0);
|
||||
spa_pod_builder_add (&b.b,
|
||||
SPA_POD_TYPE_POD, format,
|
||||
SPA_POD_TYPE_POD, props,
|
||||
0);
|
||||
|
||||
spa_pod_builder_add (&b.b, SPA_POD_TYPE_INT, info ? 1 : 0, 0);
|
||||
if (info) {
|
||||
spa_pod_builder_add (&b.b,
|
||||
|
|
@ -678,7 +671,7 @@ client_node_demarshal_set_format (void *object,
|
|||
{
|
||||
PinosProxy *proxy = object;
|
||||
SpaPODIter it;
|
||||
uint32_t seq, direction, port_id, flags, have_format;
|
||||
uint32_t seq, direction, port_id, flags;
|
||||
const SpaFormat *format = NULL;
|
||||
|
||||
if (!spa_pod_iter_struct (&it, data, size) ||
|
||||
|
|
@ -687,13 +680,10 @@ client_node_demarshal_set_format (void *object,
|
|||
SPA_POD_TYPE_INT, &direction,
|
||||
SPA_POD_TYPE_INT, &port_id,
|
||||
SPA_POD_TYPE_INT, &flags,
|
||||
SPA_POD_TYPE_INT, &have_format,
|
||||
SPA_POD_TYPE_OBJECT, &format,
|
||||
0))
|
||||
return false;
|
||||
|
||||
if (have_format && !spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &format, 0))
|
||||
return false;
|
||||
|
||||
((PinosClientNodeEvents*)proxy->implementation)->set_format (proxy, seq, direction, port_id,
|
||||
flags, format);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -153,14 +153,15 @@ connection_data (SpaSource *source,
|
|||
}
|
||||
if (opcode >= resource->iface->n_methods) {
|
||||
pinos_log_error ("protocol-native %p: invalid method %u", client->impl, opcode);
|
||||
continue;
|
||||
client_destroy (client);
|
||||
break;
|
||||
}
|
||||
demarshal = resource->iface->methods;
|
||||
if (demarshal[opcode]) {
|
||||
if (!demarshal[opcode] (resource, message, size))
|
||||
pinos_log_error ("protocol-native %p: invalid message received", client->impl);
|
||||
} else
|
||||
pinos_log_error ("protocol-native %p: function %d not implemented", client->impl, opcode);
|
||||
if (!demarshal[opcode] || !demarshal[opcode] (resource, message, size)) {
|
||||
pinos_log_error ("protocol-native %p: invalid message received", client->impl);
|
||||
client_destroy (client);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -619,16 +619,12 @@ client_node_marshal_set_format (void *object,
|
|||
|
||||
core_update_map (resource->client);
|
||||
|
||||
spa_pod_builder_add (&b.b,
|
||||
SPA_POD_TYPE_STRUCT, &f,
|
||||
SPA_POD_TYPE_INT, seq,
|
||||
SPA_POD_TYPE_INT, direction,
|
||||
SPA_POD_TYPE_INT, port_id,
|
||||
SPA_POD_TYPE_INT, flags,
|
||||
SPA_POD_TYPE_INT, format ? 1 : 0, 0);
|
||||
if (format)
|
||||
spa_pod_builder_add (&b.b, SPA_POD_TYPE_POD, format, 0);
|
||||
spa_pod_builder_add (&b.b, -SPA_POD_TYPE_STRUCT, &f, 0);
|
||||
spa_pod_builder_struct (&b.b, &f,
|
||||
SPA_POD_TYPE_INT, seq,
|
||||
SPA_POD_TYPE_INT, direction,
|
||||
SPA_POD_TYPE_INT, port_id,
|
||||
SPA_POD_TYPE_INT, flags,
|
||||
SPA_POD_TYPE_POD, format);
|
||||
|
||||
pinos_connection_end_write (connection, resource->id, 4, b.b.offset);
|
||||
}
|
||||
|
|
@ -807,21 +803,18 @@ client_node_demarshal_update (void *object,
|
|||
{
|
||||
PinosResource *resource = object;
|
||||
SpaPODIter it;
|
||||
uint32_t change_mask, max_input_ports, max_output_ports, have_props;
|
||||
const SpaProps *props = NULL;
|
||||
uint32_t change_mask, max_input_ports, max_output_ports;
|
||||
const SpaProps *props;
|
||||
|
||||
if (!spa_pod_iter_struct (&it, data, size) ||
|
||||
!spa_pod_iter_get (&it,
|
||||
SPA_POD_TYPE_INT, &change_mask,
|
||||
SPA_POD_TYPE_INT, &max_input_ports,
|
||||
SPA_POD_TYPE_INT, &max_output_ports,
|
||||
SPA_POD_TYPE_INT, &have_props,
|
||||
SPA_POD_TYPE_OBJECT, &props,
|
||||
0))
|
||||
return false;
|
||||
|
||||
if (have_props && !spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &props, 0))
|
||||
return false;
|
||||
|
||||
((PinosClientNodeMethods*)resource->implementation)->update (resource, change_mask, max_input_ports, max_output_ports, props);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -852,12 +845,10 @@ client_node_demarshal_port_update (void *object,
|
|||
if (!spa_pod_iter_get (&it,SPA_POD_TYPE_OBJECT, &possible_formats[i], 0))
|
||||
return false;
|
||||
|
||||
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_INT, &t, 0) ||
|
||||
(t && !spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &format, 0)))
|
||||
return false;
|
||||
|
||||
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_INT, &t, 0) ||
|
||||
(t && !spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &props, 0)))
|
||||
if (!spa_pod_iter_get (&it,
|
||||
SPA_POD_TYPE_OBJECT, &format,
|
||||
SPA_POD_TYPE_OBJECT, &props,
|
||||
0))
|
||||
return false;
|
||||
|
||||
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_INT, &t, 0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue