Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
58890cb8
Commit
58890cb8
authored
13 years ago
by
Tristan Matthews
Browse files
Options
Downloads
Patches
Plain Diff
pulse: cleanup
parent
ada595e1
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
daemon/src/audio/pulseaudio/pulselayer.cpp
+11
-15
11 additions, 15 deletions
daemon/src/audio/pulseaudio/pulselayer.cpp
with
11 additions
and
15 deletions
daemon/src/audio/pulseaudio/pulselayer.cpp
+
11
−
15
View file @
58890cb8
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
#include
<algorithm>
// for std::find
#include
<algorithm>
// for std::find
#include
<stdexcept>
#include
<stdexcept>
#include
<cassert>
#include
"audiostream.h"
#include
"audiostream.h"
#include
"pulselayer.h"
#include
"pulselayer.h"
#include
"audio/samplerateconverter.h"
#include
"audio/samplerateconverter.h"
...
@@ -126,10 +125,11 @@ PulseLayer::~PulseLayer()
...
@@ -126,10 +125,11 @@ PulseLayer::~PulseLayer()
void
PulseLayer
::
context_state_callback
(
pa_context
*
c
,
void
*
user_data
)
void
PulseLayer
::
context_state_callback
(
pa_context
*
c
,
void
*
user_data
)
{
{
PulseLayer
*
pulse
=
static_cast
<
PulseLayer
*>
(
user_data
);
PulseLayer
*
pulse
=
static_cast
<
PulseLayer
*>
(
user_data
);
assert
(
c
&&
pulse
->
mainloop_
);
assert
(
c
and
pulse
and
pulse
->
mainloop_
);
const
pa_subscription_mask_t
mask
=
(
pa_subscription_mask_t
)
(
PA_SUBSCRIPTION_MASK_SINK
|
PA_SUBSCRIPTION_MASK_SOURCE
);
switch
(
pa_context_get_state
(
c
))
{
switch
(
pa_context_get_state
(
c
))
{
case
PA_CONTEXT_CONNECTING
:
case
PA_CONTEXT_CONNECTING
:
case
PA_CONTEXT_AUTHORIZING
:
case
PA_CONTEXT_AUTHORIZING
:
case
PA_CONTEXT_SETTING_NAME
:
case
PA_CONTEXT_SETTING_NAME
:
...
@@ -139,8 +139,7 @@ void PulseLayer::context_state_callback(pa_context* c, void *user_data)
...
@@ -139,8 +139,7 @@ void PulseLayer::context_state_callback(pa_context* c, void *user_data)
case
PA_CONTEXT_READY
:
case
PA_CONTEXT_READY
:
DEBUG
(
"Audio: Connection to PulseAudio server established"
);
DEBUG
(
"Audio: Connection to PulseAudio server established"
);
pa_threaded_mainloop_signal
(
pulse
->
mainloop_
,
0
);
pa_threaded_mainloop_signal
(
pulse
->
mainloop_
,
0
);
pa_context_subscribe
(
c
,
(
pa_subscription_mask_t
)(
PA_SUBSCRIPTION_MASK_SINK
|
pa_context_subscribe
(
c
,
mask
,
NULL
,
pulse
);
PA_SUBSCRIPTION_MASK_SOURCE
),
NULL
,
pulse
);
pa_context_set_subscribe_callback
(
c
,
context_changed_callback
,
pulse
);
pa_context_set_subscribe_callback
(
c
,
context_changed_callback
,
pulse
);
pulse
->
updateSinkList
();
pulse
->
updateSinkList
();
pulse
->
updateSourceList
();
pulse
->
updateSourceList
();
...
@@ -184,13 +183,11 @@ bool PulseLayer::inSourceList(const std::string &deviceName) const
...
@@ -184,13 +183,11 @@ bool PulseLayer::inSourceList(const std::string &deviceName) const
std
::
vector
<
std
::
string
>
PulseLayer
::
getAudioDeviceList
(
AudioStreamDirection
dir
)
const
std
::
vector
<
std
::
string
>
PulseLayer
::
getAudioDeviceList
(
AudioStreamDirection
dir
)
const
{
{
if
(
AUDIO_STREAM_CAPTURE
==
dir
)
{
if
(
AUDIO_STREAM_CAPTURE
==
dir
)
return
sinkList_
;
return
sinkList_
;
}
else
if
(
AUDIO_STREAM_PLAYBACK
)
if
(
AUDIO_STREAM_PLAYBACK
)
{
return
sourceList_
;
return
sourceList_
;
}
}
}
void
PulseLayer
::
createStreams
(
pa_context
*
c
)
void
PulseLayer
::
createStreams
(
pa_context
*
c
)
{
{
...
@@ -302,18 +299,16 @@ void PulseLayer::writeToSpeaker()
...
@@ -302,18 +299,16 @@ void PulseLayer::writeToSpeaker()
pa_stream
*
s
=
playback_
->
pulseStream
();
pa_stream
*
s
=
playback_
->
pulseStream
();
// available bytes to be written in pulseaudio internal buffer
// available bytes to be written in pulseaudio internal buffer
int
writable
=
pa_stream_writable_size
(
s
);
int
writable
=
pa_stream_writable_size
(
s
);
if
(
writable
<
0
)
if
(
writable
<
0
)
{
ERROR
(
"Pulse: playback error : %s"
,
pa_strerror
(
writable
));
ERROR
(
"Pulse: playback error : %s"
,
pa_strerror
(
writable
));
return
;
if
(
writable
<
=
0
)
}
else
if
(
writable
=
=
0
)
return
;
return
;
size_t
bytes
=
writable
;
size_t
bytes
=
writable
;
void
*
data
;
notifyIncomingCall
();
notifyIncomingCall
();
...
@@ -322,6 +317,7 @@ void PulseLayer::writeToSpeaker()
...
@@ -322,6 +317,7 @@ void PulseLayer::writeToSpeaker()
if
(
urgentBytes
>
bytes
)
if
(
urgentBytes
>
bytes
)
urgentBytes
=
bytes
;
urgentBytes
=
bytes
;
void
*
data
;
if
(
urgentBytes
)
{
if
(
urgentBytes
)
{
pa_stream_begin_write
(
s
,
&
data
,
&
urgentBytes
);
pa_stream_begin_write
(
s
,
&
data
,
&
urgentBytes
);
urgentRingBuffer_
.
Get
(
data
,
urgentBytes
,
MainBuffer
::
DEFAULT_ID
);
urgentRingBuffer_
.
Get
(
data
,
urgentBytes
,
MainBuffer
::
DEFAULT_ID
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment