mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
pulse-server: move parts of client creation
Move some portions of the client creation logic into client.c so that it is easier to keep it in sync with `client_free()`, etc.
This commit is contained in:
parent
9c218b2d08
commit
6d2e6fde75
3 changed files with 26 additions and 13 deletions
|
|
@ -29,6 +29,7 @@
|
|||
#include <sys/socket.h>
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/utils/hook.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <pipewire/core.h>
|
||||
#include <pipewire/log.h>
|
||||
|
|
@ -48,6 +49,29 @@
|
|||
#include "server.h"
|
||||
#include "stream.h"
|
||||
|
||||
struct client *client_new(struct server *server)
|
||||
{
|
||||
struct client *client = calloc(1, sizeof(*client));
|
||||
if (client == NULL)
|
||||
return NULL;
|
||||
|
||||
client->ref = 1;
|
||||
client->server = server;
|
||||
client->impl = server->impl;
|
||||
client->connect_tag = SPA_ID_INVALID;
|
||||
|
||||
pw_map_init(&client->streams, 16, 16);
|
||||
spa_list_init(&client->out_messages);
|
||||
spa_list_init(&client->operations);
|
||||
spa_list_init(&client->pending_samples);
|
||||
spa_list_init(&client->pending_streams);
|
||||
|
||||
spa_list_append(&server->clients, &client->link);
|
||||
server->n_clients++;
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
static int client_free_stream(void *item, void *data)
|
||||
{
|
||||
struct stream *s = item;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue