From fccb4466cdb9d3d0e3fb8807af8f0ed192f4f406 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Thu, 10 Aug 2023 11:31:56 -0500 Subject: [PATCH] player/video: avoid spamming logs with EOF When playing a sparse video stream, the debug log gets hit with the video EOF constantly since the audio is still playing. There's no practical use for this so just do add some logic to only signal it once if it is sparse. --- player/core.h | 1 + player/video.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/player/core.h b/player/core.h index df98b6c2e9..3ea862462d 100644 --- a/player/core.h +++ b/player/core.h @@ -168,6 +168,7 @@ struct vo_chain { bool is_coverart; // - video consists of sparse still images bool is_sparse; + bool sparse_eof_signalled; bool underrun; bool underrun_signaled; diff --git a/player/video.c b/player/video.c index 2f084d90c4..83dbb72b9c 100644 --- a/player/video.c +++ b/player/video.c @@ -1097,7 +1097,11 @@ void write_video(struct MPContext *mpctx) } } - MP_DBG(mpctx, "video EOF (status=%d)\n", mpctx->video_status); + // Avoid pointlessly spamming the logs every frame. + if (!vo_c->is_sparse || !vo_c->sparse_eof_signalled) { + MP_DBG(mpctx, "video EOF (status=%d)\n", mpctx->video_status); + vo_c->sparse_eof_signalled = vo_c->is_sparse; + } return; }