From 7f71f3ac890512ecae2d21c6ca8022ec644ebe21 Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Fri, 24 Oct 2008 17:02:54 -0400
Subject: [PATCH] warning removed

---
 src/audio/alsalayer.cpp | 28 +++-------------------------
 src/iaxvoiplink.cpp     | 17 +++++++++--------
 2 files changed, 12 insertions(+), 33 deletions(-)

diff --git a/src/audio/alsalayer.cpp b/src/audio/alsalayer.cpp
index 4fe02554f3..cf1df47127 100644
--- a/src/audio/alsalayer.cpp
+++ b/src/audio/alsalayer.cpp
@@ -134,28 +134,7 @@ void AlsaLayer::AlsaCallBack( snd_async_handler_t* pcm_callback )
     void 
 AlsaLayer::fillHWBuffer( void)
 {
-    unsigned char* data;
-    int pcmreturn, l1, l2;
-    short s1, s2;
-    int periodSize = 128 ;
-    int frames = periodSize >> 2 ;
-    _debug("frames  = %d\n", frames);
-
-    data = (unsigned char*)malloc(periodSize);
-    for(l1 = 0; l1 < 100; l1++) {
-        for(l2 = 0; l2 < frames; l2++) {
-            s1 = 0;
-            s2 = 0;
-            data[4*l2] = (unsigned char)s1;
-            data[4*l2+1] = s1 >> 8;
-            data[4*l2+2] = (unsigned char)s2;
-            data[4*l2+3] = s2 >> 8;
-        }
-        while ((pcmreturn = snd_pcm_writei(_PlaybackHandle, data, frames)) < 0) {
-            snd_pcm_prepare(_PlaybackHandle);
-            //_debugAlsa("< Buffer Underrun >\n");
-        }
-    }
+    
 }
 
     bool
@@ -165,7 +144,6 @@ AlsaLayer::isStreamActive (void)
     return (isPlaybackActive() && isCaptureActive());
 }
 
-
     int 
 AlsaLayer::playSamples(void* buffer, int toCopy, bool isTalking)
 {
@@ -199,7 +177,7 @@ AlsaLayer::canGetMic()
     int avail;
     if ( _CaptureHandle ) {
         avail = snd_pcm_avail_update( _CaptureHandle );
-        //printf("%d\n", avail ); 
+        printf("%d\n", avail ); 
         if(avail > 0)
             return avail;
         else 
@@ -339,7 +317,7 @@ bool AlsaLayer::alsa_set_params( snd_pcm_t *pcm_handle, int type, int rate ){
         return false;
     }
     if(dir!=0) {
-        _debugAlsa("(%i) The choosen period size %d bytes is not supported by your hardware.\nUsing %d instead.\n ", type, periodsize, exact_lvalue);
+        _debugAlsa("(%i) The choosen period size %d bytes is not supported by your hardware.\nUsing %d instead.\n ", type, (int)periodsize, (int)exact_lvalue);
     }
     periodsize=exact_lvalue;
     /* Set the number of fragments */
diff --git a/src/iaxvoiplink.cpp b/src/iaxvoiplink.cpp
index f8bf510607..1bbdd62889 100644
--- a/src/iaxvoiplink.cpp
+++ b/src/iaxvoiplink.cpp
@@ -219,6 +219,10 @@ IAXVoIPLink::sendAudioFromMic(void)
     int maxBytesToGet, availBytesFromMic, bytesAvail, nbSample, compSize;
     AudioCodec *ac;
 
+    // We have to update the audio layer type in case we switched
+    // TODO Find out a better way to do it
+    updateAudiolayer();
+
     IAXCall* currentCall = getIAXCall(Manager::instance().getCurrentCallId());
   
     if (!currentCall) {
@@ -231,15 +235,15 @@ IAXVoIPLink::sendAudioFromMic(void)
 
   // Just make sure the currentCall is in state to receive audio right now.
   //_debug("Here we get: connectionState: %d   state: %d \n",
-  // currentCall->getConnectionState(),
-  // currentCall->getState());
+   //currentCall->getConnectionState(),
+   //currentCall->getState());
 
   if (currentCall->getConnectionState() != Call::Connected ||
       currentCall->getState() != Call::Active) {
     return;
   }
 
-  ac = currentCall -> getCodecMap().getCodec( currentCall -> getAudioCodec() );
+  ac = currentCall->getCodecMap().getCodec( currentCall -> getAudioCodec() );
   if (!ac) {
     // Audio codec still not determined.
     if (audiolayer) {
@@ -255,14 +259,11 @@ IAXVoIPLink::sendAudioFromMic(void)
     // we have to get 20ms of data from the mic *20/1000 = /50
     // rate/50 shall be lower than IAX__20S_48KHZ_MAX
     maxBytesToGet = audiolayer->getSampleRate()* audiolayer->getFrameSize() / 1000 * sizeof(SFLDataFormat);
-
-    // We have to update the audio layer type in case we switched
-    // TODO Find out a better way to do it
-    updateAudiolayer();
-
+    
     // available bytes inside ringbuffer
     availBytesFromMic = audiolayer->canGetMic();
 
+    _debug("max bytes=%i - avail = %i\n", maxBytesToGet, availBytesFromMic);
 
     if (availBytesFromMic < maxBytesToGet) {
       // We need packets full!
-- 
GitLab