From 177a88f676365c2b08dccb07577e0a7153e3bf99 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 3 Sep 2020 12:18:42 +0200 Subject: audio: reduce excessive logging of delayed audio start Since this is a messy and fragile mechanism, I want it logged (even if it's somewhat in conflict with the verbose logging policy). On the other hand, it's unconditionally logged on every playloop iteration. So add some nonsense to log it only on progress. --- player/audio.c | 9 +++++++-- player/core.h | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/player/audio.c b/player/audio.c index 86b1a04500..771fa05502 100644 --- a/player/audio.c +++ b/player/audio.c @@ -204,6 +204,7 @@ void reset_audio_state(struct MPContext *mpctx) } mpctx->audio_status = mpctx->ao_chain ? STATUS_SYNCING : STATUS_EOF; mpctx->delay = 0; + mpctx->logged_async_diff = -1; } void uninit_audio_out(struct MPContext *mpctx) @@ -798,8 +799,11 @@ static void check_audio_start(struct MPContext *mpctx, bool force) double diff = (apts - pts) / mpctx->opts->playback_speed; if (!get_internal_paused(mpctx)) mp_set_timeout(mpctx, diff); - MP_VERBOSE(mpctx, "delaying audio start %f vs. %f, diff=%f\n", - apts, pts, diff); + if (mpctx->logged_async_diff != diff) { + MP_VERBOSE(mpctx, "delaying audio start %f vs. %f, diff=%f\n", + apts, pts, diff); + mpctx->logged_async_diff = diff; + } return; } @@ -809,6 +813,7 @@ static void check_audio_start(struct MPContext *mpctx, bool force) if (ao_c->out_eof) mpctx->audio_status = STATUS_DRAINING; ao_c->underrun = false; + mpctx->logged_async_diff = -1; mp_wakeup_core(mpctx); } diff --git a/player/core.h b/player/core.h index 5ad494ff89..aab408e92c 100644 --- a/player/core.h +++ b/player/core.h @@ -383,6 +383,8 @@ typedef struct MPContext { double last_frame_duration; // Video PTS, or audio PTS if video has ended. double playback_pts; + // For logging only. + double logged_async_diff; int last_chapter; -- cgit v1.2.3