]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Fix a bug to ensure a silent frame is supplied to replace a missing frame.
authorMike Brady <mikebrady@eircom.net>
Wed, 8 Mar 2017 16:17:35 +0000 (16:17 +0000)
committerMike Brady <mikebrady@eircom.net>
Wed, 8 Mar 2017 16:17:35 +0000 (16:17 +0000)
player.c

index 9faa20314e991c70a770a7ff94dd1a039e2f84ba..77092228c7452dbdc9a776770c12ada921766829 100644 (file)
--- a/player.c
+++ b/player.c
@@ -1166,8 +1166,7 @@ static abuf_t *buffer_get_frame(void) {
   if (!curframe->ready) {
     // debug(1, "Supplying a silent frame for frame %u", read);
     missing_packets++;
-    memset(curframe->data, 0, input_bytes_per_frame * max_frames_per_packet);
-    curframe->timestamp = 0;
+    curframe->timestamp = 0; // indicate a silent frame should be substituted
   }
   curframe->ready = 0;
   ab_read = SUCCESSOR(ab_read);
@@ -1698,19 +1697,11 @@ static void *player_thread_func(void *arg) {
       inbuflength = inframe->length;
       if (inbuf) {
         play_number++;
-        // if it's a supplied silent frame, let us know...
         if (inframe->timestamp == 0) {
           // debug(1,"Player has a supplied silent frame.");
           last_seqno_read =
               (SUCCESSOR(last_seqno_read) & 0xffff); // manage the packet out of sequence minder
-          if (inbuf == NULL)
-            debug(1, "NULL inbuf to play -- skipping it.");
-          else {
-            if (inbuflength == 0)
-              debug(1, "empty frame to play -- skipping it (1).");
-            else
-              config.output->play(inbuf, inbuflength);
-          }
+          config.output->play(silence, max_frames_per_packet * output_sample_ratio);
         } else {
 
           int enable_dither = 0;
@@ -2067,6 +2058,7 @@ static void *player_thread_func(void *arg) {
               }
             }
           }
+          
 
           // mark the frame as finished
           inframe->timestamp = 0;