diff --git a/audio_alsa.c b/audio_alsa.c index 3ce51b70..b105457c 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -1668,7 +1668,7 @@ static int set_mute_state() { } close_mixer(); } - debug_mutex_unlock(&alsa_mixer_mutex, 3); // release the mutex + debug_mutex_unlock(&alsa_mixer_mutex, 4); // release the mutex pthread_cleanup_pop(0); // release the mutex pthread_setcancelstate(oldState, NULL); return response; @@ -2163,7 +2163,7 @@ static int play(void *buf, int samples, __attribute__((unused)) int sample_type, } static void flush(void) { - pthread_cleanup_debug_mutex_lock(&alsa_mutex, 10000, 1); + pthread_cleanup_debug_mutex_lock(&alsa_mutex, 10000, 4); if (alsa_backend_state != abm_disconnected) { // must be playing or connected... // do nothing for a flush if config.keep_dac_busy is true if (config.keep_dac_busy == 0) { @@ -2172,7 +2172,7 @@ static void flush(void) { } else { debug(3, "alsa: flush() -- called on a disconnected alsa backend"); } - debug_mutex_unlock(&alsa_mutex, 3); + debug_mutex_unlock(&alsa_mutex, 4); pthread_cleanup_pop(0); // release the mutex } @@ -2194,7 +2194,7 @@ static void do_volume(double vol) { // caller is assumed to have the alsa_mutex int oldState; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState); // make this un-cancellable set_volume = vol; - pthread_cleanup_debug_mutex_lock(&alsa_mixer_mutex, 1000, 1); + pthread_cleanup_debug_mutex_lock(&alsa_mixer_mutex, 1000, 4); if (volume_set_request && (open_mixer() == 0)) { if (has_softvol) { if (ctl && elem_id) { @@ -2224,7 +2224,7 @@ static void do_volume(double vol) { // caller is assumed to have the alsa_mutex volume_set_request = 0; // any external request that has been made is now satisfied close_mixer(); } - debug_mutex_unlock(&alsa_mixer_mutex, 3); + debug_mutex_unlock(&alsa_mixer_mutex, 4); pthread_cleanup_pop(0); // release the mutex pthread_setcancelstate(oldState, NULL); } diff --git a/mpris-service.c b/mpris-service.c index e903e661..b7877a98 100644 --- a/mpris-service.c +++ b/mpris-service.c @@ -167,7 +167,7 @@ void mpris_metadata_watcher(struct metadata_bundle *argc, __attribute__((unused) */ // Build the metadata array - debug(2, "Build metadata"); + debug(4, "Build metadata"); GVariantBuilder *dict_builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); // Add in the artwork URI if it exists. diff --git a/player.c b/player.c index c158b43c..dc4e7582 100644 --- a/player.c +++ b/player.c @@ -1449,10 +1449,10 @@ uint32_t player_put_packet(uint32_t ssrc, seq_t seqno, uint32_t actual_timestamp // ignore a request to flush that has been made before the first packet... if (conn->packet_count == 0) { - debug_mutex_lock(&conn->flush_mutex, 1000, 1); + debug_mutex_lock(&conn->flush_mutex, 1000, 4); conn->flush_requested = 0; conn->flush_rtp_timestamp = 0; - debug_mutex_unlock(&conn->flush_mutex, 3); + debug_mutex_unlock(&conn->flush_mutex, 4); } pthread_cleanup_debug_mutex_lock(&conn->ab_mutex, 30000, 0); @@ -4354,7 +4354,7 @@ void *player_thread_func(void *arg) { gap_to_fix = (gap_to_fix_ns * RATE_FROM_ENCODED_FORMAT(config.current_output_configuration) + 1000000000/2) / 1000000000; // this is frames at the output rate - debug(3, "gap_to_fix: %u frames at input rate, %" PRId64 " frames at output rate.", -inframe->timestamp_gap, gap_to_fix); + debug(4, "gap_to_fix: %u frames at input rate, %" PRId64 " frames at output rate.", -inframe->timestamp_gap, gap_to_fix); // debug(3, "due to timstamp gap of %d frames, skip %" PRId64 " output // frames.", inframe->timestamp_gap, gap_to_fix); } @@ -4768,7 +4768,7 @@ void *player_thread_func(void *arg) { if (frames_to_skip > (unsigned int)play_samples) { debug(3, "skipping a packet of %u frames.", play_samples); debug_print_buffer( - 3, conn->outbuf, + 4, conn->outbuf, play_samples * CHANNELS_FROM_ENCODED_FORMAT(config.current_output_configuration) * sps_format_sample_size(FORMAT_FROM_ENCODED_FORMAT( @@ -4789,10 +4789,10 @@ void *player_thread_func(void *arg) { play_samples_are_timed, inframe->timestamp, should_be_time); - debug(3, "skipping the first %u frames (listed below) in a packet of %u frames.", + debug(4, "skipping the first %u frames in a packet of %u frames.", frames_to_skip, play_samples); - debug_print_buffer(3, conn->outbuf, bytes_to_skip); + debug_print_buffer(4, conn->outbuf, bytes_to_skip); frames_played += play_samples - frames_to_skip; frames_to_skip = 0; diff --git a/rtp.c b/rtp.c index d72568c2..79032ede 100644 --- a/rtp.c +++ b/rtp.c @@ -1520,7 +1520,7 @@ int frame_to_ptp_local_time(uint32_t timestamp, uint64_t *time, rtsp_conn_info * *time = ltime; result = 0; } else { - debug(2, "frame_to_ptp_local_time can't get anchor local time information"); + debug(4, "frame_to_ptp_local_time can't get anchor local time information"); } return result; } diff --git a/utilities/debug.c b/utilities/debug.c index 0aa21689..ea3a9365 100644 --- a/utilities/debug.c +++ b/utilities/debug.c @@ -196,7 +196,7 @@ void _debug(const char *filename, const int linenumber, int level, const char *f return; int oldState; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState); - char b[1024]; + char b[1024 * 64]; b[0] = 0; pthread_mutex_lock(&debug_timing_lock); uint64_t time_now = debug_get_absolute_time_in_ns(); @@ -255,18 +255,18 @@ void _debug_print_buffer(const char *thefilename, const int linenumber, int leve char *obfp = obf; unsigned int obfc; for (obfc = 0; obfc < buf_len; obfc++) { - snprintf(obfp, 3, "%02X", buf[obfc]); + snprintf(obfp, 3, "%02X", (unsigned char)buf[obfc]); obfp += 2; if (obfc != buf_len - 1) { if (obfc % 32 == 31) { snprintf(obfp, 5, " || "); - obfp += 4; + obfp += strlen(" || "); } else if (obfc % 16 == 15) { snprintf(obfp, 4, " | "); - obfp += 3; + obfp += strlen(" | ");; } else if (obfc % 4 == 3) { snprintf(obfp, 2, " "); - obfp += 1; + obfp += strlen(" ");; } } };