mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-14 05:12:09 +00:00
subparse: Don't use jitted regex when used with valgrind
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7117>
This commit is contained in:
parent
331b37ac9a
commit
01b397601f
1 changed files with 16 additions and 3 deletions
|
@ -21,6 +21,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_VALGRIND
|
||||||
|
# include <valgrind/valgrind.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "gstsubparseelements.h"
|
#include "gstsubparseelements.h"
|
||||||
|
@ -42,11 +46,20 @@ gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype)
|
||||||
{
|
{
|
||||||
gpointer result = NULL;
|
gpointer result = NULL;
|
||||||
GError *gerr = NULL;
|
GError *gerr = NULL;
|
||||||
|
GRegexCompileFlags jit_flags = G_REGEX_OPTIMIZE | G_REGEX_RAW;
|
||||||
|
|
||||||
|
#ifdef HAVE_VALGRIND
|
||||||
|
if (RUNNING_ON_VALGRIND) {
|
||||||
|
/* jitted regex confuse valgrind */
|
||||||
|
jit_flags = G_REGEX_RAW;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (regtype) {
|
switch (regtype) {
|
||||||
case GST_SUB_PARSE_REGEX_MDVDSUB:
|
case GST_SUB_PARSE_REGEX_MDVDSUB:
|
||||||
result =
|
result =
|
||||||
(gpointer) g_regex_new ("^\\{[0-9]+\\}\\{[0-9]+\\}",
|
(gpointer) g_regex_new ("^\\{[0-9]+\\}\\{[0-9]+\\}",
|
||||||
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
|
jit_flags, 0, &gerr);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
g_warning ("Compilation of mdvd regex failed: %s", gerr->message);
|
g_warning ("Compilation of mdvd regex failed: %s", gerr->message);
|
||||||
g_clear_error (&gerr);
|
g_clear_error (&gerr);
|
||||||
|
@ -57,7 +70,7 @@ gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype)
|
||||||
g_regex_new ("^[\\s\\n]*[\\n]? {0,3}[ 0-9]{1,4}\\s*(\x0d)?\x0a"
|
g_regex_new ("^[\\s\\n]*[\\n]? {0,3}[ 0-9]{1,4}\\s*(\x0d)?\x0a"
|
||||||
" ?[0-9]{1,2}: ?[0-9]{1,2}: ?[0-9]{1,2}[,.] {0,2}[0-9]{1,3}"
|
" ?[0-9]{1,2}: ?[0-9]{1,2}: ?[0-9]{1,2}[,.] {0,2}[0-9]{1,3}"
|
||||||
" +--> +[0-9]{1,2}: ?[0-9]{1,2}: ?[0-9]{1,2}[,.] {0,2}[0-9]{1,2}",
|
" +--> +[0-9]{1,2}: ?[0-9]{1,2}: ?[0-9]{1,2}[,.] {0,2}[0-9]{1,2}",
|
||||||
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
|
jit_flags, 0, &gerr);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
g_warning ("Compilation of subrip regex failed: %s", gerr->message);
|
g_warning ("Compilation of subrip regex failed: %s", gerr->message);
|
||||||
g_clear_error (&gerr);
|
g_clear_error (&gerr);
|
||||||
|
@ -65,7 +78,7 @@ gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype)
|
||||||
break;
|
break;
|
||||||
case GST_SUB_PARSE_REGEX_DKS:
|
case GST_SUB_PARSE_REGEX_DKS:
|
||||||
result = (gpointer) g_regex_new ("^\\[[0-9]+:[0-9]+:[0-9]+\\].*",
|
result = (gpointer) g_regex_new ("^\\[[0-9]+:[0-9]+:[0-9]+\\].*",
|
||||||
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
|
jit_flags, 0, &gerr);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
g_warning ("Compilation of dks regex failed: %s", gerr->message);
|
g_warning ("Compilation of dks regex failed: %s", gerr->message);
|
||||||
g_clear_error (&gerr);
|
g_clear_error (&gerr);
|
||||||
|
|
Loading…
Reference in a new issue