pulse-server: pending-sample: only send reply once

This commit is contained in:
Barnabás Pőcze 2023-05-07 16:07:27 +02:00 committed by Wim Taymans
parent edad053911
commit cc702dac69

View file

@ -27,20 +27,21 @@ static void sample_play_finish(struct pending_sample *ps)
static void sample_play_ready_reply(void *data, struct client *client, uint32_t tag) static void sample_play_ready_reply(void *data, struct client *client, uint32_t tag)
{ {
struct pending_sample *ps = data; struct pending_sample *ps = data;
struct message *reply;
uint32_t index = id_to_index(client->manager, ps->play->id); uint32_t index = id_to_index(client->manager, ps->play->id);
pw_log_info("[%s] PLAY_SAMPLE tag:%u index:%u", pw_log_info("[%s] PLAY_SAMPLE tag:%u index:%u",
client->name, ps->tag, index); client->name, ps->tag, index);
reply = reply_new(client, ps->tag); if (!ps->replied) {
if (client->version >= 13) struct message *reply = reply_new(client, ps->tag);
message_put(reply, if (client->version >= 13)
TAG_U32, index, message_put(reply,
TAG_INVALID); TAG_U32, index,
TAG_INVALID);
client_queue_message(client, reply); client_queue_message(client, reply);
ps->replied = true; ps->replied = true;
}
if (ps->done) if (ps->done)
sample_play_finish(ps); sample_play_finish(ps);
@ -67,7 +68,7 @@ static void sample_play_done(void *data, int res)
struct client *client = ps->client; struct client *client = ps->client;
struct impl *impl = client->impl; struct impl *impl = client->impl;
if (res < 0) { if (!ps->replied && res < 0) {
reply_error(client, COMMAND_PLAY_SAMPLE, ps->tag, res); reply_error(client, COMMAND_PLAY_SAMPLE, ps->tag, res);
ps->replied = true; ps->replied = true;
} }