diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-06-30 00:00:52 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-06-30 00:00:52 +0000 |
commit | 961fb4466a9396a11f1a9a6e7d4193409b8949d6 (patch) | |
tree | f715643d1c226b1063be40ed0f78a4511b26c67d /src/util.c | |
parent | d571be6f5109ff5b256e4c14f391c916264f0a8e (diff) |
latency
esound volume changing
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@43 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -7,6 +7,8 @@ #include <fcntl.h> #include <unistd.h> #include <sys/types.h> +#include <netinet/tcp.h> +#include <netinet/ip.h> #include "util.h" @@ -83,3 +85,42 @@ fail: rmdir(dir); return -1; } + +int make_socket_low_delay(int fd) { + int ret = 0, buf_size, priority; + + assert(fd >= 0); + + buf_size = 1024; + if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &buf_size, sizeof(buf_size)) < 0) + ret = -1; + + buf_size = 1024; + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &buf_size, sizeof(buf_size)) < 0) + ret = -1; + + priority = 7; + if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &priority, sizeof(priority)) < 0) + ret = -1; + + return ret; +} + +int make_tcp_socket_low_delay(int fd) { + int ret, tos, on; + + assert(fd >= 0); + + ret = make_socket_low_delay(fd); + + on = 1; + if (setsockopt(fd, SOL_TCP, TCP_NODELAY, &on, sizeof(on)) < 0) + ret = -1; + + tos = IPTOS_LOWDELAY; + if (setsockopt(fd, SOL_IP, IP_TOS, &tos, sizeof(tos)) < 0) + ret = -1; + + return ret; + +} |