From 9999ded93385e23044d334e16751fa9eb3b1e000 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 11 Dec 2021 18:37:39 -0600 Subject: [PATCH] Quiet down log spam for asynchronous decoders --- app/streaming/video/ffmpeg.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/streaming/video/ffmpeg.cpp b/app/streaming/video/ffmpeg.cpp index ec606a85..e08a0e79 100644 --- a/app/streaming/video/ffmpeg.cpp +++ b/app/streaming/video/ffmpeg.cpp @@ -1047,10 +1047,14 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du) // limited number of "failed decodes" with EAGAIN are expected for asynchronous // decoders, so we only reset the decoder if we get a ton of them in a row. if (!submittedFrame || err != AVERROR(EAGAIN)) { - char errorstring[512]; - av_strerror(err, errorstring, sizeof(errorstring)); - SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, - "avcodec_receive_frame() failed: %s", errorstring); + // Don't spam EAGAIN log messages for asynchronous decoders as long as + // they produce a frame for at least every other submitted packet. + if (m_ConsecutiveFailedDecodes > 0 || err != AVERROR(EAGAIN)) { + char errorstring[512]; + av_strerror(err, errorstring, sizeof(errorstring)); + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, + "avcodec_receive_frame() failed: %s", errorstring); + } if (++m_ConsecutiveFailedDecodes == FAILED_DECODES_RESET_THRESHOLD) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,