mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
subparse: Don't use jitted regex when used with valgrind
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7124>
This commit is contained in:
parent
869b122e6b
commit
bad0daeb8f
1 changed files with 16 additions and 3 deletions
|
@ -21,6 +21,10 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VALGRIND
|
||||
# include <valgrind/valgrind.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gstsubparseelements.h"
|
||||
|
@ -42,11 +46,20 @@ gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype)
|
|||
{
|
||||
gpointer result = 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) {
|
||||
case GST_SUB_PARSE_REGEX_MDVDSUB:
|
||||
result =
|
||||
(gpointer) g_regex_new ("^\\{[0-9]+\\}\\{[0-9]+\\}",
|
||||
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
|
||||
jit_flags, 0, &gerr);
|
||||
if (result == NULL) {
|
||||
g_warning ("Compilation of mdvd regex failed: %s", gerr->message);
|
||||
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"
|
||||
" ?[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}",
|
||||
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
|
||||
jit_flags, 0, &gerr);
|
||||
if (result == NULL) {
|
||||
g_warning ("Compilation of subrip regex failed: %s", gerr->message);
|
||||
g_clear_error (&gerr);
|
||||
|
@ -65,7 +78,7 @@ gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype)
|
|||
break;
|
||||
case GST_SUB_PARSE_REGEX_DKS:
|
||||
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) {
|
||||
g_warning ("Compilation of dks regex failed: %s", gerr->message);
|
||||
g_clear_error (&gerr);
|
||||
|
|
Loading…
Reference in a new issue