From ac78a2132c98fa0d0a0edbf89669d330717a92cf Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.net>
Date: Thu, 29 Oct 2009 17:41:33 -0400
Subject: [PATCH] [#1933] Get rid of getMicAvail and getMicData in audiolayer
 (not used anymore)

---
 sflphone-common/src/audio/alsa/alsalayer.cpp | 47 --------------------
 sflphone-common/src/audio/audiolayer.cpp     |  6 +--
 sflphone-common/src/audio/audiolayer.h       | 18 --------
 sflphone-common/src/audio/ringbuffer.cpp     |  3 +-
 4 files changed, 3 insertions(+), 71 deletions(-)

diff --git a/sflphone-common/src/audio/alsa/alsalayer.cpp b/sflphone-common/src/audio/alsa/alsalayer.cpp
index 2938219c8a..0fc73f67fb 100644
--- a/sflphone-common/src/audio/alsa/alsalayer.cpp
+++ b/sflphone-common/src/audio/alsa/alsalayer.cpp
@@ -199,56 +199,9 @@ AlsaLayer::stopStream (void)
     /* Flush the ring buffers */
     flushUrgent ();
     flushMain ();
-    flushMic ();
-}
-
-int
-AlsaLayer::canGetMic()
-{
-
-    /*
-    int avail;
-
-    if (!_CaptureHandle)
-        return 0;
-
-    avail = snd_pcm_avail_update (_CaptureHandle);
-
-    if (avail == -EPIPE) {
-        stop_capture ();
-        return 0;
-    } else
-        return ( (avail<0) ?0:avail);
-
-    if(_CaptureHandle)
-
-        return _micRingBuffer.AvailForGet();
-    else
-        return 0;*/
 
-    return 0;
 }
 
-int
-AlsaLayer::getMic (void *buffer, int toCopy)
-{
-    /*
-    if( _CaptureHandle ){
-        return _micRingBuffer.Get(buffer, toCopy,100);
-    }
-    else
-        return 0;
-    int res = 0;
-
-    if (_CaptureHandle) {
-        res = read (buffer, toCopy);
-        adjustVolume (buffer, toCopy, SFL_PCM_CAPTURE);
-    }
-
-    return res;*/
-
-    return 0;
-}
 
 bool AlsaLayer::isCaptureActive (void)
 {
diff --git a/sflphone-common/src/audio/audiolayer.cpp b/sflphone-common/src/audio/audiolayer.cpp
index 0dcace767b..9853fad03e 100644
--- a/sflphone-common/src/audio/audiolayer.cpp
+++ b/sflphone-common/src/audio/audiolayer.cpp
@@ -27,17 +27,13 @@ void AudioLayer::flushMain (void)
     getMainBuffer()->flushAllBuffers();
 }
 
+
 void AudioLayer::flushUrgent (void)
 {
     ost::MutexLock guard (_mutex);
     _urgentRingBuffer.flushAll();
 }
 
-void AudioLayer::flushMic (void)
-{
-    ost::MutexLock guard (_mutex);
-    getMainBuffer()->flushDefault();
-}
 
 int AudioLayer::putUrgent (void* buffer, int toCopy)
 {
diff --git a/sflphone-common/src/audio/audiolayer.h b/sflphone-common/src/audio/audiolayer.h
index 2e3dbee8e2..35b7abd073 100644
--- a/sflphone-common/src/audio/audiolayer.h
+++ b/sflphone-common/src/audio/audiolayer.h
@@ -109,20 +109,6 @@ class AudioLayer {
          */
         virtual void stopStream(void) = 0;
 
-        /**
-         * Query the capture device for number of bytes available in the hardware ring buffer
-         * @return int The number of bytes available
-         */
-        virtual int canGetMic() = 0;
-
-        /**
-         * Get data from the capture device
-         * @param buffer The buffer for data
-         * @param toCopy The number of bytes to get
-         * @return int The number of bytes acquired ( 0 if an error occured)
-         */
-        virtual int getMic(void * buffer, int toCopy) = 0;
-
         /**
          * Send a chunk of data to the hardware buffer to start the playback
          * Copy data in the urgent buffer. 
@@ -144,10 +130,6 @@ class AudioLayer {
 
         void flushUrgent (void);
 
-        /**
-         * Flush the mic ringbuffer
-         */
-        void flushMic();
 
         virtual bool isCaptureActive (void) = 0;
 
diff --git a/sflphone-common/src/audio/ringbuffer.cpp b/sflphone-common/src/audio/ringbuffer.cpp
index 94c6ec1b24..a25eb0e0a6 100644
--- a/sflphone-common/src/audio/ringbuffer.cpp
+++ b/sflphone-common/src/audio/ringbuffer.cpp
@@ -54,7 +54,7 @@ RingBuffer::~RingBuffer()
 void
 RingBuffer::flush (CallID call_id)
 {
-    _debug("flush: call_id on iax\n");
+    _debug("flush: reinit \"%s\" readpointer in \"%s\" ringbuffer\n", call_id.c_str(), buffer_id.c_str());
     storeReadPointer(mEnd, call_id);
 }
 
@@ -62,6 +62,7 @@ RingBuffer::flush (CallID call_id)
 void
 RingBuffer::flushAll ()
 {
+    // _debug("flushall: reinit all readpointer in \"%s\" ringbuffer\n", buffer_id.c_str());
 
     ReadPointer::iterator iter_pointer = _readpointer.begin();
     while(iter_pointer != _readpointer.end())
-- 
GitLab