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
67831453
Commit
67831453
authored
Oct 29, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output: always call cancel() before stop()
Stopping an audio output device without cancelling its buffer doesn't make sense. Combine the two operations, which saves several cancel calls.
parent
07bb46de
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
14 deletions
+7
-14
audio.c
src/audio.c
+1
-10
output_thread.c
src/output_thread.c
+4
-0
player_thread.c
src/player_thread.c
+2
-4
No files found.
src/audio.c
View file @
67831453
...
...
@@ -193,12 +193,6 @@ isCurrentAudioFormat(const struct audio_format *audioFormat)
return
audio_format_equals
(
audioFormat
,
&
input_audio_format
);
}
static
void
audio_output_wait
(
struct
audio_output
*
ao
)
{
while
(
!
audio_output_command_is_finished
(
ao
))
notify_wait
(
&
audio_output_client_notify
);
}
static
void
audio_output_wait_all
(
void
)
{
unsigned
i
;
...
...
@@ -230,11 +224,8 @@ static void syncAudioDeviceStates(void)
audioOutput
=
&
audioOutputArray
[
i
];
if
(
audioOutput
->
enabled
)
audio_output_open
(
audioOutput
,
&
input_audio_format
);
else
if
(
audio_output_is_open
(
audioOutput
))
{
audio_output_cancel
(
audioOutput
);
audio_output_wait
(
audioOutput
);
else
if
(
audio_output_is_open
(
audioOutput
))
audio_output_close
(
audioOutput
);
}
}
}
...
...
src/output_thread.c
View file @
67831453
...
...
@@ -63,6 +63,7 @@ static void ao_play(struct audio_output *ao)
ao
->
result
=
ao
->
plugin
->
play
(
ao
->
data
,
data
,
size
);
if
(
!
ao
->
result
)
{
ao
->
plugin
->
cancel
(
ao
->
data
);
ao
->
plugin
->
close
(
ao
->
data
);
ao
->
open
=
false
;
}
...
...
@@ -72,6 +73,8 @@ static void ao_play(struct audio_output *ao)
static
void
ao_pause
(
struct
audio_output
*
ao
)
{
ao
->
plugin
->
cancel
(
ao
->
data
);
if
(
ao
->
plugin
->
pause
!=
NULL
)
{
/* pause is supported */
ao_command_finished
(
ao
);
...
...
@@ -107,6 +110,7 @@ static void *audio_output_task(void *arg)
case
AO_COMMAND_CLOSE
:
assert
(
ao
->
open
);
ao
->
plugin
->
cancel
(
ao
->
data
);
ao
->
plugin
->
close
(
ao
->
data
);
ao
->
open
=
false
;
ao_command_finished
(
ao
);
...
...
src/player_thread.c
View file @
67831453
...
...
@@ -152,7 +152,6 @@ static void processDecodeInput(struct player *player)
case
PLAYER_COMMAND_PAUSE
:
player
->
paused
=
!
player
->
paused
;
if
(
player
->
paused
)
{
dropBufferedAudio
();
audio_output_pause_all
();
pc
.
state
=
PLAYER_STATE_PAUSE
;
}
else
{
...
...
@@ -298,10 +297,9 @@ static void do_play(void)
break
;
}
if
(
player
.
paused
)
{
dropBufferedAudio
();
if
(
player
.
paused
)
closeAudioDevice
();
}
pc
.
totalTime
=
dc
.
totalTime
;
pc
.
audio_format
=
dc
.
audioFormat
;
play_audio_format
=
ob
.
audioFormat
;
...
...
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