]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Add setting for the time to wait for the metadata pipe to come ready, otherwise give...
authorMike Brady <mikebrady@eircom.net>
Mon, 23 May 2016 13:03:38 +0000 (14:03 +0100)
committerMike Brady <mikebrady@eircom.net>
Mon, 23 May 2016 13:03:38 +0000 (14:03 +0100)
common.c
common.h
configure.ac
scripts/shairport-sync.conf
shairport.c

index 6800de6f33d65f260c70d80be3517a0169d3eb62..d7c32f2f69999bccbbc0c78833e54e06c5f87057 100644 (file)
--- a/common.c
+++ b/common.c
@@ -514,7 +514,7 @@ uint64_t get_absolute_time_in_fp() {
 }
 
 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];
@@ -522,11 +522,11 @@ ssize_t non_blocking_write(int fd, const void *buf, size_t count) {
                // 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);
index dc44af4c2e536357bc9cac1cf679a305c6f0a0bf..5924be7996a77e1e8869aeb999942c2d3b89078b 100644 (file)
--- a/common.h
+++ b/common.h
@@ -54,6 +54,7 @@ typedef struct {
   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;
@@ -97,9 +98,8 @@ typedef struct {
   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
index dc9d723644bee395c26cd5b5dd651c18a4451d26..d52a032f46817f08c074d3b6bb3183502b224cf0 100644 (file)
@@ -2,7 +2,7 @@
 # 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])
index 4dd575050b322642744daedf099f31b538e3bbf1..ec0ce54139ea4fd7bc7b586e378f491eede186a9 100644 (file)
@@ -34,6 +34,7 @@ metadata =
 //     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.
index b79788e92ae00e14bf79fa04fbbd4f67293c782f..8c80bfecbfe5822567508a6d8e64018919a81bbc 100644 (file)
@@ -490,6 +490,15 @@ int parse_options(int argc, char **argv) {
       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)) {
@@ -754,6 +763,7 @@ int main(int argc, char **argv) {
   //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;