Skip to content

Commit

Permalink
stream: don't ask client for more than minreq bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
i-rinat committed Mar 11, 2017
1 parent c26ac77 commit 18f74bc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/apulse-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ data_available_for_stream(pa_mainloop_api *a, pa_io_event *ioe, int fd, pa_io_ev
} else {
size_t writable_size = pa_stream_writable_size(s);

if (s->write_cb && writable_size > 0)
s->write_cb(s, writable_size, s->write_cb_userdata);
// Ask client for data, but only if we are ready for at least |minreq| bytes.
if (s->write_cb && writable_size >= s->buffer_attr.minreq)
s->write_cb(s, s->buffer_attr.minreq, s->write_cb_userdata);

size_t bytecnt = MIN(buf_size, frame_count * frame_size);
bytecnt = ringbuffer_read(s->rb, buf, bytecnt);
Expand Down

0 comments on commit 18f74bc

Please sign in to comment.