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
bf62d22f
Commit
bf62d22f
authored
Mar 10, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resource: simplify & reduce aout locking
parent
bb3fe09c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
23 deletions
+18
-23
src/input/resource.c
src/input/resource.c
+18
-23
No files found.
src/input/resource.c
View file @
bf62d22f
...
...
@@ -330,33 +330,31 @@ audio_output_t *input_resource_GetAout( input_resource_t *p_resource )
{
audio_output_t
*
p_aout
;
vlc_mutex_lock
(
&
p_resource
->
lock
);
if
(
p_resource
->
b_aout_busy
)
{
vlc_mutex_unlock
(
&
p_resource
->
lock
);
msg_Dbg
(
p_resource
->
p_parent
,
"creating extra audio output"
);
return
aout_New
(
p_resource
->
p_parent
);
}
vlc_mutex_lock
(
&
p_resource
->
lock_hold
);
p_aout
=
p_resource
->
p_aout
;
if
(
p_aout
==
NULL
)
if
(
p_aout
==
NULL
||
p_resource
->
b_aout_busy
)
{
msg_Dbg
(
p_resource
->
p_parent
,
"creating audio output"
);
vlc_mutex_unlock
(
&
p_resource
->
lock_hold
);
p_aout
=
aout_New
(
p_resource
->
p_parent
);
if
(
p_aout
==
NULL
)
return
NULL
;
/* failed */
vlc_mutex_lock
(
&
p_resource
->
lock_hold
);
if
(
p_resource
->
p_aout
==
NULL
)
p_resource
->
p_aout
=
p_aout
;
}
else
msg_Dbg
(
p_resource
->
p_parent
,
"reusing audio output"
);
if
(
p_
aout
!=
NULL
)
if
(
p_
resource
->
p_aout
==
p_aout
)
{
vlc_mutex_lock
(
&
p_resource
->
lock_hold
);
p_resource
->
p_aout
=
p_aout
;
vlc_mutex_unlock
(
&
p_resource
->
lock_hold
);
assert
(
!
p_resource
->
b_aout_busy
);
p_resource
->
b_aout_busy
=
true
;
vlc_object_hold
(
p_aout
);
}
vlc_mutex_unlock
(
&
p_resource
->
lock
);
vlc_mutex_unlock
(
&
p_resource
->
lock
_hold
);
return
p_aout
;
}
...
...
@@ -365,18 +363,17 @@ void input_resource_PutAout( input_resource_t *p_resource,
{
assert
(
p_aout
!=
NULL
);
vlc_mutex_lock
(
&
p_resource
->
lock
);
vlc_mutex_lock
(
&
p_resource
->
lock
_hold
);
if
(
p_aout
==
p_resource
->
p_aout
)
{
assert
(
p_resource
->
b_aout_busy
);
p_resource
->
b_aout_busy
=
false
;
msg_Dbg
(
p_resource
->
p_parent
,
"keeping audio output"
);
vlc_object_release
(
p_aout
);
p_aout
=
NULL
;
}
else
msg_Dbg
(
p_resource
->
p_parent
,
"destroying extra audio output"
);
vlc_mutex_unlock
(
&
p_resource
->
lock
);
vlc_mutex_unlock
(
&
p_resource
->
lock
_hold
);
if
(
p_aout
!=
NULL
)
aout_Destroy
(
p_aout
);
...
...
@@ -388,7 +385,7 @@ audio_output_t *input_resource_HoldAout( input_resource_t *p_resource )
vlc_mutex_lock
(
&
p_resource
->
lock_hold
);
p_aout
=
p_resource
->
p_aout
;
if
(
p_aout
)
if
(
p_aout
!=
NULL
)
vlc_object_hold
(
p_aout
);
vlc_mutex_unlock
(
&
p_resource
->
lock_hold
);
...
...
@@ -399,13 +396,11 @@ static void input_resource_TerminateAout( input_resource_t *p_resource )
{
audio_output_t
*
p_aout
;
vlc_mutex_lock
(
&
p_resource
->
lock
);
vlc_mutex_lock
(
&
p_resource
->
lock_hold
);
p_aout
=
p_resource
->
p_aout
;
p_resource
->
p_aout
=
NULL
;
vlc_mutex_unlock
(
&
p_resource
->
lock_hold
);
p_resource
->
b_aout_busy
=
false
;
vlc_mutex_unlock
(
&
p_resource
->
lock
);
vlc_mutex_unlock
(
&
p_resource
->
lock
_hold
);
if
(
p_aout
!=
NULL
)
aout_Destroy
(
p_aout
);
...
...
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