Skip to content

Commit daa985e

Browse files
committed
Turn off many currently-irrelevant debug messages by setting their level to 4, meaning they will never be displayed.
1 parent 8aa7069 commit daa985e

File tree

7 files changed

+93
-85
lines changed

7 files changed

+93
-85
lines changed

ap2_buffered_audio_processor.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ void *rtp_buffered_audio_processor(void *arg) {
332332

333333
if (finished == 0) {
334334
pthread_cleanup_debug_mutex_lock(&conn->flush_mutex, 25000,
335-
1); // 25 ms is a long time to wait!
335+
4); // 25 ms is a long time to wait!
336336
if (blocks_read != 0) {
337337
if (conn->ap2_immediate_flush_requested != 0) {
338338
if (ap2_immediate_flush_requested == 0) {
@@ -422,9 +422,12 @@ void *rtp_buffered_audio_processor(void *arg) {
422422
} else if (conn->ap2_deferred_flush_requests[f].active != 0) {
423423
new_audio_block_needed = 1;
424424
debug(3,
425-
"deferred flush of block: %u. flushFromTS: %12u, flushFromSeq: %12u, "
425+
"deferred flush of block: %u, timestamp: %u, SSRC: \"%s\". flushFromTS: %12u, flushFromSeq: %12u, "
426426
"flushUntilTS: %12u, flushUntilSeq: %12u, timestamp: %12u.",
427-
seq_no, conn->ap2_deferred_flush_requests[f].flushFromTS,
427+
seq_no,
428+
timestamp,
429+
get_ssrc_name(payload_ssrc),
430+
conn->ap2_deferred_flush_requests[f].flushFromTS,
428431
conn->ap2_deferred_flush_requests[f].flushFromSeq,
429432
conn->ap2_deferred_flush_requests[f].flushUntilTS,
430433
conn->ap2_deferred_flush_requests[f].flushUntilSeq, timestamp);
@@ -589,7 +592,7 @@ void *rtp_buffered_audio_processor(void *arg) {
589592
uint32_t packet_size = player_put_packet(
590593
payload_ssrc, sequence_number_for_player, timestamp, payload_pointer,
591594
payload_length, mute, timestamp_difference, conn);
592-
debug(3, "block %u, timestamp %u, length %u sent to the player.", seq_no,
595+
debug(4, "block %u, timestamp %u, length %u sent to the player.", seq_no,
593596
timestamp, packet_size);
594597
sequence_number_for_player++; // simply increment
595598
expected_timestamp = timestamp + packet_size; // for the next time

audio_alsa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ static int do_play(void *buf, int samples) {
19871987
}
19881988

19891989
snd_pcm_state_t prior_state = state; // keep this for afterwards....
1990-
debug(3, "alsa: write %d frames.", samples);
1990+
debug(4, "alsa: write %d frames.", samples);
19911991
ret = alsa_pcm_write(alsa_handle, buf, samples);
19921992
if (ret == -EIO) {
19931993
debug(1, "alsa: I/O Error.");
@@ -2380,7 +2380,7 @@ static void *alsa_buffer_monitor_thread_code(__attribute__((unused)) void *arg)
23802380
dither_random_number_store, current_encoded_output_format);
23812381

23822382
ret = do_play(silence, frames_of_silence);
2383-
debug(3, "Played %u frames of silence on %u channels, equal to %zu bytes.",
2383+
debug(4, "Played %u frames of silence on %u channels, equal to %zu bytes.",
23842384
frames_of_silence, CHANNELS_FROM_ENCODED_FORMAT(current_encoded_output_format),
23852385
size_of_silence_buffer);
23862386
frame_count++;

dacp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ void *dacp_monitor_thread_code(__attribute__((unused)) void *na) {
517517
while (1) {
518518
int result = 0;
519519
int32_t the_volume;
520-
pthread_cleanup_debug_mutex_lock(&dacp_server_information_lock, 500000, 2);
520+
pthread_cleanup_debug_mutex_lock(&dacp_server_information_lock, 500000, 4);
521521
if (dacp_server.scan_enable == 0) {
522522
metadata_hub_modify_prolog();
523523
int ch = (metadata_store.dacp_server_active != 0) ||

metadata_hub.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ void metadata_hub_process_metadata(uint32_t type, uint32_t code, char *data, uin
373373
vl = vl << 32; // shift them into the correct location
374374
uint64_t ul = ntohl(*(uint32_t *)(data + sizeof(uint32_t))); // and the low order 32 bits
375375
vl = vl + ul;
376-
debug(3, "MH Item ID seen: \"%" PRIx64 "\" of length %u.", vl, length);
376+
debug(4, "MH Item ID seen: \"%" PRIx64 "\" of length %u.", vl, length);
377377
if ((vl != metadata_store.item_id) || (metadata_store.item_id_is_valid == 0)) {
378378
metadata_store.item_id = vl;
379379
metadata_store.item_id_changed = 1;
@@ -528,14 +528,14 @@ void metadata_hub_process_metadata(uint32_t type, uint32_t code, char *data, uin
528528
case 'pcen':
529529
break;
530530
case 'mdst':
531-
debug(3, "MH Metadata stream processing start.");
531+
debug(4, "MH Metadata stream processing start.");
532532
metadata_packet_item_changed = 0;
533533
break;
534534
case 'mden':
535535
if (metadata_packet_item_changed != 0)
536536
debug(3, "MH Metadata stream processing end with changes.");
537537
else
538-
debug(3, "MH Metadata stream processing end without changes.");
538+
debug(4, "MH Metadata stream processing end without changes.");
539539
changed = metadata_packet_item_changed;
540540
break;
541541
case 'PICT':

player.c

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ static void swr_alloc_cleanup_handler(void *arg) {
402402
}
403403

404404
static void av_packet_alloc_cleanup_handler(void *arg) {
405-
debug(3, "av_packet_alloc_cleanup_handler");
405+
debug(4, "av_packet_alloc_cleanup_handler");
406406
AVPacket **pkt = arg;
407407
av_packet_free(pkt);
408408
}
@@ -1144,7 +1144,7 @@ int64_t avframe_to_audio(rtsp_conn_info *conn, AVFrame *decoded_frame, uint8_t *
11441144

11451145
int number_of_output_samples_expected = swr_get_out_samples(conn->swr, decoded_frame->nb_samples);
11461146

1147-
debug(3, "A maximum of %d output samples expected for %d input samples.",
1147+
debug(4, "A maximum of %d output samples expected for %d input samples.",
11481148
number_of_output_samples_expected, decoded_frame->nb_samples);
11491149
// allocate enough space for the required number of output channels
11501150
// and the number of samples decoded
@@ -1155,10 +1155,10 @@ int64_t avframe_to_audio(rtsp_conn_info *conn, AVFrame *decoded_frame, uint8_t *
11551155
int samples_generated =
11561156
swr_convert(conn->swr, &pcm_audio, number_of_output_samples_expected,
11571157
(const uint8_t **)decoded_frame->extended_data, decoded_frame->nb_samples);
1158-
debug(3, "conversion time for %u incoming samples: %.3f milliseconds.", decoded_frame->nb_samples,
1158+
debug(4, "conversion time for %u incoming samples: %.3f milliseconds.", decoded_frame->nb_samples,
11591159
(get_absolute_time_in_ns() - conversion_start_time) * 0.000001);
11601160
if (samples_generated > 0) {
1161-
debug(3, "swr generated %d frames of %" PRId64 " channels.", samples_generated,
1161+
debug(4, "swr generated %d frames of %" PRId64 " channels.", samples_generated,
11621162
conn->resampler_output_channels);
11631163
// samples_generated will be different from
11641164
// the number of samples input if the output rate is different from the input
@@ -2296,7 +2296,7 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn, int resync_requested) {
22962296
uint64_t should_be_time;
22972297
frame_to_local_time(curframe->timestamp, &should_be_time, conn);
22982298
int64_t time_difference = should_be_time - get_absolute_time_in_ns();
2299-
debug(3, "Check packet from buffer %u, timestamp %u, %f seconds ahead.", conn->ab_read,
2299+
debug(4, "Check packet from buffer %u, timestamp %u, %f seconds ahead.", conn->ab_read,
23002300
curframe->timestamp, 0.000000001 * time_difference);
23012301
} else {
23022302
debug(3, "Check packet from buffer %u, empty.", conn->ab_read);
@@ -3210,8 +3210,8 @@ int stuff_buffer_soxr_32(int32_t *inptr, int length, sps_format_t l_output_forma
32103210
};
32113211
}
32123212

3213-
if (packets_processed % 1250 == 0) {
3214-
debug(3,
3213+
if ((packets_processed % 1250 == 0) && (stat_n > 0)) {
3214+
debug(4,
32153215
"soxr_oneshot execution time in nanoseconds: mean, standard deviation and max "
32163216
"for %" PRId32 " interpolations in the last "
32173217
"1250 packets. %10.6f, %10.6f, %10.6f.",
@@ -4269,7 +4269,7 @@ void *player_thread_func(void *arg) {
42694269
output_buffer_delay_time =
42704270
output_buffer_delay_time /
42714271
RATE_FROM_ENCODED_FORMAT(config.current_output_configuration);
4272-
debug(3,
4272+
debug(4,
42734273
"current_delay: %" PRId64 ", output_buffer_delay_time: %.3f, output rate: %u.",
42744274
current_delay, output_buffer_delay_time * 0.000000001,
42754275
RATE_FROM_ENCODED_FORMAT(config.current_output_configuration));
@@ -4352,8 +4352,9 @@ void *player_thread_func(void *arg) {
43524352
gap_to_fix = -inframe->timestamp_gap; // this is frames at the input rate
43534353
int64_t gap_to_fix_ns = (gap_to_fix * 1000000000) / conn->input_rate;
43544354
gap_to_fix = (gap_to_fix_ns *
4355-
RATE_FROM_ENCODED_FORMAT(config.current_output_configuration)) /
4355+
RATE_FROM_ENCODED_FORMAT(config.current_output_configuration) + 1000000000/2) /
43564356
1000000000; // this is frames at the output rate
4357+
debug(3, "gap_to_fix: %u frames at input rate, %" PRId64 " frames at output rate.", -inframe->timestamp_gap, gap_to_fix);
43574358
// debug(3, "due to timstamp gap of %d frames, skip %" PRId64 " output
43584359
// frames.", inframe->timestamp_gap, gap_to_fix);
43594360
}
@@ -4471,16 +4472,16 @@ void *player_thread_func(void *arg) {
44714472
amount_to_stuff = -1 * (inbuflength / 350);
44724473
if (amount_to_stuff == 0)
44734474
amount_to_stuff = -1;
4474-
debug(3, "drop a frame, inbuflength is %d, amount_to_stuff is %d.",
4475+
debug(4, "drop a frame, inbuflength is %d, amount_to_stuff is %d.",
44754476
inbuflength, amount_to_stuff);
44764477
} else if (centered_sync_error_ns < (-tolerance_ns)) {
44774478
amount_to_stuff = +1 * (inbuflength / 350);
44784479
if (amount_to_stuff == 0)
44794480
amount_to_stuff = 1;
4480-
debug(3, "add a frame, inbuflength is %d, amount_to_stuff is %d.",
4481+
debug(4, "add a frame, inbuflength is %d, amount_to_stuff is %d.",
44814482
inbuflength, amount_to_stuff);
44824483
} else {
4483-
debug(3,
4484+
debug(4,
44844485
"error is within tolerance: centered_sync_error_ns: %" PRId64
44854486
", tolerance_ns: %" PRId64 " ns.",
44864487
centered_sync_error_ns, tolerance_ns);
@@ -4490,7 +4491,7 @@ void *player_thread_func(void *arg) {
44904491
}
44914492

44924493
if (amount_to_stuff)
4493-
debug(3,
4494+
debug(4,
44944495
// "stuff: %+d, sync_error: %+5.3f milliseconds.",
44954496
// amount_to_stuff, sync_error * 1000);
44964497
"stuff: %+d, sync_errors actual: %+5.3f milliseconds, bufferlength: %d, "
@@ -4775,19 +4776,23 @@ void *player_thread_func(void *arg) {
47754776
frames_to_skip -= play_samples;
47764777
} else {
47774778

4778-
char *offset = conn->outbuf;
4779-
offset +=
4780-
frames_to_skip *
4779+
4780+
4781+
size_t bytes_to_skip = frames_to_skip *
47814782
CHANNELS_FROM_ENCODED_FORMAT(config.current_output_configuration) *
47824783
sps_format_sample_size(
47834784
FORMAT_FROM_ENCODED_FORMAT(config.current_output_configuration));
4784-
config.output->play(offset, play_samples - frames_to_skip,
4785+
4786+
char *play_starting_point = conn->outbuf + bytes_to_skip;
4787+
4788+
config.output->play(play_starting_point, play_samples - frames_to_skip,
47854789
play_samples_are_timed, inframe->timestamp,
47864790
should_be_time);
47874791

4788-
debug(3, "skipping the first %u frames in a packet of %u frames.",
4792+
debug(3, "skipping the first %u frames (listed below) in a packet of %u frames.",
47894793
frames_to_skip, play_samples);
4790-
debug_print_buffer(3, conn->outbuf, offset - conn->outbuf);
4794+
4795+
debug_print_buffer(3, conn->outbuf, bytes_to_skip);
47914796

47924797
frames_played += play_samples - frames_to_skip;
47934798
frames_to_skip = 0;
@@ -4967,7 +4972,7 @@ static void player_send_volume_metadata(uint8_t vol_mode_both, double airplay_vo
49674972
}
49684973

49694974
void player_volume_without_notification(double airplay_volume, rtsp_conn_info *conn) {
4970-
debug_mutex_lock(&conn->volume_control_mutex, 5000, 1);
4975+
debug_mutex_lock(&conn->volume_control_mutex, 5000, 4);
49714976
// first, see if we are hw only, sw only, both with hw attenuation on the top or both with sw
49724977
// attenuation on top
49734978

@@ -5149,7 +5154,7 @@ void player_volume_without_notification(double airplay_volume, rtsp_conn_info *c
51495154
double temp_fix_volume = 65536.0 * pow(10, software_attenuation / 2000);
51505155

51515156
if (config.ignore_volume_control == 0)
5152-
debug(3, "Software attenuation set to %f, i.e %f out of 65,536, for airplay volume of %f",
5157+
debug(4, "Software attenuation set to %f, i.e %f out of 65,536, for airplay volume of %f",
51535158
software_attenuation, temp_fix_volume, airplay_volume);
51545159
else
51555160
debug(3, "Software attenuation set to %f, i.e %f out of 65,536. Volume control is ignored.",
@@ -5158,7 +5163,7 @@ void player_volume_without_notification(double airplay_volume, rtsp_conn_info *c
51585163
conn->fix_volume = temp_fix_volume;
51595164
}
51605165
if (conn != NULL)
5161-
debug(3, "Connection %d: AirPlay Volume set to %.3f, Output Level set to: %.2f dB.",
5166+
debug(4, "Connection %d: AirPlay Volume set to %.3f, Output Level set to: %.2f dB.",
51625167
conn->connection_number, airplay_volume, scaled_attenuation / 100.0);
51635168
else
51645169
debug(3, "AirPlay Volume set to %.3f, Output Level set to: %.2f dB. NULL conn.",
@@ -5176,7 +5181,7 @@ void player_volume_without_notification(double airplay_volume, rtsp_conn_info *c
51765181
config.output->mute(0);
51775182
conn->software_mute_enabled = 0;
51785183

5179-
debug(3,
5184+
debug(4,
51805185
"player_volume_without_notification: volume mode is %d, airplay volume is %.2f, "
51815186
"software_attenuation dB: %.2f, hardware_attenuation dB: %.2f, muting "
51825187
"is disabled.",
@@ -5185,7 +5190,7 @@ void player_volume_without_notification(double airplay_volume, rtsp_conn_info *c
51855190
// here, store the volume for possible use in the future
51865191
config.airplay_volume = airplay_volume;
51875192
conn->own_airplay_volume = airplay_volume;
5188-
debug_mutex_unlock(&conn->volume_control_mutex, 3);
5193+
debug_mutex_unlock(&conn->volume_control_mutex, 4);
51895194
}
51905195

51915196
void player_volume(double airplay_volume, rtsp_conn_info *conn) {

0 commit comments

Comments
 (0)