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
335d5d5d
Commit
335d5d5d
authored
Aug 14, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/pulse: implement method delay()
Reduce command latency while paused.
parent
51d793be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
pulse_output_plugin.c
src/output/pulse_output_plugin.c
+21
-7
No files found.
src/output/pulse_output_plugin.c
View file @
335d5d5d
...
...
@@ -762,6 +762,24 @@ pulse_output_stream_pause(struct pulse_output *po, bool pause,
return
true
;
}
static
unsigned
pulse_output_delay
(
struct
audio_output
*
ao
)
{
struct
pulse_output
*
po
=
(
struct
pulse_output
*
)
ao
;
unsigned
result
=
0
;
pa_threaded_mainloop_lock
(
po
->
mainloop
);
if
(
po
->
base
.
pause
&&
pulse_output_stream_is_paused
(
po
)
&&
pa_stream_get_state
(
po
->
stream
)
==
PA_STREAM_READY
)
/* idle while paused */
result
=
1000
;
pa_threaded_mainloop_unlock
(
po
->
mainloop
);
return
result
;
}
static
size_t
pulse_output_play
(
struct
audio_output
*
ao
,
const
void
*
chunk
,
size_t
size
,
GError
**
error_r
)
...
...
@@ -889,13 +907,8 @@ pulse_output_pause(struct audio_output *ao)
/* cork the stream */
if
(
pulse_output_stream_is_paused
(
po
))
{
/* already paused; due to a MPD API limitation, we
have to sleep a little bit here, to avoid hogging
the CPU */
g_usleep
(
50000
);
}
else
if
(
!
pulse_output_stream_pause
(
po
,
true
,
&
error
))
{
if
(
!
pulse_output_stream_is_paused
(
po
)
&&
!
pulse_output_stream_pause
(
po
,
true
,
&
error
))
{
pa_threaded_mainloop_unlock
(
po
->
mainloop
);
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
...
...
@@ -932,6 +945,7 @@ const struct audio_output_plugin pulse_output_plugin = {
.
enable
=
pulse_output_enable
,
.
disable
=
pulse_output_disable
,
.
open
=
pulse_output_open
,
.
delay
=
pulse_output_delay
,
.
play
=
pulse_output_play
,
.
cancel
=
pulse_output_cancel
,
.
pause
=
pulse_output_pause
,
...
...
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