Commit 59a295d8 authored by Alexandre Savard's avatar Alexandre Savard

[#2333] Fix alsa playback to reduce underrun

parent 420906d4
......@@ -713,6 +713,8 @@ AlsaLayer::handle_xrun_playback (void)
if (state == SND_PCM_STATE_XRUN) {
stopPlaybackStream ();
preparePlaybackStream ();
_trigger_request = true;
}
}
......@@ -958,8 +960,12 @@ void AlsaLayer::audioCallback (void)
if((tone == 0) && (file_tone == 0)) {
bzero (out, maxNbBytesToGet);
write (out, maxNbBytesToGet);
SFLDataFormat* zeros = (SFLDataFormat*)malloc (framesPerBufferAlsa * sizeof (SFLDataFormat));
bzero (zeros, framesPerBufferAlsa * sizeof (SFLDataFormat));
write (zeros, framesPerBufferAlsa * sizeof (SFLDataFormat));
free (zeros);
}
}
......
......@@ -473,7 +473,7 @@ void PulseLayer::writeToSpeaker (void)
if (urgentAvailBytes > 0) {
_debug("urgentAvailBytes: %i\n", urgentAvailBytes);
// _debug("urgentAvailBytes: %i\n", urgentAvailBytes);
toGet = (urgentAvailBytes < (int) (framesPerBuffer * sizeof (SFLDataFormat))) ? urgentAvailBytes : framesPerBuffer * sizeof (SFLDataFormat);
out = (SFLDataFormat*) pa_xmalloc (toGet * sizeof (SFLDataFormat));
......@@ -572,7 +572,7 @@ void PulseLayer::writeToSpeaker (void)
if((tone == 0) && (file_tone == 0)) {
_debug("maxNbBytesToGet: %i\n", maxNbBytesToGet);
// _debug("maxNbBytesToGet: %i\n", maxNbBytesToGet);
SFLDataFormat* zeros = (SFLDataFormat*)pa_xmalloc (framesPerBuffer*sizeof(SFLDataFormat));
bzero (zeros, framesPerBuffer*sizeof(SFLDataFormat));
......
......@@ -1689,9 +1689,6 @@ ManagerImpl::playDtmf (char code, bool isTalking)
// ms/s
size = (int) ((pulselen * (float) audiolayer->getSampleRate()) / 1000);
_debug("DTMF ---------------- size: %i\n", size);
_debug("DTMF ----------pulselength: %i\n", pulselen);
// this buffer is for mono
// TODO <-- this should be global and hide if same size
buf = new SFLDataFormat[size];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment