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
7a87d576
Commit
7a87d576
authored
Nov 29, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug audio output lock ordering
parent
47f7069e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
1 deletion
+81
-1
src/audio_output/aout_internal.h
src/audio_output/aout_internal.h
+33
-1
src/audio_output/common.c
src/audio_output/common.c
+48
-0
No files found.
src/audio_output/aout_internal.h
View file @
7a87d576
...
...
@@ -164,51 +164,83 @@ int aout_DecGetResetLost( aout_instance_t *, aout_input_t * );
void
aout_DecChangePause
(
aout_instance_t
*
,
aout_input_t
*
,
bool
b_paused
,
mtime_t
i_date
);
void
aout_DecFlush
(
aout_instance_t
*
,
aout_input_t
*
);
/* Helpers */
/* Audio output locking */
#if !defined (NDEBUG) \
&& defined __linux__ && (defined (__i386__) || defined (__x86_64__))
# define AOUT_DEBUG 1
#endif
#ifdef AOUT_DEBUG
enum
{
MIXER_LOCK
=
1
,
INPUT_LOCK
=
2
,
INPUT_FIFO_LOCK
=
4
,
OUTPUT_FIFO_LOCK
=
8
,
};
void
aout_lock
(
unsigned
);
void
aout_unlock
(
unsigned
);
#else
# define aout_lock( i ) (void)0
# define aout_unlock( i ) (void)0
#endif
static
inline
void
aout_lock_mixer
(
aout_instance_t
*
p_aout
)
{
aout_lock
(
MIXER_LOCK
);
vlc_mutex_lock
(
&
p_aout
->
mixer_lock
);
}
static
inline
void
aout_unlock_mixer
(
aout_instance_t
*
p_aout
)
{
aout_unlock
(
MIXER_LOCK
);
vlc_mutex_unlock
(
&
p_aout
->
mixer_lock
);
}
static
inline
void
aout_lock_input_fifos
(
aout_instance_t
*
p_aout
)
{
aout_lock
(
INPUT_FIFO_LOCK
);
vlc_mutex_lock
(
&
p_aout
->
input_fifos_lock
);
}
static
inline
void
aout_unlock_input_fifos
(
aout_instance_t
*
p_aout
)
{
aout_unlock
(
INPUT_FIFO_LOCK
);
vlc_mutex_unlock
(
&
p_aout
->
input_fifos_lock
);
}
static
inline
void
aout_lock_output_fifo
(
aout_instance_t
*
p_aout
)
{
aout_lock
(
OUTPUT_FIFO_LOCK
);
vlc_mutex_lock
(
&
p_aout
->
output_fifo_lock
);
}
static
inline
void
aout_unlock_output_fifo
(
aout_instance_t
*
p_aout
)
{
aout_unlock
(
OUTPUT_FIFO_LOCK
);
vlc_mutex_unlock
(
&
p_aout
->
output_fifo_lock
);
}
static
inline
void
aout_lock_input
(
aout_instance_t
*
p_aout
,
aout_input_t
*
p_input
)
{
(
void
)
p_aout
;
aout_lock
(
INPUT_LOCK
);
vlc_mutex_lock
(
&
p_input
->
lock
);
}
static
inline
void
aout_unlock_input
(
aout_instance_t
*
p_aout
,
aout_input_t
*
p_input
)
{
(
void
)
p_aout
;
aout_unlock
(
INPUT_LOCK
);
vlc_mutex_unlock
(
&
p_input
->
lock
);
}
/* Helpers */
/**
* This function will safely mark aout input to be restarted as soon as
* possible to take configuration changes into account */
...
...
src/audio_output/common.c
View file @
7a87d576
...
...
@@ -114,6 +114,54 @@ static void aout_Destructor( vlc_object_t * p_this )
vlc_mutex_destroy
(
&
p_aout
->
output_fifo_lock
);
}
/* Lock ordering rules:
*
* Mixer Input IFIFO OFIFO (< Inner lock)
* Mixer No! N/A Yes Yes
* Input N/A No! Yes N/A
* In FIFOs No! No! No! No!
* Out FIFOs No! N/A Yes No!
* (^ Outer lock)
*/
#ifdef AOUT_DEBUG
/* Lock debugging */
static
__thread
unsigned
aout_locks
=
0
;
void
aout_lock
(
unsigned
i
)
{
unsigned
allowed
;
switch
(
i
)
{
case
MIXER_LOCK
:
allowed
=
0
;
break
;
case
INPUT_LOCK
:
allowed
=
0
;
break
;
case
OUTPUT_FIFO_LOCK
:
allowed
=
MIXER_LOCK
;
break
;
case
INPUT_FIFO_LOCK
:
allowed
=
MIXER_LOCK
|
INPUT_LOCK
|
OUTPUT_FIFO_LOCK
;
break
;
}
if
(
aout_locks
&
~
allowed
)
{
fprintf
(
stderr
,
"Illegal audio lock transition (%x -> %x)
\n
"
,
aout_locks
,
aout_locks
|
i
);
vlc_backtrace
();
//abort ();
}
aout_locks
|=
i
;
}
void
aout_unlock
(
unsigned
i
)
{
assert
(
aout_locks
&
i
);
aout_locks
&=
~
i
;
}
#endif
/*
* Formats management (internal and external)
...
...
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