mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
Add support for client fd memory
Remove the node buffers reply again. We don't need it. Instead add a new method to the client-node to upload an array of buffer datas. This method is called after the client has allocated buffer mem. It will update the buffers on the server side with the client allocated memory. Wait for the async reply of use_buffers when doing alloc_buffers so that we can get the updated buffer mem before we continue. Let the link follow the states of the ports. Add some error code to the port error states. Add PW_STREAM_FLAG_ALLOC_BUFFERS flag to make the client alloc buffer memory.
This commit is contained in:
parent
deb6c52f76
commit
e76a7abceb
18 changed files with 375 additions and 147 deletions
|
|
@ -394,12 +394,14 @@ static int negotiate_formats(struct data *data)
|
|||
|
||||
init_buffer(data, data->source_buffers, data->source_buffer, 1, BUFFER_SIZE);
|
||||
if ((res =
|
||||
spa_node_port_use_buffers(data->sink, SPA_DIRECTION_INPUT, 0, 0, data->source_buffers,
|
||||
1)) < 0)
|
||||
spa_node_port_use_buffers(data->sink,
|
||||
SPA_DIRECTION_INPUT, 0, 0,
|
||||
data->source_buffers, 1)) < 0)
|
||||
return res;
|
||||
if ((res =
|
||||
spa_node_port_use_buffers(data->source, SPA_DIRECTION_OUTPUT, 0, 0, data->source_buffers,
|
||||
1)) < 0)
|
||||
spa_node_port_use_buffers(data->source,
|
||||
SPA_DIRECTION_OUTPUT, 0, 0,
|
||||
data->source_buffers, 1)) < 0)
|
||||
return res;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -390,8 +390,9 @@ static int negotiate_formats(struct data *data)
|
|||
if ((res = sdl_alloc_buffers(data)) < 0)
|
||||
return res;
|
||||
|
||||
if ((res = spa_node_port_use_buffers(data->source, SPA_DIRECTION_OUTPUT, 0, 0, data->bp,
|
||||
data->n_buffers)) < 0) {
|
||||
if ((res = spa_node_port_use_buffers(data->source,
|
||||
SPA_DIRECTION_OUTPUT, 0, 0,
|
||||
data->bp, data->n_buffers)) < 0) {
|
||||
printf("can't allocate buffers: %s\n", spa_strerror(res));
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ struct spa_port_info {
|
|||
|
||||
#define SPA_RESULT_TYPE_NODE_ERROR 1
|
||||
#define SPA_RESULT_TYPE_NODE_PARAMS 2
|
||||
#define SPA_RESULT_TYPE_NODE_BUFFERS 3
|
||||
|
||||
/** an error result */
|
||||
struct spa_result_node_error {
|
||||
|
|
@ -128,12 +127,6 @@ struct spa_result_node_params {
|
|||
struct spa_pod *param; /**< the result param */
|
||||
};
|
||||
|
||||
/** the result of use_buffers. */
|
||||
struct spa_result_node_buffers {
|
||||
uint32_t n_buffers;
|
||||
struct spa_buffer **buffers;
|
||||
};
|
||||
|
||||
#define SPA_NODE_EVENT_INFO 0
|
||||
#define SPA_NODE_EVENT_PORT_INFO 1
|
||||
#define SPA_NODE_EVENT_RESULT 2
|
||||
|
|
@ -536,13 +529,13 @@ struct spa_node_methods {
|
|||
* Passing NULL as \a buffers will remove the reference that the port has
|
||||
* on the buffers.
|
||||
*
|
||||
* The function will emit the result event of type SPA_RESULT_TYPE_NODE_BUFFERS
|
||||
* with the final allocation of the buffers.
|
||||
* When this function returns async, use the spa_node_sync operation to
|
||||
* wait for completion.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
* \param object an object implementing the interface
|
||||
* \param direction an spa_direction
|
||||
* \param direction a port direction
|
||||
* \param port_id a port id
|
||||
* \param flags extra flags
|
||||
* \param buffers an array of buffer pointers
|
||||
|
|
|
|||
|
|
@ -1338,8 +1338,7 @@ static int spa_v4l2_use_buffers(struct impl *this, struct spa_buffer **buffers,
|
|||
|
||||
static int
|
||||
mmap_init(struct impl *this,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
struct spa_buffer **buffers, uint32_t n_buffers)
|
||||
{
|
||||
struct port *port = &this->out_ports[0];
|
||||
struct spa_v4l2_device *dev = &port->dev;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue