]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Quieten a few debug messages.
authorMike Brady <mikebrady@eircom.net>
Tue, 27 Nov 2018 17:40:07 +0000 (17:40 +0000)
committerMike Brady <mikebrady@eircom.net>
Tue, 27 Nov 2018 17:40:07 +0000 (17:40 +0000)
audio_alsa.c
player.c
rtp.c

index 5ca4836ca20ffbc8f34e63de337c79d9530c5329..2bd6efb8b4bc95147cc0843e4331a447e572c6bf 100644 (file)
@@ -874,7 +874,7 @@ int delay(long *the_delay) {
   if (alsa_handle == NULL) {
     return -ENODEV;
   } else {
-    pthread_cleanup_debug_mutex_lock(&alsa_mutex, 10000, 1);
+    pthread_cleanup_debug_mutex_lock(&alsa_mutex, 10000, 0);
     int derr;
     snd_pcm_state_t dac_state = snd_pcm_state(alsa_handle);
     if (dac_state == SND_PCM_STATE_RUNNING) {
@@ -895,6 +895,8 @@ int delay(long *the_delay) {
           // there's nothing in the pipeline, so we can't measure frame rate.
           frame_index = 0; // we'll be starting over...
           measurement_data_is_valid = 0;
+        } else if (*the_delay > 10000) {
+               debug(1,"long delay: %ld.",*the_delay);
         }
       }
     } else {
@@ -921,7 +923,7 @@ int delay(long *the_delay) {
         }
       }
     }
-    debug_mutex_unlock(&alsa_mutex, 3);
+    debug_mutex_unlock(&alsa_mutex, 0);
     pthread_cleanup_pop(0);
     // here, occasionally pretend there's a problem with pcm_get_delay()
     // if ((random() % 100000) < 3) // keep it pretty rare
@@ -960,7 +962,7 @@ static int play(void *buf, int samples) {
     pthread_cleanup_pop(0); // release the mutex
   }
   if (ret == 0) {
-    pthread_cleanup_debug_mutex_lock(&alsa_mutex, 10000, 1);
+    pthread_cleanup_debug_mutex_lock(&alsa_mutex, 10000, 0);
     //    snd_pcm_sframes_t current_delay = 0;
     int err, err2;
     if (snd_pcm_state(alsa_handle) == SND_PCM_STATE_XRUN) {
@@ -980,6 +982,7 @@ static int play(void *buf, int samples) {
       if (samples == 0)
         debug(1, "empty buffer being passed to pcm_writei -- skipping it");
       if ((samples != 0) && (buf != NULL)) {
+       debug(3,"write %d frames.",samples);
         err = alsa_pcm_write(alsa_handle, buf, samples);
         if (err < 0) {
           frame_index = 0;
@@ -1044,7 +1047,7 @@ static int play(void *buf, int samples) {
       frame_index = 0;
       measurement_data_is_valid = 0;
     }
-    debug_mutex_unlock(&alsa_mutex, 3);
+    debug_mutex_unlock(&alsa_mutex, 0);
     pthread_cleanup_pop(0); // release the mutex
   }
   return ret;
@@ -1065,7 +1068,7 @@ static void flush(void) {
 
     if ((derr = snd_pcm_hw_free(alsa_handle)))
       debug(1, "Error %d (\"%s\") freeing the output device hardware.", derr, snd_strerror(derr));
-
+    
     // flush also closes the device
     if ((derr = snd_pcm_close(alsa_handle)))
       debug(1, "Error %d (\"%s\") closing the output device.", derr, snd_strerror(derr));
index fe8a144761587a029919a1507b78d7bc194d7847..3507db6b49565e855c905a77f094d9bf987ac4bf 100644 (file)
--- a/player.c
+++ b/player.c
@@ -443,7 +443,7 @@ void player_put_packet(seq_t seqno, uint32_t actual_timestamp, uint8_t *data, in
     debug_mutex_unlock(&conn->flush_mutex, 3);
   }
 
-  debug_mutex_lock(&conn->ab_mutex, 30000, 1);
+  debug_mutex_lock(&conn->ab_mutex, 30000, 0);
   conn->packet_count++;
   conn->packet_count_since_flush++;
   conn->time_of_last_audio_packet = get_absolute_time_in_fp();
@@ -615,7 +615,7 @@ void player_put_packet(seq_t seqno, uint32_t actual_timestamp, uint8_t *data, in
       }
     }
   }
-  debug_mutex_unlock(&conn->ab_mutex, 3);
+  debug_mutex_unlock(&conn->ab_mutex, 0);
 }
 
 int32_t rand_in_range(int32_t exclusive_range_limit) {
@@ -759,7 +759,7 @@ static inline void process_sample(int32_t sample, char **outp, enum sps_format_t
 
 void buffer_get_frame_cleanup_handler(void *arg) {
   rtsp_conn_info *conn = (rtsp_conn_info *)arg;
-  debug_mutex_unlock(&conn->ab_mutex, 3);
+  debug_mutex_unlock(&conn->ab_mutex, 0);
 }
 
 // get the next frame, when available. return 0 if underrun/stream reset.
@@ -770,7 +770,7 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) {
   abuf_t *curframe = NULL;
   int notified_buffer_empty = 0; // diagnostic only
 
-  debug_mutex_lock(&conn->ab_mutex, 30000, 1);
+  debug_mutex_lock(&conn->ab_mutex, 30000, 0);
 
   int wait;
   long dac_delay = 0; // long because alsa returns a long
@@ -780,7 +780,7 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) {
   do {
     // get the time
     local_time_now = get_absolute_time_in_fp(); // type okay
-    debug(3, "buffer_get_frame is iterating");
+    // debug(3, "buffer_get_frame is iterating");
 
     int rco = get_requested_connection_state_to_output();
 
@@ -797,12 +797,12 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) {
     if (config.output->is_running)
       if (config.output->is_running() != 0) { // if the back end isn't running for any reason
         debug(3, "not running");
-        debug_mutex_lock(&conn->flush_mutex, 1000, 1);
+        debug_mutex_lock(&conn->flush_mutex, 1000, 0);
         conn->flush_requested = 1;
-        debug_mutex_unlock(&conn->flush_mutex, 3);
+        debug_mutex_unlock(&conn->flush_mutex, 0);
       }
 
-    debug_mutex_lock(&conn->flush_mutex, 1000, 1);
+    debug_mutex_lock(&conn->flush_mutex, 1000, 0);
     if (conn->flush_requested == 1) {
       if (config.output->flush)
         config.output->flush(); // no cancellation points
@@ -812,7 +812,7 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) {
       conn->time_since_play_started = 0;
       conn->flush_requested = 0;
     }
-    debug_mutex_unlock(&conn->flush_mutex, 3);
+    debug_mutex_unlock(&conn->flush_mutex, 0);
 
     if (conn->ab_synced) {
       curframe = conn->audio_buffer + BUFIDX(conn->ab_read);
@@ -2270,9 +2270,9 @@ void *player_thread_func(void *arg) {
           // update the watchdog
           if ((config.dont_check_timeout == 0) && (config.timeout != 0)) {
             uint64_t time_now = get_absolute_time_in_fp();
-            debug_mutex_lock(&conn->watchdog_mutex, 1000, 1);
+            debug_mutex_lock(&conn->watchdog_mutex, 1000, 0);
             conn->watchdog_bark_time = time_now;
-            debug_mutex_unlock(&conn->watchdog_mutex, 3);
+            debug_mutex_unlock(&conn->watchdog_mutex, 0);
           }
 
           // debug(1,"Sync error %lld frames. Amount to stuff %d." ,sync_error,amount_to_stuff);
@@ -2814,9 +2814,9 @@ void *player_watchdog_thread_code(void *arg) {
     debug(3, "Connection %d: Check the player thread is doing something...",
           conn->connection_number);
     if ((config.dont_check_timeout == 0) && (config.timeout != 0)) {
-      debug_mutex_lock(&conn->watchdog_mutex, 1000, 1);
+      debug_mutex_lock(&conn->watchdog_mutex, 1000, 0);
       uint64_t last_watchdog_bark_time = conn->watchdog_bark_time;
-      debug_mutex_unlock(&conn->watchdog_mutex, 3);
+      debug_mutex_unlock(&conn->watchdog_mutex, 0);
       if (last_watchdog_bark_time != 0) {
         uint64_t time_since_last_bark = (get_absolute_time_in_fp() - last_watchdog_bark_time) >> 32;
         uint64_t ct = config.timeout; // go from int to 64-bit int
diff --git a/rtp.c b/rtp.c
index 0c97fc31a25541f100006d50be35930c97ff69fa..dba32390cbbc9528df81280ff39f6c58e5dde44b 100644 (file)
--- a/rtp.c
+++ b/rtp.c
@@ -1040,7 +1040,7 @@ void rtp_setup(SOCKADDR *local, SOCKADDR *remote, uint16_t cport, uint16_t tport
 void get_reference_timestamp_stuff(uint32_t *timestamp, uint64_t *timestamp_time,
                                    uint64_t *remote_timestamp_time, rtsp_conn_info *conn) {
   // types okay
-  debug_mutex_lock(&conn->reference_time_mutex, 1000, 1);
+  debug_mutex_lock(&conn->reference_time_mutex, 1000, 0);
   *timestamp = conn->reference_timestamp;
   *remote_timestamp_time = conn->remote_reference_timestamp_time;
   *timestamp_time =
@@ -1048,7 +1048,7 @@ void get_reference_timestamp_stuff(uint32_t *timestamp, uint64_t *timestamp_time
   // if ((*timestamp == 0) && (*timestamp_time == 0)) {
   //  debug(1,"Reference timestamp is invalid.");
   //}
-  debug_mutex_unlock(&conn->reference_time_mutex, 3);
+  debug_mutex_unlock(&conn->reference_time_mutex, 0);
 }
 
 void clear_reference_timestamp(rtsp_conn_info *conn) {
@@ -1103,7 +1103,7 @@ int sanitised_source_rate_information(uint32_t *frames, uint64_t *time, rtsp_con
 // the reference timestamps are denominated in terms of the input rate
 
 int frame_to_local_time(uint32_t timestamp, uint64_t *time, rtsp_conn_info *conn) {
-  debug_mutex_lock(&conn->reference_time_mutex, 1000, 1);
+  debug_mutex_lock(&conn->reference_time_mutex, 1000, 0);
   int result = 0;
   uint64_t time_difference;
   uint32_t frame_difference;
@@ -1135,12 +1135,12 @@ int frame_to_local_time(uint32_t timestamp, uint64_t *time, rtsp_conn_info *conn
                                                         // on the specified fps.
   }
   *time = remote_time_of_timestamp - local_to_remote_time_difference_now(conn);
-  debug_mutex_unlock(&conn->reference_time_mutex, 3);
+  debug_mutex_unlock(&conn->reference_time_mutex, 0);
   return result;
 }
 
 int local_time_to_frame(uint64_t time, uint32_t *frame, rtsp_conn_info *conn) {
-  debug_mutex_lock(&conn->reference_time_mutex, 1000, 1);
+  debug_mutex_lock(&conn->reference_time_mutex, 1000, 0);
   int result = 0;
 
   uint64_t time_difference;
@@ -1171,7 +1171,7 @@ int local_time_to_frame(uint64_t time, uint32_t *frame, rtsp_conn_info *conn) {
     // debug(1,"Frame interval is %" PRId64 " frames.",-frame_interval);
     *frame = (conn->reference_timestamp - frame_interval);
   }
-  debug_mutex_unlock(&conn->reference_time_mutex, 3);
+  debug_mutex_unlock(&conn->reference_time_mutex, 0);
   return result;
 }