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
791f6ec2
Commit
791f6ec2
authored
11 years ago
by
Tristan Matthews
Browse files
Options
Downloads
Patches
Plain Diff
* #30143: alsa: cleanup
parent
a3e5f4f7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
daemon/src/audio/alsa/alsalayer.cpp
+10
-8
10 additions, 8 deletions
daemon/src/audio/alsa/alsalayer.cpp
with
10 additions
and
8 deletions
daemon/src/audio/alsa/alsalayer.cpp
+
10
−
8
View file @
791f6ec2
...
...
@@ -379,7 +379,7 @@ bool AlsaLayer::alsa_set_params(snd_pcm_t *pcm_handle)
DEBUG
(
"Was set period_size = %lu"
,
period_size
);
DEBUG
(
"Was set buffer_size = %lu"
,
buffer_size
);
if
(
2
*
period_size
>
buffer_size
)
{
if
(
2
*
period_size
>
buffer_size
)
{
ERROR
(
"buffer to small, could not use"
);
return
false
;
}
...
...
@@ -416,7 +416,7 @@ AlsaLayer::write(void* buffer, int length, snd_pcm_t * handle)
snd_pcm_uframes_t
frames
=
snd_pcm_bytes_to_frames
(
handle
,
length
);
watchdogTotalCount_
++
;
int
err
=
snd_pcm_writei
(
handle
,
buffer
,
frames
);
int
err
=
snd_pcm_writei
(
handle
,
buffer
,
frames
);
if
(
err
<
0
)
snd_pcm_recover
(
handle
,
err
,
0
);
...
...
@@ -441,7 +441,7 @@ AlsaLayer::write(void* buffer, int length, snd_pcm_t * handle)
startPlaybackStream
();
}
ALSA_CALL
(
snd_pcm_writei
(
handle
,
buffer
,
frames
),
"XRUN handling failed"
);
ALSA_CALL
(
snd_pcm_writei
(
handle
,
buffer
,
frames
),
"XRUN handling failed"
);
break
;
}
...
...
@@ -474,8 +474,8 @@ AlsaLayer::write(void* buffer, int length, snd_pcm_t * handle)
// Detect when something is going wrong. This can be caused by alsa bugs or
// faulty encoder on the other side
// TODO do something useful instead of just warning and flushing buffers
if
(
watchdogTotalErr_
>
0
&&
watchdogTotalCount_
/
watchdogTotalErr_
>=
4
&&
watchdogTotalCount_
>
50
)
{
ERROR
(
"
Alsa: too many errors (
%d error o
n
%d frame
)
"
,
watchdogTotalErr_
,
watchdogTotalCount_
);
if
(
watchdogTotalErr_
>
0
&&
watchdogTotalCount_
/
watchdogTotalErr_
>=
4
and
watchdogTotalCount_
>
50
)
{
ERROR
(
"%d error
s out
o
f
%d frame
s
"
,
watchdogTotalErr_
,
watchdogTotalCount_
);
flushUrgent
();
flushMain
();
}
...
...
@@ -560,7 +560,7 @@ getValues(const std::vector<HwIDPair> &deviceMap)
{
std
::
vector
<
std
::
string
>
audioDeviceList
;
for
(
const
auto
&
dev
:
deviceMap
)
for
(
const
auto
&
dev
:
deviceMap
)
audioDeviceList
.
push_back
(
dev
.
second
);
return
audioDeviceList
;
...
...
@@ -606,7 +606,8 @@ AlsaLayer::getAudioDeviceIndexMap(bool getCapture) const
snd_pcm_info_set_stream
(
pcminfo
,
getCapture
?
SND_PCM_STREAM_CAPTURE
:
SND_PCM_STREAM_PLAYBACK
);
int
err
;
if
((
err
=
snd_ctl_pcm_info
(
handle
,
pcminfo
))
<
0
)
{
if
((
err
=
snd_ctl_pcm_info
(
handle
,
pcminfo
))
<
0
)
{
WARN
(
"Cannot get info: %s"
,
snd_strerror
(
err
));
}
else
{
DEBUG
(
"card %i : %s [%s]"
,
...
...
@@ -662,7 +663,7 @@ AlsaLayer::getAudioDeviceIndex(const std::string &description) const
audioDeviceIndexMap
.
insert
(
audioDeviceIndexMap
.
end
(),
captureDevice
.
begin
(),
captureDevice
.
end
());
audioDeviceIndexMap
.
insert
(
audioDeviceIndexMap
.
end
(),
playbackDevice
.
begin
(),
playbackDevice
.
end
());
for
(
const
auto
&
dev
:
audioDeviceIndexMap
)
for
(
const
auto
&
dev
:
audioDeviceIndexMap
)
if
(
dev
.
second
==
description
)
return
dev
.
first
;
...
...
@@ -824,6 +825,7 @@ void AlsaLayer::audioCallback()
if
(
not
safeUpdate
(
ringtoneHandle_
,
ringtoneAvailSmpl
))
return
;
int
ringtoneAvailBytes
=
ringtoneAvailSmpl
*
sizeof
(
SFLAudioSample
);
AudioBuffer
out
(
ringtoneAvailSmpl
);
...
...
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