mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: keep track of requested bytes
Keep track of the amount of bytes we already requested from the client and don't ask for those again. Fixes initial hickups in firefox and others.
This commit is contained in:
parent
9abc7993e1
commit
aea7ace124
1 changed files with 7 additions and 0 deletions
|
|
@ -129,6 +129,7 @@ struct stream {
|
|||
uint64_t ticks_base;
|
||||
struct timeval timestamp;
|
||||
int64_t delay;
|
||||
uint32_t pending;
|
||||
|
||||
struct sample_spec ss;
|
||||
struct channel_map map;
|
||||
|
|
@ -548,6 +549,7 @@ static inline uint32_t writable_size(const struct stream *s, uint64_t elapsed)
|
|||
|
||||
queued = queued_size(s, elapsed);
|
||||
target = target_queue(s);
|
||||
target -= SPA_MIN(target, s->pending);
|
||||
wanted = wanted_size(s, queued, target);
|
||||
required = required_size(s);
|
||||
|
||||
|
|
@ -616,6 +618,8 @@ static int send_command_request(struct stream *stream)
|
|||
TAG_U32, size,
|
||||
TAG_INVALID);
|
||||
|
||||
stream->pending += size;
|
||||
|
||||
return send_message(client, msg);
|
||||
}
|
||||
|
||||
|
|
@ -636,6 +640,8 @@ static int reply_create_playback_stream(struct stream *stream)
|
|||
TAG_U32, size, /* missing/requested bytes */
|
||||
TAG_INVALID);
|
||||
|
||||
stream->pending = size;
|
||||
|
||||
if (client->version >= 9) {
|
||||
message_put(reply,
|
||||
TAG_U32, stream->attr.maxlength,
|
||||
|
|
@ -2614,6 +2620,7 @@ static int handle_memblock(struct client *client, struct message *msg)
|
|||
spa_ringbuffer_write_update(&stream->ring,
|
||||
index + msg->length);
|
||||
stream->write_index += msg->length;
|
||||
stream->pending -= SPA_MIN(stream->pending, msg->length);
|
||||
}
|
||||
res = 0;
|
||||
finish:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue