Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
9562f667
Commit
9562f667
authored
Nov 04, 2010
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output_control: lock object in audio_output_open()
Protect the attributes "open" and "fail_timer".
parent
21223154
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
output_control.c
src/output_control.c
+19
-6
No files found.
src/output_control.c
View file @
9562f667
...
@@ -72,6 +72,12 @@ static void ao_command_async(struct audio_output *ao,
...
@@ -72,6 +72,12 @@ static void ao_command_async(struct audio_output *ao,
notify_signal
(
&
ao
->
notify
);
notify_signal
(
&
ao
->
notify
);
}
}
static
void
audio_output_close_locked
(
struct
audio_output
*
ao
);
/**
* Object must be locked (and unlocked) by the caller.
*/
static
bool
static
bool
audio_output_open
(
struct
audio_output
*
ao
,
audio_output_open
(
struct
audio_output
*
ao
,
const
struct
audio_format
*
audio_format
,
const
struct
audio_format
*
audio_format
,
...
@@ -98,7 +104,7 @@ audio_output_open(struct audio_output *ao,
...
@@ -98,7 +104,7 @@ audio_output_open(struct audio_output *ao,
/* we're not using audio_output_cancel() here,
/* we're not using audio_output_cancel() here,
because that function is asynchronous */
because that function is asynchronous */
ao_command
(
ao
,
AO_COMMAND_CANCEL
);
ao_command
_locked
(
ao
,
AO_COMMAND_CANCEL
);
}
}
return
true
;
return
true
;
...
@@ -109,7 +115,7 @@ audio_output_open(struct audio_output *ao,
...
@@ -109,7 +115,7 @@ audio_output_open(struct audio_output *ao,
if
(
!
ao
->
config_audio_format
)
{
if
(
!
ao
->
config_audio_format
)
{
if
(
ao
->
open
)
if
(
ao
->
open
)
audio_output_close
(
ao
);
audio_output_close
_locked
(
ao
);
/* no audio format is configured: copy in->out, let
/* no audio format is configured: copy in->out, let
the output's open() method determine the effective
the output's open() method determine the effective
...
@@ -124,7 +130,7 @@ audio_output_open(struct audio_output *ao,
...
@@ -124,7 +130,7 @@ audio_output_open(struct audio_output *ao,
open
=
ao
->
open
;
open
=
ao
->
open
;
if
(
!
open
)
{
if
(
!
open
)
{
ao_command
(
ao
,
AO_COMMAND_OPEN
);
ao_command
_locked
(
ao
,
AO_COMMAND_OPEN
);
open
=
ao
->
open
;
open
=
ao
->
open
;
}
}
...
@@ -141,12 +147,19 @@ audio_output_update(struct audio_output *ao,
...
@@ -141,12 +147,19 @@ audio_output_update(struct audio_output *ao,
{
{
assert
(
mp
!=
NULL
);
assert
(
mp
!=
NULL
);
g_mutex_lock
(
ao
->
mutex
);
if
(
ao
->
enabled
)
{
if
(
ao
->
enabled
)
{
if
(
ao
->
fail_timer
==
NULL
||
if
(
ao
->
fail_timer
==
NULL
||
g_timer_elapsed
(
ao
->
fail_timer
,
NULL
)
>
REOPEN_AFTER
)
g_timer_elapsed
(
ao
->
fail_timer
,
NULL
)
>
REOPEN_AFTER
)
{
return
audio_output_open
(
ao
,
audio_format
,
mp
);
bool
ret
=
audio_output_open
(
ao
,
audio_format
,
mp
);
g_mutex_unlock
(
ao
->
mutex
);
return
ret
;
}
}
else
if
(
audio_output_is_open
(
ao
))
}
else
if
(
audio_output_is_open
(
ao
))
audio_output_close
(
ao
);
audio_output_close_locked
(
ao
);
g_mutex_unlock
(
ao
->
mutex
);
return
false
;
return
false
;
}
}
...
...
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