From 3a5b0231598732a00382aa54b73cde46a6feeb7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=
 <rafael.carre@savoirfairelinux.com>
Date: Tue, 9 Aug 2011 16:48:03 -0400
Subject: [PATCH] MainBuffer::putData() : remove constant (=100) volume
 argument

---
 sflphone-common/src/audio/alsa/alsalayer.cpp         |  4 ++--
 sflphone-common/src/audio/audiolayer.cpp             |  4 ++--
 .../src/audio/audiortp/AudioRtpRecordHandler.cpp     |  4 ++--
 sflphone-common/src/audio/mainbuffer.cpp             |  6 +++---
 sflphone-common/src/audio/mainbuffer.h               |  2 +-
 sflphone-common/src/audio/pulseaudio/pulselayer.cpp  |  4 ++--
 sflphone-common/src/iax/iaxvoiplink.cpp              |  4 ++--
 sflphone-common/test/mainbuffertest.cpp              | 12 ++++++------
 8 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/sflphone-common/src/audio/alsa/alsalayer.cpp b/sflphone-common/src/audio/alsa/alsalayer.cpp
index c13d56450e..4261eb4896 100644
--- a/sflphone-common/src/audio/alsa/alsalayer.cpp
+++ b/sflphone-common/src/audio/alsa/alsalayer.cpp
@@ -1038,7 +1038,7 @@ void AlsaLayer::audioCallback (void)
 
         _audiofilter->processAudio (rsmpl_out, nbSample*sizeof (SFLDataFormat));
 
-        getMainBuffer()->putData (rsmpl_out, nbSample * sizeof (SFLDataFormat), 100);
+        getMainBuffer()->putData (rsmpl_out, nbSample * sizeof (SFLDataFormat));
 
         free (rsmpl_out);
     } else {
@@ -1047,7 +1047,7 @@ void AlsaLayer::audioCallback (void)
         if (filter_out) {
             _audiofilter->processAudio (in, filter_out, toPut);
             // captureFile->write ( (const char *) filter_out, toPut);
-            getMainBuffer()->putData (filter_out, toPut, 100);
+            getMainBuffer()->putData (filter_out, toPut);
             free (filter_out);
         }
     }
diff --git a/sflphone-common/src/audio/audiolayer.cpp b/sflphone-common/src/audio/audiolayer.cpp
index 86b7c32d49..1615d97c71 100644
--- a/sflphone-common/src/audio/audiolayer.cpp
+++ b/sflphone-common/src/audio/audiolayer.cpp
@@ -72,10 +72,10 @@ int AudioLayer::putMain (void *buffer, int toCopy, std::string call_id)
     a = getMainBuffer()->availForPut (call_id);
 
     if (a >= toCopy) {
-        return getMainBuffer()->putData (buffer, toCopy, 100, call_id);
+        return getMainBuffer()->putData (buffer, toCopy, call_id);
     } else {
         _debug ("Chopping sound, Ouch! RingBuffer full ?");
-        return getMainBuffer()->putData (buffer, a, 100, call_id);
+        return getMainBuffer()->putData (buffer, a, call_id);
     }
 
     return 0;
diff --git a/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp b/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp
index ce88e94b2c..cfc0aa51c9 100644
--- a/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp
+++ b/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp
@@ -383,7 +383,7 @@ void AudioRtpRecordHandler::processDataDecode (unsigned char *spkrData, unsigned
         }
 
         // put data in audio layer, size in byte
-        Manager::instance().getMainBuffer()->putData (spkrDataConverted, nbSample * sizeof (SFLDataFormat), 100, _id);
+        Manager::instance().getMainBuffer()->putData (spkrDataConverted, nbSample * sizeof (SFLDataFormat), _id);
 
 
     } else {
@@ -391,7 +391,7 @@ void AudioRtpRecordHandler::processDataDecode (unsigned char *spkrData, unsigned
     	    echoCanceller.putData(spkrDataDecoded, expandedSize);
     	}
         // put data in audio layer, size in byte
-        Manager::instance().getMainBuffer()->putData (spkrDataDecoded, expandedSize, 100, _id);
+        Manager::instance().getMainBuffer()->putData (spkrDataDecoded, expandedSize, _id);
     }
 }
 
diff --git a/sflphone-common/src/audio/mainbuffer.cpp b/sflphone-common/src/audio/mainbuffer.cpp
index 8e74c5dc4f..82a52d82ed 100644
--- a/sflphone-common/src/audio/mainbuffer.cpp
+++ b/sflphone-common/src/audio/mainbuffer.cpp
@@ -298,7 +298,7 @@ void MainBuffer::unBindAllHalfDuplexOut (std::string process_id)
 }
 
 
-int MainBuffer::putData (void *buffer, int toCopy, unsigned short volume, std::string call_id)
+int MainBuffer::putData (void *buffer, int toCopy, std::string call_id)
 {
     ost::MutexLock guard (_mutex);
 
@@ -314,11 +314,11 @@ int MainBuffer::putData (void *buffer, int toCopy, unsigned short volume, std::s
 
     if (a >= toCopy) {
 
-        return ring_buffer->Put (buffer, toCopy, volume);
+        return ring_buffer->Put (buffer, toCopy, 100);
 
     } else {
 
-        return ring_buffer->Put (buffer, a, volume);
+        return ring_buffer->Put (buffer, a, 100);
     }
 
 }
diff --git a/sflphone-common/src/audio/mainbuffer.h b/sflphone-common/src/audio/mainbuffer.h
index b84e110263..8d74dc3deb 100644
--- a/sflphone-common/src/audio/mainbuffer.h
+++ b/sflphone-common/src/audio/mainbuffer.h
@@ -89,7 +89,7 @@ class MainBuffer
 
         void unBindAllHalfDuplexOut (std::string process_id);
 
-        int putData (void *buffer, int toCopy, unsigned short volume = 100, std::string call_id = default_id);
+        int putData (void *buffer, int toCopy, std::string call_id = default_id);
 
         int getData (void *buffer, int toCopy, unsigned short volume = 100, std::string call_id = default_id);
 
diff --git a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
index 08c2e6db98..03e3049d40 100644
--- a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
+++ b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
@@ -889,7 +889,7 @@ void PulseLayer::readFromMic (void)
             // remove dc offset
             _audiofilter->processAudio (rsmpl_out, nbSample*sizeof (SFLDataFormat));
 
-            getMainBuffer()->putData (rsmpl_out, nbSample*sizeof (SFLDataFormat), 100);
+            getMainBuffer()->putData (rsmpl_out, nbSample*sizeof (SFLDataFormat));
 
             pa_xfree (rsmpl_out);
 
@@ -902,7 +902,7 @@ void PulseLayer::readFromMic (void)
             // remove dc offset
             _audiofilter->processAudio ( (SFLDataFormat *) data, filter_out, r);
 
-            getMainBuffer()->putData (filter_out, r, 100);
+            getMainBuffer()->putData (filter_out, r);
 
             pa_xfree (filter_out);
         }
diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp
index 4918a0cf85..5a23dfdd35 100644
--- a/sflphone-common/src/iax/iaxvoiplink.cpp
+++ b/sflphone-common/src/iax/iaxvoiplink.cpp
@@ -976,12 +976,12 @@ IAXVoIPLink::iaxHandleVoiceEvent (iax_event* event, IAXCall* call)
             nbInt16 = converter->upsampleData (spkrDataDecoded, spkrDataConverted, audioCodec->getClockRate(), _mainBufferSampleRate, nbSample_);
 
             /* Write the data to the mic ring buffer */
-            audiolayer->getMainBuffer()->putData (spkrDataConverted, nbInt16 * sizeof (SFLDataFormat), 100, call->getCallId());
+            audiolayer->getMainBuffer()->putData (spkrDataConverted, nbInt16 * sizeof (SFLDataFormat), call->getCallId());
 
         } else {
 
             /* Write the data to the mic ring buffer */
-            audiolayer->getMainBuffer()->putData (spkrDataDecoded, nbInt16 * sizeof (SFLDataFormat), 100, call->getCallId());
+            audiolayer->getMainBuffer()->putData (spkrDataDecoded, nbInt16 * sizeof (SFLDataFormat), call->getCallId());
 
         }
 
diff --git a/sflphone-common/test/mainbuffertest.cpp b/sflphone-common/test/mainbuffertest.cpp
index 002e9cdab1..68c4d087de 100644
--- a/sflphone-common/test/mainbuffertest.cpp
+++ b/sflphone-common/test/mainbuffertest.cpp
@@ -929,14 +929,14 @@ void MainBufferTest::testGetPutDataByID()
 
     // pu by test_id get by test_id
     CPPUNIT_ASSERT (_mainbuffer.availForPut (test_id) == avail_for_put_defaultid);
-    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input2, sizeof (int), 100, test_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input2, sizeof (int), test_id) == sizeof (int));
     CPPUNIT_ASSERT (_mainbuffer.availForGetByID (test_id, default_id) == sizeof (int));
     CPPUNIT_ASSERT (_mainbuffer.getDataByID (&test_output, sizeof (int), 100, test_id, default_id) == sizeof (int));
     CPPUNIT_ASSERT (_mainbuffer.availForGetByID (test_id, default_id) == 0);
     CPPUNIT_ASSERT (test_input2 == test_output);
 
     // put/get by false id
-    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input2, sizeof (int), 100, false_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input2, sizeof (int), false_id) == 0);
     CPPUNIT_ASSERT (_mainbuffer.getDataByID (&test_input2, sizeof (int), 100, false_id, false_id) == 0);
     CPPUNIT_ASSERT (_mainbuffer.getDataByID (&test_input2, sizeof (int), 100, default_id, false_id) == 0);
     CPPUNIT_ASSERT (_mainbuffer.getDataByID (&test_input2, sizeof (int), 100, false_id, default_id) == 0);
@@ -969,7 +969,7 @@ void MainBufferTest::testGetPutData()
 
     // put by default_id, get by test_id
     CPPUNIT_ASSERT (_mainbuffer.availForPut() == avail_for_put_defaultid);
-    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input1, sizeof (int), 100) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input1, sizeof (int)) == sizeof (int));
     CPPUNIT_ASSERT (_mainbuffer.availForPut() == (avail_for_put_defaultid - (int) sizeof (int)));
     CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id) == sizeof (int));
     CPPUNIT_ASSERT (_mainbuffer.getData (&test_output, sizeof (int), 100, test_id) == sizeof (int));
@@ -983,7 +983,7 @@ void MainBufferTest::testGetPutData()
 
     // put by test_id, get by default_id
     CPPUNIT_ASSERT (_mainbuffer.availForPut (test_id) == avail_for_put_testid);
-    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input2, sizeof (int), 100, test_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input2, sizeof (int), test_id) == sizeof (int));
     CPPUNIT_ASSERT (_mainbuffer.availForPut (test_id) == (avail_for_put_testid - (int) sizeof (int)));
     CPPUNIT_ASSERT (_mainbuffer.availForGet() == sizeof (int));
     CPPUNIT_ASSERT (_mainbuffer.getData (&test_output, sizeof (int), 100) == sizeof (int));
@@ -1007,7 +1007,7 @@ void MainBufferTest::testDiscardFlush()
     // int test_output_size;
     // int init_size;
 
-    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input1, sizeof (int), 100, test_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input1, sizeof (int), test_id) == sizeof (int));
     CPPUNIT_ASSERT (_mainbuffer.availForGet() == sizeof (int));
     _mainbuffer.discard (sizeof (int));
     CPPUNIT_ASSERT (_mainbuffer.availForGet() == 0);
@@ -1341,7 +1341,7 @@ void MainBufferTest::testConference()
     CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
     CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0);
     // put data test ring buffers
-    CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int)) == sizeof (int));
     test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
     CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
     CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
-- 
GitLab