Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
cc728a7d
Commit
cc728a7d
authored
Jun 26, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DynamicOverlay: fix a race condition (psz_(input|output)file must be protected
by a mutex).
parent
d1d7e1a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
modules/video_filter/dynamicoverlay/dynamicoverlay.c
modules/video_filter/dynamicoverlay/dynamicoverlay.c
+6
-0
modules/video_filter/dynamicoverlay/dynamicoverlay.h
modules/video_filter/dynamicoverlay/dynamicoverlay.h
+2
-0
No files found.
modules/video_filter/dynamicoverlay/dynamicoverlay.c
View file @
cc728a7d
...
@@ -108,6 +108,7 @@ static int Create( vlc_object_t *p_this )
...
@@ -108,6 +108,7 @@ static int Create( vlc_object_t *p_this )
p_sys
->
i_outputfd
=
-
1
;
p_sys
->
i_outputfd
=
-
1
;
p_sys
->
b_updated
=
true
;
p_sys
->
b_updated
=
true
;
p_sys
->
b_atomic
=
false
;
p_sys
->
b_atomic
=
false
;
vlc_mutex_init
(
&
p_sys
->
lock
);
p_filter
->
pf_sub_filter
=
Filter
;
p_filter
->
pf_sub_filter
=
Filter
;
...
@@ -147,6 +148,7 @@ static void Destroy( vlc_object_t *p_this )
...
@@ -147,6 +148,7 @@ static void Destroy( vlc_object_t *p_this )
var_DelCallback
(
p_filter
,
"overlay-input"
,
AdjustCallback
,
p_sys
);
var_DelCallback
(
p_filter
,
"overlay-input"
,
AdjustCallback
,
p_sys
);
var_DelCallback
(
p_filter
,
"overlay-output"
,
AdjustCallback
,
p_sys
);
var_DelCallback
(
p_filter
,
"overlay-output"
,
AdjustCallback
,
p_sys
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
free
(
p_sys
->
psz_inputfile
);
free
(
p_sys
->
psz_inputfile
);
free
(
p_sys
->
psz_outputfile
);
free
(
p_sys
->
psz_outputfile
);
free
(
p_sys
);
free
(
p_sys
);
...
@@ -164,6 +166,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
...
@@ -164,6 +166,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
/* We might need to open these at any time. */
/* We might need to open these at any time. */
vlc_mutex_lock
(
&
p_sys
->
lock
);
if
(
p_sys
->
i_inputfd
==
-
1
)
if
(
p_sys
->
i_inputfd
==
-
1
)
{
{
p_sys
->
i_inputfd
=
open
(
p_sys
->
psz_inputfile
,
O_RDONLY
|
O_NONBLOCK
);
p_sys
->
i_inputfd
=
open
(
p_sys
->
psz_inputfile
,
O_RDONLY
|
O_NONBLOCK
);
...
@@ -197,6 +200,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
...
@@ -197,6 +200,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_sys
->
psz_outputfile
);
p_sys
->
psz_outputfile
);
}
}
}
}
vlc_mutex_unlock
(
&
p_sys
->
lock
);
/* Read any waiting commands */
/* Read any waiting commands */
if
(
p_sys
->
i_inputfd
!=
-
1
)
if
(
p_sys
->
i_inputfd
!=
-
1
)
...
@@ -387,6 +391,7 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
...
@@ -387,6 +391,7 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_data
;
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_data
;
VLC_UNUSED
(
p_this
);
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
p_this
);
VLC_UNUSED
(
oldval
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
if
(
!
strncmp
(
psz_var
,
"overlay-input"
,
13
)
)
if
(
!
strncmp
(
psz_var
,
"overlay-input"
,
13
)
)
{
{
free
(
p_sys
->
psz_inputfile
);
free
(
p_sys
->
psz_inputfile
);
...
@@ -397,6 +402,7 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
...
@@ -397,6 +402,7 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
free
(
p_sys
->
psz_outputfile
);
free
(
p_sys
->
psz_outputfile
);
p_sys
->
psz_outputfile
=
strdup
(
newval
.
psz_string
);
p_sys
->
psz_outputfile
=
strdup
(
newval
.
psz_string
);
}
}
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
modules/video_filter/dynamicoverlay/dynamicoverlay.h
View file @
cc728a7d
...
@@ -165,6 +165,8 @@ struct filter_sys_t
...
@@ -165,6 +165,8 @@ struct filter_sys_t
bool
b_updated
,
b_atomic
;
bool
b_updated
,
b_atomic
;
queue_t
atomic
,
pending
,
processed
;
queue_t
atomic
,
pending
,
processed
;
list_t
overlays
;
list_t
overlays
;
vlc_mutex_t
lock
;
/* lock to protect psz_inputfile and psz_outputfile */
};
};
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment