Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
4a664536
Commit
4a664536
authored
Jun 03, 2010
by
Alexandre Savard
Browse files
[#3470] Fix delay in ALSA
parent
c484694f
Changes
2
Show whitespace changes
Inline
Side-by-side
sflphone-common/src/audio/alsa/alsalayer.cpp
View file @
4a664536
...
...
@@ -456,12 +456,13 @@ bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate)
int
err
;
int
format
;
int
periods
=
4
;
int
periodsize
=
2048
;
int
periodsize
=
160
;
/* Allocate the snd_pcm_hw_params_t struct */
snd_pcm_hw_params_malloc
(
&
hwparams
);
_periodSize
=
2048
;
// _periodSize = periodsize;
_periodSize
=
periodsize
;
/* Full configuration space */
if
(
(
err
=
snd_pcm_hw_params_any
(
pcm_handle
,
hwparams
))
<
0
)
{
...
...
@@ -553,7 +554,7 @@ bool AlsaLayer::alsa_set_params (snd_pcm_t *pcm_handle, int type, int rate)
/* Set the start threshold */
if
(
(
err
=
snd_pcm_sw_params_set_start_threshold
(
pcm_handle
,
swparams
,
2700
/*
period
s
ize*2
*/
))
<
0
)
{
if
(
(
err
=
snd_pcm_sw_params_set_start_threshold
(
pcm_handle
,
swparams
,
_
period
S
ize
*
2
))
<
0
)
{
_debugAlsa
(
"Audio: Error: Cannot set start threshold (%s)"
,
snd_strerror
(
err
));
return
false
;
}
...
...
@@ -919,9 +920,11 @@ void AlsaLayer::audioCallback(void)
// framePerBuffer are the number of data for one channel (left)
urgentAvailBytes
=
_urgentRingBuffer
.
AvailForGet
();
if
(
!
_PlaybackHandle
)
if
(
!
_PlaybackHandle
||
!
_CaptureHandle
)
return
;
snd_pcm_wait
(
_PlaybackHandle
,
20
);
int
playbackAvailSmpl
=
snd_pcm_avail_update
(
_PlaybackHandle
);
int
playbackAvailBytes
=
playbackAvailSmpl
*
sizeof
(
SFLDataFormat
);
// _debug("PLAYBACK: %d", playbackAvailSmpl);
...
...
@@ -1086,7 +1089,7 @@ void AlsaLayer::audioCallback(void)
if
(
is_capture_running
())
{
micAvailBytes
=
snd_pcm_avail_update
(
_CaptureHandle
);
// _debug("
micAvailBytes
%i", micAvailBytes);
// _debug("
CAPTURE:
%i", micAvailBytes);
if
(
micAvailBytes
>
0
)
{
micAvailPut
=
getMainBuffer
()
->
availForPut
();
...
...
sflphone-common/src/eventthread.cpp
View file @
4a664536
...
...
@@ -65,7 +65,7 @@ void AudioThread::run (void)
{
while
(
!
testCancel
())
{
_alsa
->
audioCallback
();
Thread
::
sleep
(
5
);
Thread
::
sleep
(
20
);
}
}
Write
Preview
Supports
Markdown
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