mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pulse-server: stream: remove done flag
When the `done` flag was first added in9f9be7d7f2, it was actually needed because cleanup was implemented using a per-client eventfd which was signalled when something related to the particular client needed to be freed. The function that ran, then, checked each stream's `done` flag, and freed them as necessary. However, sincec70a5de526, the stream cleanup is done using a work queue, and as a consequence, the `done` flag is no longer needed.
This commit is contained in:
parent
4426da6a62
commit
194c0f9c99
2 changed files with 7 additions and 6 deletions
|
|
@ -970,7 +970,7 @@ static void stream_control_info(void *data, uint32_t id,
|
|||
}
|
||||
}
|
||||
|
||||
static void on_stream_cleanup(void *obj, void *data, int res, uint32_t id)
|
||||
static void do_destroy_stream(void *obj, void *data, int res, uint32_t id)
|
||||
{
|
||||
struct stream *stream = obj;
|
||||
struct client *client = stream->client;
|
||||
|
|
@ -985,27 +985,29 @@ static void stream_state_changed(void *data, enum pw_stream_state old,
|
|||
struct stream *stream = data;
|
||||
struct client *client = stream->client;
|
||||
struct impl *impl = client->impl;
|
||||
bool destroy_stream = false;
|
||||
|
||||
switch (state) {
|
||||
case PW_STREAM_STATE_ERROR:
|
||||
reply_error(client, -1, stream->create_tag, -EIO);
|
||||
stream->done = true;
|
||||
destroy_stream = true;
|
||||
break;
|
||||
case PW_STREAM_STATE_UNCONNECTED:
|
||||
if (stream->create_tag != SPA_ID_INVALID)
|
||||
reply_error(client, -1, stream->create_tag, -ENOENT);
|
||||
else
|
||||
stream->killed = true;
|
||||
stream->done = true;
|
||||
destroy_stream = true;
|
||||
break;
|
||||
case PW_STREAM_STATE_CONNECTING:
|
||||
case PW_STREAM_STATE_PAUSED:
|
||||
case PW_STREAM_STATE_STREAMING:
|
||||
break;
|
||||
}
|
||||
if (stream->done) {
|
||||
|
||||
if (destroy_stream) {
|
||||
pw_work_queue_add(impl->work_queue, stream, 0,
|
||||
on_stream_cleanup, client);
|
||||
do_destroy_stream, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ struct stream {
|
|||
unsigned int adjust_latency:1;
|
||||
unsigned int is_underrun:1;
|
||||
unsigned int in_prebuf:1;
|
||||
unsigned int done:1;
|
||||
unsigned int killed:1;
|
||||
unsigned int pending:1;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue