Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Fix repeated log entries #11706

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UI/obs-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,11 @@ static inline bool too_many_repeated_entries(fstream &logFile, const char *msg,
static mutex log_mutex;
static const char *last_msg_ptr = nullptr;
static int last_char_sum = 0;
static size_t last_len = 0;
static int rep_count = 0;

int new_sum = sum_chars(output_str);
size_t new_len = strlen(output_str);

lock_guard<mutex> guard(log_mutex);

Expand All @@ -357,6 +359,8 @@ static inline bool too_many_repeated_entries(fstream &logFile, const char *msg,
if (diff < MAX_CHAR_VARIATION) {
return (rep_count++ >= MAX_REPEATED_LINES);
}
} else if (last_len == new_len && new_sum == last_char_sum) {
return (rep_count++ >= MAX_REPEATED_LINES);
}

if (rep_count > MAX_REPEATED_LINES) {
Expand All @@ -366,6 +370,7 @@ static inline bool too_many_repeated_entries(fstream &logFile, const char *msg,

last_msg_ptr = msg;
last_char_sum = new_sum;
last_len = new_len;
rep_count = 0;

return false;
Expand Down
Loading