diff --git a/audio_sndio.c b/audio_sndio.c index 13a894f0..998290e2 100644 --- a/audio_sndio.c +++ b/audio_sndio.c @@ -51,7 +51,7 @@ audio_output audio_sndio = {.name = "sndio", .is_running = NULL, .flush = &flush, .delay = &delay, - .stats = &stats, + .stats = NULL, .play = &play, .volume = NULL, .parameters = NULL, @@ -66,15 +66,6 @@ uint64_t time_of_last_onmove_cb; uint64_t corrected_time_of_last_onmove_cb; int at_least_one_onmove_cb_seen; -static uint64_t frames_sent_for_playing; -// set to true if there has been a discontinuity between the last reported value for "played" -// and the present reported "played" -// Note that it will be set when the device is opened, as any previous figures for -// "played" (which Shairport Sync might hold) would be invalid. -static int frames_sent_break_occurred; -static int underrun_seen; - - struct sio_par par; struct sndio_formats { @@ -205,10 +196,8 @@ static int init(int argc, char **argv) { die("sndio: cannot open audio device"); written = played = 0; - frames_sent_for_playing = 0; - time_of_last_onmove_cb = 0; + time_of_last_onmove_cb = 0; at_least_one_onmove_cb_seen = 0; - underrun_seen = 0; for (i = 0; i < sizeof(formats) / sizeof(formats[0]); i++) { if (formats[i].fmt == config.output_format) { @@ -264,7 +253,6 @@ static void start(__attribute__((unused)) int sample_rate, __attribute__((unused)) int sample_format) { // pthread_mutex_lock(&sndio_mutex); pthread_cleanup_debug_mutex_lock(&sndio_mutex, 1000, 1); - frames_sent_break_occurred = 1; // there is a discontinuity with at_least_one_onmove_cb_seen = 0; // any previously-reported frame count @@ -294,7 +282,6 @@ static void stop() { if (!sio_stop(hdl)) die("sndio: unable to stop"); written = played = 0; - frames_sent_break_occurred = 1; pthread_cleanup_pop(1); // unlock the mutex } @@ -303,14 +290,6 @@ static void onmove_cb(__attribute__((unused)) void *arg, int delta) { corrected_time_of_last_onmove_cb = get_monotonic_time_in_ns(); // this is ("disciplined") by NTP at_least_one_onmove_cb_seen = 1; played += delta; - frames_sent_for_playing += delta; - if (delta == 0) { - debug(1,"No frames written in interval -- is this underrun?"); - underrun_seen = 1; - frames_sent_break_occurred = 1; - } else { - underrun_seen = 0; - } } int get_delay(long *delay) { @@ -330,10 +309,8 @@ int get_delay(long *delay) { // debug(1,"Frames played to last cb: %d, estimated to current time: // %d.",played,estimated_extra_frames_output); } - if ((delay != NULL) && (underrun_seen == 0)) + if (delay != NULL) *delay = (written / framesize) - (played + estimated_extra_frames_output); - if (underrun_seen != 0) - response = 1; return response; } @@ -351,11 +328,12 @@ static void flush() { if (!sio_stop(hdl) || !sio_start(hdl)) die("sndio: unable to flush"); written = played = 0; - frames_sent_break_occurred = 1; // pthread_mutex_unlock(&sndio_mutex); pthread_cleanup_pop(1); // unlock the mutex } +/* +// this doesn't seem to be very accurate, so not using it. int stats(uint64_t *raw_measurement_time, uint64_t *corrected_measurement_time, uint64_t *the_delay, uint64_t *frames_sent_to_dac) { // returns 0 if the device is in a valid state @@ -384,4 +362,5 @@ int stats(uint64_t *raw_measurement_time, uint64_t *corrected_measurement_time, ret = 1; return ret; } +*/ diff --git a/player.c b/player.c index 9144030f..2e07224a 100644 --- a/player.c +++ b/player.c @@ -1646,9 +1646,8 @@ void player_thread_cleanup_handler(void *arg) { conn->raw_frame_rate, conn->corrected_frame_rate); else inform("Connection %d: Playback Stopped. Total playing time %02" PRId64 ":%02" PRId64 - ":%02" PRId64 ". Input: %0.2f " - "frames per second.", - conn->connection_number, elapsedHours, elapsedMin, elapsedSec, conn->input_frame_rate); + ":%02" PRId64 ".", + conn->connection_number, elapsedHours, elapsedMin, elapsedSec); } #ifdef CONFIG_DACP_CLIENT @@ -2034,7 +2033,7 @@ void *player_thread_func(void *arg) { #ifdef CONFIG_AIRPLAY_2 if (conn->airplay_type == ap_2) { if (conn->airplay_stream_type == realtime_stream) { - if (config.output->stats) { + if (config.output->delay) { if (config.no_sync == 0) statistics_print_profile = ap2_realtime_synced_stream_statistics_print_profile; else @@ -2043,7 +2042,7 @@ void *player_thread_func(void *arg) { statistics_print_profile = ap2_realtime_nodelay_stream_statistics_print_profile; } } else { - if (config.output->stats) { + if (config.output->delay) { if (config.no_sync == 0) statistics_print_profile = ap2_buffered_synced_stream_statistics_print_profile; else @@ -2054,7 +2053,7 @@ void *player_thread_func(void *arg) { } } else { #endif - if (config.output->stats) { + if (config.output->delay) { if (config.no_sync == 0) statistics_print_profile = ap1_synced_statistics_print_profile; else