clients/playrtp.c: Don't crash if given `-' on the command line.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 4 May 2020 13:10:23 +0000 (14:10 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 4 May 2020 18:57:12 +0000 (19:57 +0100)
That just means that we didn't get the `-' from the server, so we must
open a connection for ourselves.  We'll still need it to request the RTP
stream.

clients/playrtp.c

index d28369f..8878e8c 100644 (file)
@@ -795,6 +795,12 @@ int main(int argc, char **argv) {
   struct sockaddr *addr;
   socklen_t addr_len;
   if(!strcmp(sl.s[0], "-")) {
+    /* We'll need a connection to request the incoming stream, so open one if
+     * we don't have one already */
+    if(!c) {
+      if(!(c = disorder_new(1))) exit(EXIT_FAILURE);
+      if(disorder_connect(c)) exit(EXIT_FAILURE);
+    }
     /* Pick address family to match known-working connectivity to the server */
     int family = disorder_client_af(c);
     /* Get a list of interfaces */