mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
pulse-server: Handle overlong writes from clients
When a client writes more then requested, let the requested field go negative so that it is taken into account the next time we ask for more data. Also the requested field follows the difference in the write pointer caused by seeks. See #2626 Fixes #2674
This commit is contained in:
parent
d5bc6aa2cb
commit
27211856eb
1 changed files with 4 additions and 2 deletions
|
|
@ -166,6 +166,7 @@ static int handle_memblock(struct client *client, struct message *msg)
|
|||
index += diff;
|
||||
filled += diff;
|
||||
stream->write_index += diff;
|
||||
stream->requested -= diff;
|
||||
|
||||
if (filled < 0) {
|
||||
/* underrun, reported on reader side */
|
||||
|
|
@ -182,9 +183,10 @@ static int handle_memblock(struct client *client, struct message *msg)
|
|||
msg->data,
|
||||
SPA_MIN(msg->length, MAXLENGTH));
|
||||
index += msg->length;
|
||||
stream->write_index += msg->length;
|
||||
spa_ringbuffer_write_update(&stream->ring, index);
|
||||
stream->requested -= SPA_MIN(msg->length, stream->requested);
|
||||
|
||||
stream->write_index += msg->length;
|
||||
stream->requested -= msg->length;
|
||||
|
||||
stream_send_request(stream);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue