}
ssize_t non_blocking_write(int fd, const void *buf, size_t count) {
- void *ibuf = buf;
+ void *ibuf = (void *)buf;
size_t bytes_remaining = count;
int rc = 0;
struct pollfd ufds[1];
// check that we can do some writing
ufds[0].fd = fd;
ufds[0].events = POLLOUT;
- rc = poll(ufds, 1, 5000);
+ rc = poll(ufds, 1, config.metadata_pipe_timeout);
if (rc < 0) {
debug(1, "error waiting for pipe to become ready for writing...");
} else if (rc == 0) {
- debug(1, "timeout waiting for pipe to become ready for writing");
+ warn("timeout waiting for pipe to become ready for writing");
rc = -2;
} else { //rc > 0, implying it might be ready
size_t bytes_written = write(fd,ibuf,bytes_remaining);
char *service_name; // the name for the shairport service, e.g. "Shairport Sync Version %v running on host %h"
#ifdef CONFIG_METADATA
int metadata_enabled;
+ int metadata_pipe_timeout; // in milliseconds
char *metadata_pipename;
char *metadata_sockaddr;
int metadata_sockport;
char *regtype; // The regtype is the service type followed by the protocol, separated by a dot, by default “_raop._tcp.”.
long audio_backend_buffer_desired_length; // this will be the desired number of frames in the
// audio backend buffer -- the DAC buffer for ALSA
- long audio_backend_latency_offset; // this will be the offset to compensate for any fixed latency
+ long audio_backend_latency_offset; // this will be the offset to compensate for any fixed latency there might be in the audio path
uint32_t volume_range_db; // the range, in dB, from max dB to min dB. Zero means use the mixer's native range.
- // there might be in the audio
} shairport_cfg;
// true if Shairport Sync is supposed to be sending output to the output device, false otherwise
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.50])
-AC_INIT([shairport-sync], [2.8.3.10], [mikebrady@eircom.net])
+AC_INIT([shairport-sync], [2.8.3.11], [mikebrady@eircom.net])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([shairport.c])
AC_CONFIG_HEADERS([config.h])
// enabled = "no"; // et to yes to get Shairport Sync to solicit metadata from the source and to pass it on via a pipe
// include_cover_art = "no"; // set to "yes" to get Shairport Sync to solicit cover art from the source and pass it via the pipe. You must also set "enabled" to "yes".
// pipe_name = "/tmp/shairport-sync-metadata";
+// pipe_timeout = 5000; // wait for this number of milliseconds for a blocked pipe to unblock before giving up
// socket_address = "226.0.0.1"; // if set to a host name or IP address, UDP packets containing metadata will be sent to this address. May be a multicast address. "socket-port" must be non-zero and "enabled" must be set to yes"
// socket_port = "5555"; // if socket_address is set, the port to send UDP packets to
// socket_msglength = "65000"; // the maximum packet size for any UDP metadata. This will be clipped to be between 500 or 65000. The default is 500.
if (config_lookup_int(config.cfg, "metadata.socket_msglength", &value)) {
config.metadata_sockmsglength = value < 500 ? 500 : value > 65000 ? 65000 : value;
}
+ if (config_lookup_int(config.cfg, "metadata.pipe_timeout", &value)) {
+
+ if ((value < 1) || (value > 150000))
+ die("Invalid timeout range \"%sd\". It should be in the range 1 to 150,000 milliseconds.",
+ value);
+ else
+ config.metadata_pipe_timeout = value;
+ }
+
#endif
if (config_lookup_string(config.cfg, "sessioncontrol.run_this_before_play_begins", &str)) {
//snprintf(config.service_name, 20 + 100, "Shairport Sync on %s", hostname);
set_requested_connection_state_to_output(1); // we expect to be able to connect to the output device
config.audio_backend_buffer_desired_length = 6615; // 0.15 seconds.
+ config.metadata_pipe_timeout = 5000; //milliseconds
config.udp_port_base = 6001;
config.udp_port_range = 100;