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
ddfbaea0
Commit
ddfbaea0
authored
Jun 03, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect XInitThreads() with a global lock
parent
89717011
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
64 additions
and
13 deletions
+64
-13
include/vlc_threads.h
include/vlc_threads.h
+2
-0
include/vlc_xlib.h
include/vlc_xlib.h
+41
-0
modules/audio_output/pulse.c
modules/audio_output/pulse.c
+5
-7
modules/codec/avcodec/vaapi.c
modules/codec/avcodec/vaapi.c
+6
-1
modules/gui/hildon/maemo.c
modules/gui/hildon/maemo.c
+2
-1
modules/gui/qt4/qt4.cpp
modules/gui/qt4/qt4.cpp
+2
-2
modules/gui/skins2/x11/x11_factory.cpp
modules/gui/skins2/x11/x11_factory.cpp
+2
-1
modules/video_output/xcb/glx.c
modules/video_output/xcb/glx.c
+2
-1
src/Makefile.am
src/Makefile.am
+1
-0
src/misc/threads.c
src/misc/threads.c
+1
-0
No files found.
include/vlc_threads.h
View file @
ddfbaea0
...
...
@@ -445,6 +445,8 @@ class vlc_mutex_locker
enum
{
VLC_AVCODEC_MUTEX
=
0
,
VLC_GCRYPT_MUTEX
,
VLC_XLIB_MUTEX
,
/* Insert new entry HERE */
VLC_MAX_MUTEX
};
...
...
include/vlc_xlib.h
0 → 100644
View file @
ddfbaea0
/*****************************************************************************
* vlc_xlib.h: initialization of Xlib
*****************************************************************************
* Copyright (C) 2010 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_XLIB_H
# define VLC_XLIB_H 1
# include <X11/Xlib.h>
static
inline
bool
vlc_xlib_init
(
vlc_object_t
*
obj
)
{
bool
ok
=
false
;
if
(
var_InheritBool
(
obj
,
"xlib"
))
{
/* XInitThreads() can be called multiple times,
* but it is not reentrant. */
vlc_global_lock
(
VLC_XLIB_MUTEX
);
ok
=
XInitThreads
()
!=
0
;
vlc_global_unlock
(
VLC_XLIB_MUTEX
);
}
return
ok
;
}
#endif
modules/audio_output/pulse.c
View file @
ddfbaea0
...
...
@@ -34,9 +34,10 @@
#include <vlc_cpu.h>
#include <pulse/pulseaudio.h>
#ifdef
HAVE_X11_XLIB_H
#
include <X11/Xlib.h>
#ifdef
X_DISPLAY_MISSING
#
error Xlib required due to PulseAudio bug 799!
#endif
#include <vlc_xlib.h>
#include <assert.h>
...
...
@@ -121,12 +122,9 @@ static int Open ( vlc_object_t *p_this )
struct
pa_buffer_attr
a
;
struct
pa_channel_map
map
;
#ifdef X_DISPLAY_MISSING
# error Xlib required due to PulseAudio bug 799!
#else
if
(
!
var_InheritBool
(
p_this
,
"xlib"
)
||
!
XInitThreads
()
)
if
(
!
vlc_xlib_init
(
p_this
)
)
return
VLC_EGENERIC
;
#endif
/* Allocate structures */
p_aout
->
output
.
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
aout_sys_t
)
);
if
(
p_sys
==
NULL
)
...
...
modules/codec/avcodec/vaapi.c
View file @
ddfbaea0
...
...
@@ -464,7 +464,12 @@ static void Delete( vlc_va_t *p_external )
/* */
vlc_va_t
*
vlc_va_NewVaapi
(
int
i_codec_id
)
{
if
(
!
XInitThreads
()
)
bool
fail
;
vlc_global_lock
(
VLC_XLIB_MUTEX
);
fail
=
!
XInitThreads
();
vlc_global_unlock
(
VLC_XLIB_MUTEX
)
if
(
unlikely
(
fail
)
)
return
NULL
;
vlc_va_vaapi_t
*
p_va
=
calloc
(
1
,
sizeof
(
*
p_va
)
);
...
...
modules/gui/hildon/maemo.c
View file @
ddfbaea0
...
...
@@ -30,6 +30,7 @@
#include <vlc_plugin.h>
#include <vlc_interface.h>
#include <vlc_vout_window.h>
#include <vlc_xlib.h>
#include <hildon/hildon-program.h>
#include <hildon/hildon-banner.h>
...
...
@@ -80,7 +81,7 @@ static int Open( vlc_object_t *p_this )
intf_sys_t
*
p_sys
;
vlc_value_t
val
;
if
(
!
v
ar_InheritBool
(
p_this
,
"xlib"
)
||
!
XInitThreads
(
)
)
if
(
!
v
lc_xlib_init
(
p_this
)
)
return
VLC_EGENERIC
;
/* Allocate instance and initialize some members */
...
...
modules/gui/qt4/qt4.cpp
View file @
ddfbaea0
...
...
@@ -39,7 +39,7 @@
#include "util/qvlcapp.hpp"
/* QVLCApplication definition */
#ifdef Q_WS_X11
#include <
X11/X
lib.h>
#include <
vlc_x
lib.h>
#endif
#include "../../../share/vlc32x32.xpm"
...
...
@@ -283,7 +283,7 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
#ifdef Q_WS_X11
if
(
!
v
ar_InheritBool
(
p_this
,
"xlib"
)
||
!
XInitThreads
(
)
)
if
(
!
v
lc_xlib_init
(
p_this
)
)
return
VLC_EGENERIC
;
char
*
display
=
var_CreateGetNonEmptyString
(
p_intf
,
"x11-display"
);
...
...
modules/gui/skins2/x11/x11_factory.cpp
View file @
ddfbaea0
...
...
@@ -28,6 +28,7 @@
#include <dirent.h>
#include <sys/stat.h>
#include <X11/Xlib.h>
#include <vlc_xlib.h>
#include "x11_factory.hpp"
#include "x11_display.hpp"
...
...
@@ -57,7 +58,7 @@ X11Factory::~X11Factory()
bool
X11Factory
::
init
()
{
// make sure xlib is safe-thread
if
(
!
v
ar_InheritBool
(
getIntf
(),
"xlib"
)
||
!
XInitThreads
(
)
)
if
(
!
v
lc_xlib_init
(
getIntf
()
)
)
{
msg_Err
(
getIntf
(),
"initializing xlib for multi-threading failed"
);
return
false
;
...
...
modules/video_output/xcb/glx.c
View file @
ddfbaea0
...
...
@@ -34,6 +34,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_xlib.h>
#include <vlc_vout_display.h>
#include <vlc_vout_opengl.h>
#include "../opengl.h"
...
...
@@ -203,7 +204,7 @@ static int CreateWindow (vout_display_t *vd, xcb_connection_t *conn,
*/
static
int
Open
(
vlc_object_t
*
obj
)
{
if
(
!
v
ar_InheritBool
(
obj
,
"xlib"
)
||
!
XInitThreads
(
))
if
(
!
v
lc_xlib_init
(
obj
))
return
VLC_EGENERIC
;
vout_display_t
*
vd
=
(
vout_display_t
*
)
obj
;
...
...
src/Makefile.am
View file @
ddfbaea0
...
...
@@ -107,6 +107,7 @@ pluginsinclude_HEADERS = \
../include/vlc_vout_osd.h
\
../include/vlc_vout_window.h
\
../include/vlc_xml.h
\
../include/vlc_xlib.h
\
$(NULL)
noinst_HEADERS
=
\
...
...
src/misc/threads.c
View file @
ddfbaea0
...
...
@@ -241,6 +241,7 @@ void vlc_global_mutex (unsigned n, bool acquire)
static
vlc_mutex_t
locks
[]
=
{
VLC_STATIC_MUTEX
,
VLC_STATIC_MUTEX
,
VLC_STATIC_MUTEX
,
};
assert
(
n
<
(
sizeof
(
locks
)
/
sizeof
(
locks
[
0
])));
vlc_mutex_t
*
lock
=
locks
+
n
;
...
...
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