[pulseaudio-commits] r1860 - in /branches/lennart/src/pulsecore: socket-util.c socket-util.h
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Tue Sep 18 15:24:45 PDT 2007
Author: lennart
Date: Wed Sep 19 00:24:45 2007
New Revision: 1860
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1860&root=pulseaudio&view=rev
Log:
add new pa_socket_udp_low_delay() API
Modified:
branches/lennart/src/pulsecore/socket-util.c
branches/lennart/src/pulsecore/socket-util.h
Modified: branches/lennart/src/pulsecore/socket-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/socket-util.c?rev=1860&root=pulseaudio&r1=1859&r2=1860&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/socket-util.c (original)
+++ branches/lennart/src/pulsecore/socket-util.c Wed Sep 19 00:24:45 2007
@@ -144,13 +144,16 @@
}
int pa_socket_low_delay(int fd) {
+
#ifdef SO_PRIORITY
int priority;
pa_assert(fd >= 0);
priority = 7;
- if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, (void*)&priority, sizeof(priority)) < 0)
+ if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, (void*)&priority, sizeof(priority)) < 0) {
+ pa_log_warn("SO_PRIORITY failed: %s", pa_cstrerror(errno));
return -1;
+ }
#endif
return 0;
@@ -172,7 +175,10 @@
#else
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*)&on, sizeof(on)) < 0)
#endif
+ {
+ pa_log_warn("TCP_NODELAY failed: %s", pa_cstrerror(errno));
ret = -1;
+ }
#endif
#if defined(IPTOS_LOWDELAY) && defined(IP_TOS) && (defined(SOL_IP) || defined(IPPROTO_IP))
@@ -182,7 +188,35 @@
#else
if (setsockopt(fd, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
#endif
+ {
+ pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno));
ret = -1;
+ }
+#endif
+
+ return ret;
+}
+
+int pa_socket_udp_low_delay(int fd) {
+ int ret, tos;
+
+ pa_assert(fd >= 0);
+
+ ret = pa_socket_low_delay(fd);
+
+ tos = 0;
+
+#if defined(IPTOS_LOWDELAY) && defined(IP_TOS) && (defined(SOL_IP) || defined(IPPROTO_IP))
+ tos = IPTOS_LOWDELAY;
+#ifdef SOL_IP
+ if (setsockopt(fd, SOL_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
+#else
+ if (setsockopt(fd, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
+#endif
+ {
+ ret = -1;
+ pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno));
+ }
#endif
return ret;
Modified: branches/lennart/src/pulsecore/socket-util.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/socket-util.h?rev=1860&root=pulseaudio&r1=1859&r2=1860&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/socket-util.h (original)
+++ branches/lennart/src/pulsecore/socket-util.h Wed Sep 19 00:24:45 2007
@@ -31,6 +31,7 @@
int pa_socket_low_delay(int fd);
int pa_socket_tcp_low_delay(int fd);
+int pa_socket_udp_low_delay(int fd);
int pa_socket_set_sndbuf(int fd, size_t l);
int pa_socket_set_rcvbuf(int fd, size_t l);
More information about the pulseaudio-commits
mailing list