From d93b45e771fbd363a7e828eaa58f67c5d8e8c981 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.net>
Date: Wed, 21 Oct 2009 17:24:45 -0400
Subject: [PATCH] [#2333] Less underrun with these value

---
 sflphone-common/src/audio/pulseaudio/audiostream.cpp | 6 +++---
 sflphone-common/src/audio/pulseaudio/pulselayer.cpp  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sflphone-common/src/audio/pulseaudio/audiostream.cpp b/sflphone-common/src/audio/pulseaudio/audiostream.cpp
index 991815835c..778dd44b67 100644
--- a/sflphone-common/src/audio/pulseaudio/audiostream.cpp
+++ b/sflphone-common/src/audio/pulseaudio/audiostream.cpp
@@ -186,9 +186,9 @@ AudioStream::createStream (pa_context* c)
     if (_streamType == PLAYBACK_STREAM) {
         attributes->maxlength = 64000;
         attributes->tlength = 32000;
-        attributes->prebuf = 4096;      // Pulseaudio will not start if prebuffering is not reached
-        attributes->minreq = 2048;      // The server side playback framesize
-        attributes->fragsize = 8192;    // Fragment size at wich we receive an interupt
+        attributes->prebuf = 2048;      // Pulseaudio will not start if prebuffering is not reached
+        attributes->minreq = 1024;       // The server side playback framesize
+        attributes->fragsize = 4096;    // Fragment size at wich we receive an interupt
         pa_stream_connect_playback( s , NULL , attributes, PA_STREAM_INTERPOLATE_TIMING, &_volume, NULL);
         // pa_stream_connect_playback (s , NULL , attributes, PA_STREAM_START_CORKED, &_volume, NULL);
     } else if (_streamType == CAPTURE_STREAM) {
diff --git a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
index faa15f006f..9da8dadf4b 100644
--- a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
+++ b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
@@ -59,10 +59,10 @@ static void playback_underflow_callback (pa_stream* s,  void* userdata UNUSED)
     _debug ("PulseLayer::Buffer Underflow\n");
 
     // fill in audio buffer twice the prebuffering value to restart playback
-    SFLDataFormat* out = (SFLDataFormat*) pa_xmalloc (framesPerBuffer*sizeof(SFLDataFormat)*2);
-    bzero (out, framesPerBuffer*sizeof(SFLDataFormat)*2);
+    SFLDataFormat* out = (SFLDataFormat*) pa_xmalloc (framesPerBuffer*sizeof(SFLDataFormat));
+    bzero (out, framesPerBuffer*sizeof(SFLDataFormat));
 
-    pa_stream_write (s, out, framesPerBuffer*sizeof(SFLDataFormat)*2, NULL, 0, PA_SEEK_RELATIVE); 
+    pa_stream_write (s, out, framesPerBuffer*sizeof(SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE); 
     pa_stream_trigger (s, NULL, NULL);
 
     pa_xfree (out);
-- 
GitLab