From f685322a0fe4e7565ccb97a31909bb101e8f8b6c Mon Sep 17 00:00:00 2001 From: jpark37 Date: Sun, 24 Nov 2019 23:59:27 -0800 Subject: [PATCH] win-dshow: Suppress MJPEG error spam Only print the first message for this known benign error. --- plugins/win-dshow/win-dshow.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/plugins/win-dshow/win-dshow.cpp b/plugins/win-dshow/win-dshow.cpp index bc51c3226..d38652100 100644 --- a/plugins/win-dshow/win-dshow.cpp +++ b/plugins/win-dshow/win-dshow.cpp @@ -96,14 +96,24 @@ enum class BufferingType : int64_t { void ffmpeg_log(void *bla, int level, const char *msg, va_list args) { DStr str; - if (level == AV_LOG_WARNING) + if (level == AV_LOG_WARNING) { dstr_copy(str, "warning: "); - else if (level == AV_LOG_ERROR) + } else if (level == AV_LOG_ERROR) { + /* only print first of this message to avoid spam */ + static bool suppress_app_field_spam = false; + if (strcmp(msg, "unable to decode APP fields: %s\n") == 0) { + if (suppress_app_field_spam) + return; + + suppress_app_field_spam = true; + } + dstr_copy(str, "error: "); - else if (level < AV_LOG_ERROR) + } else if (level < AV_LOG_ERROR) { dstr_copy(str, "fatal: "); - else + } else { return; + } dstr_cat(str, msg); if (dstr_end(str) == '\n')