diff --git a/sflphone-common/src/audio/alsa/alsalayer.cpp b/sflphone-common/src/audio/alsa/alsalayer.cpp index 2938219c8af8e04e96903b9fcd1d4725ad77623a..0fc73f67fb6bac02788d6681eb5f173ee182978a 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 0dcace767bab39182c745c4f3ac37ca000bc9fd7..9853fad03ef44bf17a42d53457edccc3d357178f 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 2e3dbee8e2e9eb484ea13f16dadfb3b0c1086653..35b7abd073cbdaaa14cb90498e3f7b2d90126350 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 94c6ec1b2447746d075ad52990e1e2fa05c0c30e..a25eb0e0a62e12c299de7e73f7a67406566a6204 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())