static int rtp_payload;
/** @brief RTP output socket */
-static int rtp_fd;
+static int rtp_fd = -1;
/** @brief RTP output socket (IPv6) */
static int rtp_fd6;
+/** @brief RTP unicast output socket (IPv6) */
+static int rtp_fd6 = -1;
/** @brief RTP SSRC */
static uint32_t rtp_id;
return nsamples;
}
+static void hack_send_buffer_size(int fd, const char *what) {
+ int sndbuf, target_sndbuf = 131072;
+ socklen_t len = sizeof sndbuf;
+
+ if(getsockopt(fd, SOL_SOCKET, SO_SNDBUF,
+ &sndbuf, &len) < 0)
+ disorder_fatal(errno, "error getting SO_SNDBUF on %s socket", what);
+ if(target_sndbuf > sndbuf) {
+ if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF,
+ &target_sndbuf, sizeof target_sndbuf) < 0)
+ disorder_error(errno, "error setting SO_SNDBUF on %s socket to %d",
+ what, target_sndbuf);
+ else
+ disorder_info("changed socket send buffer size on %socket from %d to %d",
+ what, sndbuf, target_sndbuf);
+ } else
+ disorder_info("default socket send buffer on %s socket is %d",
+ what, sndbuf);
+}
+
static void rtp_open(void) {
struct addrinfo *dres, *sres;
static const int one = 1;
- int sndbuf, target_sndbuf = 131072;
- socklen_t len;
struct netaddress dst[1], src[1];
const char *mode;
break;
}
}
- /* Enlarge the socket buffer */
- len = sizeof sndbuf;
- if(getsockopt(rtp_fd, SOL_SOCKET, SO_SNDBUF,
- &sndbuf, &len) < 0)
- disorder_fatal(errno, "error getting SO_SNDBUF");
- if(target_sndbuf > sndbuf) {
- if(setsockopt(rtp_fd, SOL_SOCKET, SO_SNDBUF,
- &target_sndbuf, sizeof target_sndbuf) < 0)
- disorder_error(errno, "error setting SO_SNDBUF to %d", target_sndbuf);
- else
- disorder_info("changed socket send buffer size from %d to %d",
- sndbuf, target_sndbuf);
- } else
- disorder_info("default socket send buffer is %d", sndbuf);
+ /* Enlarge the socket buffers */
+ hack_send_buffer_size(rtp_fd, "master socket");
+ hack_send_buffer_size(rtp_fd6, "IPv6 on-demand socket");
/* We might well want to set additional broadcast- or multicast-related
* options here */
if(rtp_mode != RTP_REQUEST) {
static void rtp_stop(void) {
uaudio_thread_stop();
- close(rtp_fd);
- rtp_fd = -1;
- if(rtp_fd6 >= 0) {
- close(rtp_fd6);
- rtp_fd6 = -1;
- }
+ close(rtp_fd); rtp_fd = -1;
+ if(rtp_fd6 >= 0) { close(rtp_fd6); rtp_fd6 = -1; }
}
static void rtp_configure(void) {