From fdbe0543be395b7baa4b8228a035529135b8b4c1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 25 Mar 2009 01:17:56 +0100 Subject: initialize max_request to SO_SNDBUF --- src/modules/module-esound-sink.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/modules/module-esound-sink.c') diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c index 2b45e302..a27de4c3 100644 --- a/src/modules/module-esound-sink.c +++ b/src/modules/module-esound-sink.c @@ -354,6 +354,9 @@ static int do_write(struct userdata *u) { } if (!u->write_data && u->state == STATE_PREPARE) { + int so_sndbuf = 0; + socklen_t sl = sizeof(int); + /* OK, we're done with sending all control data we need to, so * let's hand the socket over to the IO thread now */ @@ -366,6 +369,13 @@ static int do_write(struct userdata *u) { pa_make_tcp_socket_low_delay(u->fd); + if (getsockopt(u->fd, SOL_SOCKET, SO_SNDBUF, &so_sndbuf, &sl) < 0) + pa_log_warn("getsockopt(SO_SNDBUF) failed: %s", pa_cstrerror(errno)); + else { + pa_log_debug("SO_SNDBUF is %zu.", (size_t) so_sndbuf); + pa_sink_set_max_request(u->sink, PA_MAX((size_t) so_sndbuf, u->block_size)); + } + pa_log_debug("Connection authenticated, handing fd to IO thread..."); pa_asyncmsgq_post(u->thread_mq.inq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_PASS_SOCKET, NULL, 0, NULL, NULL); -- cgit