mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
latency
esound volume changing git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@43 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
d571be6f51
commit
961fb4466a
7 changed files with 167 additions and 23 deletions
41
src/util.c
41
src/util.c
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue