Browse Source

Merge pull request #2196 from jpark37/ffmpeg-mjpeg-spam

win-dshow: Suppress MJPEG error spam
Jim 6 years ago
parent
commit
c36e3fbc92
1 changed files with 14 additions and 4 deletions
  1. 14 4
      plugins/win-dshow/win-dshow.cpp

+ 14 - 4
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')