+ runner: update reports count algorithm.
issue->summary = g_strdup (summary);
issue->description = g_strdup (description);
issue->default_level = default_level;
- issue->repeat = FALSE;
return issue;
}
g_free (report->message);
g_list_free_full (report->shadow_reports,
(GDestroyNotify) gst_validate_report_unref);
+ g_list_free_full (report->repeated_reports,
+ (GDestroyNotify) gst_validate_report_unref);
g_slice_free (GstValidateReport, report);
g_mutex_clear (&report->shadow_reports_lock);
}
void
gst_validate_report_printf (GstValidateReport * report)
{
+ GList *tmp;
+
gst_validate_report_print_level (report);
gst_validate_report_print_detected_on (report);
gst_validate_report_print_details (report);
+
+ for (tmp = report->repeated_reports; tmp; tmp = tmp->next) {
+ gst_validate_report_print_details (report);
+ }
+
gst_validate_report_print_description (report);
gst_validate_printf (NULL, "\n");
}
{
report->reporting_level = level;
}
+
+void
+gst_validate_report_add_repeated_report (GstValidateReport * report,
+ GstValidateReport * repeated_report)
+{
+ report->repeated_reports =
+ g_list_append (report->repeated_reports,
+ gst_validate_report_ref (repeated_report));
+}
* issue. */
GstValidateReportLevel default_level;
- /* repeat: whether the issue might be triggered
- * multiple times but only remembered once */
- gboolean repeat;
} GstValidateIssue;
#define GST_VALIDATE_ISSUE_AREA(i) (GST_VALIDATE_ISSUE_ID_AREA (gst_validate_issue_get_id (i)))
GstValidateReport *master_report;
GList *shadow_reports;
+ /* Lists the reports that were repeated inside the same reporter */
+ GList *repeated_reports;
+
GstValidateReportingLevel reporting_level;
};
gboolean gst_validate_report_should_print (GstValidateReport * report);
gboolean gst_validate_report_set_master_report(GstValidateReport *report, GstValidateReport *master_report);
void gst_validate_report_set_reporting_level (GstValidateReport *report, GstValidateReportingLevel level);
+void gst_validate_report_add_repeated_report (GstValidateReport *report, GstValidateReport *repeated_report);
G_END_DECLS
gst_validate_report_valist (GstValidateReporter * reporter,
GstValidateIssueId issue_id, const gchar * format, va_list var_args)
{
- GstValidateReport *report;
+ GstValidateReport *report, *prev_report;
gchar *message, *combo;
va_list vacopy;
GstValidateIssue *issue;
return;
}
- if (issue->repeat == FALSE) {
- GstValidateIssueId issue_id = gst_validate_issue_get_id (issue);
+ prev_report = g_hash_table_lookup (priv->reports, (gconstpointer) issue_id);
+
+ if (prev_report) {
+ GstValidateReportingLevel reporter_level =
+ gst_validate_reporter_get_reporting_level (reporter);
+ GstValidateReportingLevel runner_level =
+ GST_VALIDATE_REPORTING_LEVEL_UNKNOWN;
+
+ if (priv->runner)
+ runner_level =
+ gst_validate_runner_get_default_reporting_level (priv->runner);
- if (g_hash_table_lookup (priv->reports, (gconstpointer) issue_id)) {
- GST_DEBUG ("Report \"%" G_GUINTPTR_FORMAT ":%s\" already present",
- issue_id, issue->summary);
- gst_validate_report_unref (report);
- return;
- }
+ if (reporter_level == GST_VALIDATE_REPORTING_LEVEL_ALL ||
+ (runner_level == GST_VALIDATE_REPORTING_LEVEL_ALL &&
+ reporter_level == GST_VALIDATE_REPORTING_LEVEL_UNKNOWN))
+ gst_validate_report_add_repeated_report (prev_report, report);
+
+ gst_validate_report_unref (report);
+ return;
}
GST_VALIDATE_REPORTER_REPORTS_LOCK (reporter);
guint
gst_validate_runner_get_reports_count (GstValidateRunner * runner)
{
+ GList *tmp;
guint l;
g_return_val_if_fail (runner != NULL, 0);
GST_VALIDATE_RUNNER_LOCK (runner);
l = g_list_length (runner->priv->reports);
+ for (tmp = runner->priv->reports; tmp; tmp = tmp->next)
+ l += g_list_length (((GstValidateReport *) tmp->data)->repeated_reports);
l += g_hash_table_size (runner->priv->reports_by_type);
GST_VALIDATE_RUNNER_UNLOCK (runner);
/* One report for each pad monitor */
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 6);
g_object_unref (runner);
+
+ fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "all", TRUE));
+ runner = gst_validate_runner_new ();
+ _create_issues (runner);
+ /* One report for each pad monitor, plus one for funnel src and fakesink sink */
+ fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 8);
+ g_object_unref (runner);
}
GST_END_TEST;
* sink will not find a report immediately upstream */
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 4);
g_object_unref (runner);
+
+ fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "none,fakesink*:all",
+ TRUE));
+ runner = gst_validate_runner_new ();
+ _create_issues (runner);
+ /* 2 issues repeated on the fakesink's sink */
+ fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 2);
+ g_object_unref (runner);
}
GST_END_TEST;