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
7d3fc2a7
Commit
7d3fc2a7
authored
Jul 20, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vaapi: protect potentially concurrent access to the surfaces table
parent
b6dbbeaa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
modules/codec/avcodec/vaapi.c
modules/codec/avcodec/vaapi.c
+12
-0
No files found.
modules/codec/avcodec/vaapi.c
View file @
7d3fc2a7
...
...
@@ -80,6 +80,7 @@ struct vlc_va_sys_t
int
i_version_minor
;
/* */
vlc_mutex_t
lock
;
int
i_surface_count
;
unsigned
int
i_surface_order
;
int
i_surface_width
;
...
...
@@ -207,6 +208,8 @@ static int Open( vlc_va_t *va, int i_codec_id )
sys
->
b_supports_derive
=
false
;
vlc_mutex_init
(
&
sys
->
lock
);
if
(
asprintf
(
&
va
->
description
,
"VA API version %d.%d"
,
sys
->
i_version_major
,
sys
->
i_version_minor
)
<
0
)
va
->
description
=
NULL
;
...
...
@@ -215,6 +218,7 @@ static int Open( vlc_va_t *va, int i_codec_id )
return
VLC_SUCCESS
;
error:
#warning Leaks!
return
VLC_EGENERIC
;
}
...
...
@@ -248,7 +252,9 @@ static void DestroySurfaces( vlc_va_sys_t *sys )
sys
->
p_surface
=
NULL
;
sys
->
i_surface_width
=
0
;
sys
->
i_surface_height
=
0
;
vlc_mutex_destroy
(
&
sys
->
lock
);
}
static
int
CreateSurfaces
(
vlc_va_sys_t
*
sys
,
void
**
pp_hw_ctx
,
vlc_fourcc_t
*
pi_chroma
,
int
i_width
,
int
i_height
)
{
...
...
@@ -469,12 +475,14 @@ static int Extract( vlc_va_t *va, picture_t *p_picture, AVFrame *p_ff )
return
VLC_SUCCESS
;
}
static
int
Get
(
vlc_va_t
*
va
,
AVFrame
*
p_ff
)
{
vlc_va_sys_t
*
sys
=
va
->
sys
;
int
i_old
;
int
i
;
vlc_mutex_lock
(
&
sys
->
lock
);
/* Grab an unused surface, in case none are, try the oldest
* XXX using the oldest is a workaround in case a problem happens with ffmpeg */
for
(
i
=
0
,
i_old
=
0
;
i
<
sys
->
i_surface_count
;
i
++
)
...
...
@@ -489,6 +497,7 @@ static int Get( vlc_va_t *va, AVFrame *p_ff )
}
if
(
i
>=
sys
->
i_surface_count
)
i
=
i_old
;
vlc_mutex_unlock
(
&
sys
->
lock
);
vlc_va_surface_t
*
p_surface
=
&
sys
->
p_surface
[
i
];
...
...
@@ -506,12 +515,14 @@ static int Get( vlc_va_t *va, AVFrame *p_ff )
}
return
VLC_SUCCESS
;
}
static
void
Release
(
vlc_va_t
*
va
,
AVFrame
*
p_ff
)
{
vlc_va_sys_t
*
sys
=
va
->
sys
;
VASurfaceID
i_surface_id
=
(
VASurfaceID
)(
uintptr_t
)
p_ff
->
data
[
3
];
vlc_mutex_lock
(
&
sys
->
lock
);
for
(
int
i
=
0
;
i
<
sys
->
i_surface_count
;
i
++
)
{
vlc_va_surface_t
*
p_surface
=
&
sys
->
p_surface
[
i
];
...
...
@@ -519,6 +530,7 @@ static void Release( vlc_va_t *va, AVFrame *p_ff )
if
(
p_surface
->
i_id
==
i_surface_id
)
p_surface
->
i_refcount
--
;
}
vlc_mutex_unlock
(
&
sys
->
lock
);
}
static
void
Close
(
vlc_va_sys_t
*
sys
)
...
...
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