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
2728853e
Commit
2728853e
authored
Jul 19, 2006
by
J. Alexander Treuman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Throttle PuleAudio connection attempts so we don't spam the error log
git-svn-id:
https://svn.musicpd.org/mpd/trunk@4403
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
649a037e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
5 deletions
+24
-5
audioOutput_pulse.c
src/audioOutputs/audioOutput_pulse.c
+24
-5
No files found.
src/audioOutputs/audioOutput_pulse.c
View file @
2728853e
...
...
@@ -22,18 +22,23 @@
#ifdef HAVE_PULSE
#define MPD_PULSE_NAME "mpd"
#include "../conf.h"
#include "../log.h"
#include <time.h>
#include <pulse/simple.h>
#include <pulse/error.h>
#define MPD_PULSE_NAME "mpd"
#define CONN_ATTEMPT_INTERVAL 60
typedef
struct
_PulseData
{
pa_simple
*
s
;
char
*
server
;
char
*
sink
;
pa_simple
*
s
;
int
connAttempts
;
time_t
lastAttempt
;
}
PulseData
;
static
PulseData
*
newPulseData
()
...
...
@@ -41,9 +46,13 @@ static PulseData * newPulseData()
PulseData
*
ret
;
ret
=
malloc
(
sizeof
(
PulseData
));
ret
->
s
=
NULL
;
ret
->
server
=
NULL
;
ret
->
sink
=
NULL
;
ret
->
s
=
NULL
;
ret
->
connAttempts
=
0
;
ret
->
lastAttempt
=
0
;
return
ret
;
}
...
...
@@ -106,11 +115,19 @@ static int pulse_openDevice(AudioOutput * audioOutput)
PulseData
*
ad
;
AudioFormat
*
audioFormat
;
pa_sample_spec
ss
;
time_t
t
;
int
error
;
t
=
time
(
NULL
);
ad
=
audioOutput
->
data
;
audioFormat
=
&
audioOutput
->
outAudioFormat
;
if
(
ad
->
connAttempts
!=
0
&&
(
t
-
ad
->
lastAttempt
)
<
CONN_ATTEMPT_INTERVAL
)
return
-
1
;
ad
->
connAttempts
++
;
ad
->
lastAttempt
=
t
;
if
(
audioFormat
->
bits
!=
16
)
{
ERROR
(
"PulseAudio doesn't support %i bit audio
\n
"
,
audioFormat
->
bits
);
...
...
@@ -126,10 +143,12 @@ static int pulse_openDevice(AudioOutput * audioOutput)
&
error
);
if
(
!
ad
->
s
)
{
ERROR
(
"Cannot connect to server in PulseAudio output "
\
"
\"
%s
\"
: %s
\n
"
,
audioOutput
->
name
,
pa_strerror
(
error
));
"
\"
%s
\"
(attempt %i): %s
\n
"
,
audioOutput
->
name
,
ad
->
connAttempts
,
pa_strerror
(
error
));
return
-
1
;
}
ad
->
connAttempts
=
0
;
audioOutput
->
open
=
1
;
DEBUG
(
"PulseAudio output
\"
%s
\"
connected and playing %i bit, %i "
\
...
...
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