diff options
author | wm4 <wm4@nowhere> | 2020-09-03 12:18:42 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-09-03 12:18:42 +0200 |
commit | 177a88f676365c2b08dccb07577e0a7153e3bf99 (patch) | |
tree | 2eb49fe03e564623238f881bb9c495bfe5e2d7b5 | |
parent | 5fc34cb4d67432cb46aeefba0025cc364df02e98 (diff) | |
download | mpv-177a88f676365c2b08dccb07577e0a7153e3bf99.tar.bz2 mpv-177a88f676365c2b08dccb07577e0a7153e3bf99.tar.xz |
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.
-rw-r--r-- | player/audio.c | 9 | ||||
-rw-r--r-- | 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; |