diff --git a/sflphone-common/src/audio/alsa/alsalayer.cpp b/sflphone-common/src/audio/alsa/alsalayer.cpp index 5c19f3da8cce792c8b86742700bcfe1aceffd651..1914560d0e04df03be8d9d9917b5ee163944b273 100644 --- a/sflphone-common/src/audio/alsa/alsalayer.cpp +++ b/sflphone-common/src/audio/alsa/alsalayer.cpp @@ -902,7 +902,7 @@ AlsaLayer::soundCardGetIndex (std::string description) void AlsaLayer::audioCallback(void) { - int toGet, urgentAvailBytes, normalAvailBytes, maxBytes; + int toGet, urgentAvailBytes, normalAvailBytes; unsigned short spkrVolume, micVolume; AudioLoop *tone; AudioLoop *file_tone; diff --git a/sflphone-common/src/audio/audiorecord.cpp b/sflphone-common/src/audio/audiorecord.cpp index 06d97d0b30d0ee58919e957e3f243245a880ae1e..491996185d70713f17304630842f19358789f995 100644 --- a/sflphone-common/src/audio/audiorecord.cpp +++ b/sflphone-common/src/audio/audiorecord.cpp @@ -494,7 +494,7 @@ void AudioRecord::recData (SFLDataFormat* buffer, int nSamples) } -void AudioRecord::recData (SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int nSamples_1, int nSamples_2) +void AudioRecord::recData (SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int nSamples_1, int nSamples_2 UNUSED) { if (recordingEnabled_) { diff --git a/sflphone-common/src/audio/audiorecorder.cpp b/sflphone-common/src/audio/audiorecorder.cpp index bb846e022b3a728c3bca022514583d0e84e30663..b12a3016e92b7de9cdf37a3e940059782e7a11ce 100644 --- a/sflphone-common/src/audio/audiorecorder.cpp +++ b/sflphone-common/src/audio/audiorecorder.cpp @@ -70,10 +70,6 @@ void AudioRecorder::run (void) if(availBytes > 0) { - int got = mbuffer->getData(buffer, availBytes, 100, recorderId); - - int availBytesAfter = mbuffer->availForGet(recorderId); - arecord->recData(buffer, availBytes/sizeof(SFLDataFormat)); } diff --git a/sflphone-common/src/audio/dcblocker.cpp b/sflphone-common/src/audio/dcblocker.cpp index b1a18eb1a2e6ddcf97568825cd057df55a8b42fc..06505b428207bc3c25639497e1f06f78ef2285bb 100644 --- a/sflphone-common/src/audio/dcblocker.cpp +++ b/sflphone-common/src/audio/dcblocker.cpp @@ -42,9 +42,9 @@ void DcBlocker::reset() _ym1 = 0; } -void DcBlocker::putData(SFLDataFormat *inputData, int nbBytes) {} +void DcBlocker::putData(SFLDataFormat *inputData UNUSED, int nbBytes UNUSED) {} -int DcBlocker::getData(SFLDataFormat *outputData) { return 0; } +int DcBlocker::getData(SFLDataFormat *outputData UNUSED) { return 0; } void DcBlocker::process (SFLDataFormat *data, int nbBytes) { @@ -81,4 +81,4 @@ int DcBlocker::process(SFLDataFormat *inputData, SFLDataFormat *outputData, int } -void DcBlocker::process(SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes) {} +void DcBlocker::process(SFLDataFormat *micData UNUSED, SFLDataFormat *spkrData UNUSED, SFLDataFormat *outputData UNUSED, int nbBytes UNUSED) {} diff --git a/sflphone-common/src/audio/delaydetection.cpp b/sflphone-common/src/audio/delaydetection.cpp index 5c6ab4d742644ed469eb6ab426030680173ab82b..16326c12e9070f04b9ccf2c3d1d48de966a2bef3 100644 --- a/sflphone-common/src/audio/delaydetection.cpp +++ b/sflphone-common/src/audio/delaydetection.cpp @@ -32,7 +32,6 @@ #include "delaydetection.h" #include "math.h" -// #include <stdio.h> #include <string.h> #include <samplerate.h> @@ -163,7 +162,7 @@ void DelayDetection::putData(SFLDataFormat *inputData, int nbBytes) } -int DelayDetection::getData(SFLDataFormat *outputData) { return 0; } +int DelayDetection::getData(SFLDataFormat *outputData UNUSED) { return 0; } void DelayDetection::process(SFLDataFormat *inputData, int nbBytes) { @@ -184,19 +183,6 @@ void DelayDetection::process(SFLDataFormat *inputData, int nbBytes) { downsampleData(tmp, down, nbSamples, _downsamplingFactor); - /* - for(int i = 0; i < 10; i++) - _debug("up: %.10f", tmp[i]); - - for(int i = 0; i < 10; i++) - _debug("down: %.10f", down[i]); - - bandpassFilter(down, nbSamples/_downsamplingFactor); - - for(int i = 0; i < 10; i++) - _debug("band: %.10f", down[i]); - */ - memcpy(_captureDataDown+(_nbMicSampleStored/_downsamplingFactor), down, (nbSamples/_downsamplingFactor)*sizeof(float)); _nbMicSampleStored += nbSamples; @@ -208,50 +194,29 @@ void DelayDetection::process(SFLDataFormat *inputData, int nbBytes) { else return; - /* - for(int i = 0; i < 10; i++) - _debug("spkrRef: %.10f", _spkrReferenceDown[i]); - - for(int i = 0; i < 10; i++) - _debug("micSeg: %.10f", _captureDataDown[i]); - */ - _debug("_spkrDownSize: %d, _micDownSize: %d", _spkrDownSize, _micDownSize); crossCorrelate(_spkrReferenceDown, _captureDataDown, _correlationResult, _micDownSize, _spkrDownSize); int maxIndex = getMaxIndex(_correlationResult, _spkrDownSize); _debug("MaxIndex: %d", maxIndex); - - // reset(); } -int DelayDetection::process(SFLDataFormat *intputData, SFLDataFormat *outputData, int nbBytes) { return 0; } +int DelayDetection::process(SFLDataFormat *intputData UNUSED, SFLDataFormat *outputData UNUSED, int nbBytes UNUSED) { return 0; } -void DelayDetection::process(SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes) {} +void DelayDetection::process(SFLDataFormat *micData UNUSED, SFLDataFormat *spkrData UNUSED, SFLDataFormat *outputData UNUSED, int nbBytes UNUSED) {} void DelayDetection::crossCorrelate(float *ref, float *seg, float *res, int refSize, int segSize) { _debug("CrossCorrelate"); - int counter = 0; - // Output has same size as the int rsize = refSize; int ssize = segSize; int tmpsize = segSize-refSize+1; - /* - for(int i = 0; i < 32; i++) - _debug("ref: %.10f", ref[i]); - - for(int i = 0; i < 150; i++) - _debug("seg: %.10f", seg[i]); - */ - // perform autocorrelation on reference signal float acref = correlate(ref, ref, rsize); - // _debug("acref: %f", acref); // perform crossrelation on signal float acseg = 0.0; @@ -259,7 +224,6 @@ void DelayDetection::crossCorrelate(float *ref, float *seg, float *res, int refS while(--tmpsize) { --ssize; acseg = correlate(seg+tmpsize, seg+tmpsize, rsize); - // _debug("acseg: %f", acseg); res[ssize] = correlate(ref, seg+tmpsize, rsize); r = sqrt(acref*acseg); @@ -273,7 +237,6 @@ void DelayDetection::crossCorrelate(float *ref, float *seg, float *res, int refS int i = 0; while(rsize) { acseg = correlate(seg, seg, rsize); - // _debug("acseg: %f", acseg); res[ssize-1] = correlate(ref+i, seg, rsize); r = sqrt(acref*acseg); @@ -302,8 +265,6 @@ double DelayDetection::correlate(float *sig1, float *sig2, short size) { void DelayDetection::convertInt16ToFloat32(SFLDataFormat *input, float *output, int nbSamples) { - // factor is 1/(2^15), used to rescale the short int range to the - // [-1.0 - 1.0] float range. #define S2F_FACTOR .000030517578125f; int len = nbSamples; @@ -316,26 +277,6 @@ void DelayDetection::convertInt16ToFloat32(SFLDataFormat *input, float *output, void DelayDetection::downsampleData(float *input, float *output, int nbSamples, int factor) { - /* - float tmp[nbSamples]; - - for(int i = 0; i < nbSamples; i++) { - tmp[i] = _decimationFilter.getOutputSample(input[i]); - } - - int j; - for(j=_remainingIndex; j<nbSamples; j+=factor) { - output[j] = tmp[j]; - } - _remainingIndex = j - nbSamples; - */ - - /* - double downsampleFactor = (double) samplerate1 / samplerate2; - - int nbSamplesMax = (int) (samplerate1 * getFramesize() / 1000); - */ - int _src_err; SRC_STATE *_src_state = src_new (SRC_LINEAR, 1, &_src_err); @@ -351,13 +292,7 @@ void DelayDetection::downsampleData(float *input, float *output, int nbSamples, src_data.src_ratio = downfactor; src_data.end_of_input = 0; // More data will come - //src_short_to_float_array (dataIn, _floatBufferUpMic, nbSamples); - //_debug("downsample %d %f %d" , src_data.output_frames, src_data.src_ratio , nbSamples); src_process (_src_state, &src_data); - //_debug("downsample %d %f %d" , src_data.output_frames, src_data.src_ratio , nbSamples); - // nbSamples = (src_data.output_frames_gen > nbSamplesMax) ? nbSamplesMax : src_data.output_frames_gen; - //_debug("downsample %d %f %d" , src_data.output_frames, src_data.src_ratio , nbSamples); - // src_float_to_short_array (_floatBufferDownMic , dataOut , nbSamples); } } diff --git a/sflphone-common/src/audio/echocancel.cpp b/sflphone-common/src/audio/echocancel.cpp index aab1e8f9989fc18c7c79315ef6dd64c76de12018..612b1dbed76796b44102813c77eb7450ae5bf8c6 100644 --- a/sflphone-common/src/audio/echocancel.cpp +++ b/sflphone-common/src/audio/echocancel.cpp @@ -241,7 +241,7 @@ int EchoCancel::getData(SFLDataFormat *outputData) return copied; } -void EchoCancel::process(SFLDataFormat *data, int nbBytes) {} +void EchoCancel::process(SFLDataFormat *data UNUSED, int nbBytes UNUSED) {} int EchoCancel::process(SFLDataFormat *inputData, SFLDataFormat *outputData, int nbBytes) @@ -330,7 +330,7 @@ int EchoCancel::process(SFLDataFormat *inputData, SFLDataFormat *outputData, int return nbFrame * _smplPerFrame; } -void EchoCancel::process(SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes){ +void EchoCancel::process(SFLDataFormat *micData UNUSED, SFLDataFormat *spkrData UNUSED, SFLDataFormat *outputData UNUSED, int nbBytes UNUSED){ } diff --git a/sflphone-common/src/audio/echocancel.h b/sflphone-common/src/audio/echocancel.h index e0ceda0445a67dc636a89df8874b21367b6a0c54..f5b1b3d6824983eadc8b394ec7b1775d4e38d545 100644 --- a/sflphone-common/src/audio/echocancel.h +++ b/sflphone-common/src/audio/echocancel.h @@ -265,6 +265,17 @@ class EchoCancel : public Algorithm { int _spkrHistoryLength; + /** + * Factor for power estimation + */ + float _alpha; + + /** + * Termporary spkr level memories + */ + SFLDataFormat _spkrLevelMem; + SFLDataFormat _micLevelMem; + /** * Current playback level */ @@ -285,13 +296,6 @@ class EchoCancel : public Algorithm { */ int _micHistCnt; - /** - * Average speaker/microphone level history. Each value corespond to - * the averaged amplitude value over a segment (SEGMENT_LENGTH long) - */ - int _avgSpkrLevelHist[BUFF_SIZE]; - int _avgMicLevelHist[BUFF_SIZE]; - /** * Current linear gain factor to be applied on microphone */ @@ -302,11 +306,6 @@ class EchoCancel : public Algorithm { */ float _lastAmplFactor; - /** - * Linear gain factor buffer to adjust to system's latency - */ - float _delayLineAmplify[MAX_DELAY_LINE_AMPL]; - /** * read/write for mic gain delay */ @@ -328,17 +327,6 @@ class EchoCancel : public Algorithm { */ int _adaptCnt; - /** - * Factor for power estimation - */ - float _alpha; - - /** - * Termporary spkr level memories - */ - SFLDataFormat _spkrLevelMem; - SFLDataFormat _micLevelMem; - int _spkrAdaptCnt; int _micAdaptCnt; @@ -347,16 +335,38 @@ class EchoCancel : public Algorithm { int _micAdaptSize; + int _correlationSize; + + int _processedByte; + + /** + * true if noise suppressor is active, false elsewhere + */ + bool _echoActive; + + /** + * true if noise suppressor is active, false elsewhere + */ + bool _noiseActive; + + /** + * Average speaker/microphone level history. Each value corespond to + * the averaged amplitude value over a segment (SEGMENT_LENGTH long) + */ + int _avgSpkrLevelHist[BUFF_SIZE]; + int _avgMicLevelHist[BUFF_SIZE]; + + /** + * Linear gain factor buffer to adjust to system's latency + */ + float _delayLineAmplify[MAX_DELAY_LINE_AMPL]; + int _spkrAdaptArray[BUFF_SIZE]; int _micAdaptArray[BUFF_SIZE]; - int _correlationSize; - int _correlationArray[BUFF_SIZE]; - int _processedByte; - ofstream *micFile; ofstream *spkrFile; ofstream *echoFile; @@ -371,16 +381,6 @@ class EchoCancel : public Algorithm { SpeexPreprocessState *_noiseState; // #endif - /** - * true if noise suppressor is active, false elsewhere - */ - bool _echoActive; - - /** - * true if noise suppressor is active, false elsewhere - */ - bool _noiseActive; - DelayDetection _delayDetector; }; diff --git a/sflphone-common/src/audio/jitterbuf.cpp b/sflphone-common/src/audio/jitterbuf.cpp index c72a6387f9769ae91feefd23e332030a74a0d328..510317cfeda83c538a6d5769eacfc173c6113960 100755 --- a/sflphone-common/src/audio/jitterbuf.cpp +++ b/sflphone-common/src/audio/jitterbuf.cpp @@ -123,7 +123,7 @@ static int longcmp(const void *a, const void *b) \note maybe later we can make the history buckets variable size, or something? */ /* drop parameter determines whether we will drop outliers to minimize * delay */ -static int history_put(jitterbuf *jb, long ts, long now, long ms) +static int history_put(jitterbuf *jb, long ts, long now) { long delay = now - (ts - jb->info.resync_offset); long threshold = 2 * jb->info.jitter + jb->info.conf.resync_threshold; @@ -527,7 +527,7 @@ jb_return_code jb_put(jitterbuf *jb, void *data, const enum jb_frame_type type, if (type == JB_TYPE_VOICE) { /* presently, I'm only adding VOICE frames to history and drift calculations; mostly because with the * IAX integrations, I'm sending retransmitted control frames with their awkward timestamps through */ - if (history_put(jb,ts,now,ms)) { + if (history_put(jb,ts,now)) { jb->info.frames_dropped++; return JB_DROP; } diff --git a/sflphone-common/src/audio/pulseaudio/audiostream.cpp b/sflphone-common/src/audio/pulseaudio/audiostream.cpp index 41acf4c26362dcce9fa509f7d2e49ba257069009..8898fcdc39a8187dd46230c85d764b85c9a7bafa 100644 --- a/sflphone-common/src/audio/pulseaudio/audiostream.cpp +++ b/sflphone-common/src/audio/pulseaudio/audiostream.cpp @@ -68,7 +68,7 @@ AudioStream::connectStream(std::string* deviceName) return true; } -static void success_cb (pa_stream *s, int success, void *userdata) +static void success_cb (pa_stream *s, int success UNUSED, void *userdata) { assert (s); @@ -78,7 +78,6 @@ static void success_cb (pa_stream *s, int success, void *userdata) pa_threaded_mainloop_signal (mainloop, 0); } - bool AudioStream::drainStream (void) { diff --git a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp index 667f0cf2728e4910298733b49692da4df4f6788f..0d9afc8c9d03f522de46c86733fc077765fbd923 100755 --- a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp +++ b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp @@ -60,22 +60,12 @@ static void ringtone_callback (pa_stream* s, size_t bytes, void* userdata) { } - -static void stream_moved_callback(pa_stream *s, void *userdata) { - - int streamIndex = pa_stream_get_index(s); - int deviceIndex = pa_stream_get_device_index(s); +static void stream_moved_callback(pa_stream *s, void *userdata UNUSED) { _debug("stream_moved_callback: stream %d to %d", pa_stream_get_index(s), pa_stream_get_device_index(s)); - -} - -static void pa_success_callback(pa_context *c, int success, void *userdata) { - - _debug("Audio: Success callback"); } -static void latency_update_callback(pa_stream *p, void *userdata) { +static void latency_update_callback(pa_stream *p, void *userdata UNUSED) { pa_usec_t r_usec; @@ -90,7 +80,7 @@ static void latency_update_callback(pa_stream *p, void *userdata) { } -static void sink_input_info_callback(pa_context *c, const pa_sink_info *i, int eol, void *userdata) { +static void sink_input_info_callback(pa_context *c UNUSED, const pa_sink_info *i, int eol, void *userdata) { char s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX]; if(!eol) { @@ -124,10 +114,9 @@ static void sink_input_info_callback(pa_context *c, const pa_sink_info *i, int e ((PulseLayer *)userdata)->getSinkList()->push_back(deviceName); } - } -static void source_input_info_callback(pa_context *c, const pa_source_info *i, int eol, void *userdata) { +static void source_input_info_callback(pa_context *c UNUSED, const pa_source_info *i, int eol, void *userdata) { char s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX]; if(!eol) { @@ -163,8 +152,7 @@ static void source_input_info_callback(pa_context *c, const pa_source_info *i, i } } - -static void context_changed_callback(pa_context* c, pa_subscription_event_type_t t, uint32_t idx, void* userdata) +static void context_changed_callback(pa_context* c, pa_subscription_event_type_t t, uint32_t idx UNUSED, void* userdata UNUSED) { switch(t) { @@ -220,28 +208,15 @@ static void context_changed_callback(pa_context* c, pa_subscription_event_type_t _debug("Audio: Unknown event type"); } - } -/* -static void stream_suspended_callback (pa_stream *s UNUSED, void *userdata UNUSED) +static void playback_underflow_callback (pa_stream* s UNUSED, void* userdata UNUSED) { - _debug("Audio: Stream Suspended"); -} -*/ - - -static void playback_underflow_callback (pa_stream* s, void* userdata UNUSED) -{ - // _debug ("Audio: Buffer Underflow"); - // pa_stream_trigger (s, NULL, NULL); } static void playback_overflow_callback (pa_stream* s UNUSED, void* userdata UNUSED) { - // _debug ("Audio: Buffer OverFlow"); - } @@ -654,15 +629,6 @@ int PulseLayer::canGetMic() } -int PulseLayer::getMic (void *buffer, int toCopy) -{ - if (record) { - return 0; - } else - return 0; -} - - void PulseLayer::startStream (void) { if(_audiofilter) @@ -1012,8 +978,6 @@ void PulseLayer::readFromMic (void) void PulseLayer::ringtoneToSpeaker(void) { - int availBytes; - AudioLoop* file_tone = _manager->getTelephoneFile(); SFLDataFormat* out; diff --git a/sflphone-common/src/audio/pulseaudio/pulselayer.h b/sflphone-common/src/audio/pulseaudio/pulselayer.h index 047fe84093f133c5ee4a29ae9b676d993944d774..b2340dbe5e37d17f4d23d5d711ea99fad8cb0c48 100644 --- a/sflphone-common/src/audio/pulseaudio/pulselayer.h +++ b/sflphone-common/src/audio/pulseaudio/pulselayer.h @@ -100,14 +100,6 @@ class PulseLayer : public AudioLayer { */ int canGetMic(); - /** - * 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) - */ - int getMic(void *, int); - static void overflow ( pa_stream* s, void* userdata ); static void underflow ( pa_stream* s, void* userdata ); static void stream_state_callback( pa_stream* s, void* user_data ); diff --git a/sflphone-common/src/audio/sound/audiofile.cpp b/sflphone-common/src/audio/sound/audiofile.cpp index 9bde16aea379a854e4fcc092b920a4bb01e6a3c9..04be6d1d6cd78b1984236f1c7286bd8cfd03acc2 100644 --- a/sflphone-common/src/audio/sound/audiofile.cpp +++ b/sflphone-common/src/audio/sound/audiofile.cpp @@ -174,157 +174,3 @@ AudioFile::loadFile (const std::string& filename, AudioCodec* codec , unsigned i return true; } - - - -WavFile::WavFile() - : AudioLoop(), - _filename(), - _codec (NULL), - _start (false) - -{ -} - -WavFile::~WavFile() -{ -} - - -bool WavFile::isFileExist(const std::string& filename) -{ - - std::fstream fs(filename.c_str(), std::ios_base::in); - if(!fs) { - _debug("WavFile: File \"%s\" doesn't exist", filename.c_str()); - return false; - } - - return true; - -} - -bool WavFile::loadFile (const std::string& filename, AudioCodec* codec , unsigned int sampleRate) -{ - if(!isFileExist(filename)) - return false; - - std::fstream file; - - printf("WavFile: Open %s", filename.c_str()); - - file.open(filename.c_str(), std::ios::in | std::ios::binary); - - char riff[4] = {}; - - file.read(riff, 4); - - if ( strncmp("RIFF", riff, 4) != 0 ) { - _error("WavFile: File is not of RIFF format"); - return false; - } - - // Find the "fmt " chunk - char fmt[4] = {}; - - while ( strncmp("fmt ", fmt, 4) != 0 ) { - file.read(fmt, 4); - _debug("WavFile: Searching... %s", fmt); - } - - SINT32 chunkSize; // fmt chunk size - unsigned short formatTag; // data compression tag - - file.read((char*)&chunkSize, 4); // Read fmt chunk size. - file.read((char*)&formatTag, 2); - - _debug("Chunk size: %d\n", chunkSize); - _debug("Format tag: %d\n", formatTag); - - - if (formatTag != 1 ) { // PCM = 1, FLOAT = 3 { - _error("WaveFile: File contains an unsupported data format type"); - return false; - } - - // Get number of channels from the header. - SINT16 chan; - file.read((char*)&chan, 2); - - _channels = chan; - - _debug("WavFile: channel %d", _channels); - - - // Get file sample rate from the header. - SINT32 srate; - file.read((char*)&srate, 4); - - _fileRate = (double)srate; - - printf("WavFile: srate %d", srate); - - SINT32 avgb; - file.read((char*)&avgb, 4); - - _debug("WavFile: Average byte %i\n", avgb); - - SINT16 blockal; - file.read((char*)&blockal, 2); - - _debug("WaveFile: block alignment %d", blockal); - - // Determine the data type - _dataType = 0; - - SINT16 dt; - file.read((char*)&dt, 2); - - _debug("WaveFile: dt %d", dt); - - if ( formatTag == 1 ) { - if (dt == 8) - _dataType = 1; // SINT8; - else if (dt == 16) - _dataType = 2; // SINT16; - else if (dt == 32) - _dataType = 3; // SINT32; - } - - /* - else if ( formatTag == 3 ) - { - if (temp == 32) - dataType_ = FLOAT32; - else if (temp == 64) - dataType_ = FLOAT64; - } - */ - else { - _debug("WavFile: File's bits per sample is not supported"); - return false; - } - - // Find the "data" chunk - char data[4] = {}; - - while ( strncmp("data", data, 4) ) { - file.read(data, 4); - _debug("WavFile: Searching data"); - } - - // Get length of data from the header. - SINT32 bytes; - file.read((char*)&bytes, 4); - - _debug("WavFile: Data size in byte %ld", bytes); - - _fileSize = 8 * bytes / dt / _channels; // sample frames - - _debug("WavFile: Data size in frames %ld", _fileSize); - - _debug("WavFile: File successfully opened"); - - return true; - -} diff --git a/sflphone-common/src/audio/sound/audiofile.h b/sflphone-common/src/audio/sound/audiofile.h index cb96561ff2b6f3a748d830442ffa72de9cedfc64..019783defe16be7a76ecc16f97f02c3bc1eeec69 100644 --- a/sflphone-common/src/audio/sound/audiofile.h +++ b/sflphone-common/src/audio/sound/audiofile.h @@ -100,76 +100,5 @@ private: bool _start; }; +#endif - - -/** - * @file audiofile.h - * @brief A class to manage wave files - */ - -class WavFile : public AudioLoop -{ -public: - /** - * Constructor - */ - WavFile(); - - /** - * Destructor - */ - ~WavFile(); - - - /** - * Load a sound file in memory - * @param filename The absolute path to the file - * @param codec The codec to decode and encode it - * @param sampleRate The sample rate to read it - * @return bool True on success - */ - bool loadFile(const std::string& filename, AudioCodec *codec , unsigned int sampleRate = 44100); - - /** - * Start the sound file - */ - void start() { _start = true; } - - /** - * Stop the sound file - */ - void stop() { _start = false; } - - /** - * Tells whether or not the file is playing - * @return bool True if yes - * false otherwise - */ - bool isStarted() { return _start; } - -private: - // Copy Constructor - WavFile(const AudioFile& rh); - - // Assignment Operator - WavFile& operator=( const AudioFile& rh); - - bool isFileExist(const std::string& filename); - - /** The absolute path to the sound file */ - std::string _filename; - - /** Your preferred codec */ - AudioCodec* _codec; - - /** Start or not */ - bool _start; - - int _channels; - int _fileRate; - int _dataType; - int _fileSize; -}; - -#endif // __AUDIOFILE_H__ diff --git a/sflphone-common/src/audio/speexechocancel.cpp b/sflphone-common/src/audio/speexechocancel.cpp index fa5f1045ddfd0566d8ed36e018a9fcbf58f9df28..c956af0f9774cb253e8fcbc8954612cc3cfa72cc 100644 --- a/sflphone-common/src/audio/speexechocancel.cpp +++ b/sflphone-common/src/audio/speexechocancel.cpp @@ -100,7 +100,7 @@ void SpeexEchoCancel::putData(SFLDataFormat *inputData, int nbBytes) // speex_echo_playback(_echoState, inputData); } -void SpeexEchoCancel::process(SFLDataFormat *data, int nbBytes) {} +void SpeexEchoCancel::process(SFLDataFormat *data UNUSED, int nbBytes UNUSED) {} int SpeexEchoCancel::process(SFLDataFormat *inputData, SFLDataFormat *outputData, int nbBytes) { @@ -158,9 +158,6 @@ int SpeexEchoCancel::process(SFLDataFormat *inputData, SFLDataFormat *outputData return nbFrame * FRAME_SIZE; } -void SpeexEchoCancel::process(SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes){ - - - // speex_echo_cancellation(_echoState, micData, spkrData, outputData); +void SpeexEchoCancel::process(SFLDataFormat *micData UNUSED, SFLDataFormat *spkrData UNUSED, SFLDataFormat *outputData UNUSED, int nbBytes UNUSED){ } diff --git a/sflphone-common/src/config/yamlengine.cpp b/sflphone-common/src/config/yamlengine.cpp index 30a2545bfdea02643916d02cbbef5565196335fa..10022a189dcf817c5e6547b5eb9d519c5807a59c 100755 --- a/sflphone-common/src/config/yamlengine.cpp +++ b/sflphone-common/src/config/yamlengine.cpp @@ -41,7 +41,7 @@ YamlEngine::~YamlEngine() {} void YamlEngine::openConfigFile() { - Conf::YamlParser *parser; + Conf::YamlParser *parser = NULL; try { parser = new Conf::YamlParser("sequence.yml"); diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp index 415bda1f6eb01bdeafeb5a5a6a925ca2c51b1baa..6e2f09eaea1283f3112e50b31f7d5614d876a3a7 100644 --- a/sflphone-common/src/iax/iaxvoiplink.cpp +++ b/sflphone-common/src/iax/iaxvoiplink.cpp @@ -408,7 +408,7 @@ IAXVoIPLink::getIAXCall (const CallID& id) int -IAXVoIPLink::sendRegister (AccountID id) +IAXVoIPLink::sendRegister (AccountID id UNUSED) { IAXAccount *account; bool result; @@ -459,7 +459,7 @@ IAXVoIPLink::sendRegister (AccountID id) } int -IAXVoIPLink::sendUnregister (AccountID id) +IAXVoIPLink::sendUnregister (AccountID id UNUSED) { IAXAccount *account; diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 8652d731c291214d45b0ba62d9ee5b837b22b2e4..f946e4ed561d7c0123362e1b23ac00a38e6f5509 100755 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -3224,72 +3224,10 @@ std::string ManagerImpl::computeMd5HashFromCredential ( return hashedDigest; } -void ManagerImpl::setCredential (const std::string& accountID, - const int32_t& index, const std::map<std::string, std::string>& details) { +void ManagerImpl::setCredential (const std::string& accountID UNUSED, + const int32_t& index UNUSED, const std::map<std::string UNUSED, std::string>& details UNUSED) { _debug("Manager: set credential"); - /* - std::map<std::string, std::string>::iterator it; - std::map<std::string, std::string> credentialInformation = details; - - std::string credentialIndex; - std::stringstream streamOut; - streamOut << index; - credentialIndex = streamOut.str(); - - std::string section = "Credential" + std::string(":") + accountID - + std::string(":") + credentialIndex; - - _debug ("Setting credential in section %s", section.c_str()); - - it = credentialInformation.find(USERNAME); - std::string username; - - if (it == credentialInformation.end()) { - username = EMPTY_FIELD; - } else { - username = it->second; - } - - Manager::instance().setConfig(section, USERNAME, username); - - it = credentialInformation.find(REALM); - std::string realm; - - if (it == credentialInformation.end()) { - realm = EMPTY_FIELD; - } else { - realm = it->second; - } - - Manager::instance().setConfig(section, REALM, realm); - - it = credentialInformation.find(PASSWORD); - std::string password; - - if (it == credentialInformation.end()) { - password = EMPTY_FIELD; - } else { - password = it->second; - } - - if (getMd5CredentialHashing()) { - // TODO: Fix this. - // This is an extremly weak test in order to check - // if the password is a hashed value. This is done - // because deleteCredential() is called before this - // method. Therefore, we cannot check if the value - // is different from the one previously stored in - // the configuration file. This is to avoid to - // re-hash a hashed password. - - if (password.length() != 32) { - password = computeMd5HashFromCredential(username, password, realm); - } - } - - Manager::instance().setConfig(section, PASSWORD, password); - */ } // method to reduce the if/else mess. diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index 4a9bfb8b88a53b67b73de87cbd4024ba7e133263..6c30a0d5fd3abece237d4bb8d8932fa1698a0ff6 100755 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -36,10 +36,6 @@ #include <pwd.h> #include <sstream> -// CredentialItem::CredentialItem() {} - -// CredentialItem::~CredentialItem() {} - Credentials::Credentials() : credentialCount(0) {} Credentials::~Credentials() {} @@ -60,7 +56,7 @@ CredentialItem *Credentials::getCredential(int index) return NULL; } -void Credentials::serialize(Conf::YamlEmitter *emitter) +void Credentials::serialize(Conf::YamlEmitter *emitter UNUSED) { } diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index 45f8a1437efec7765417139b049765498c9ef301..c5df6f3465f60e779ff892ff66c77ab1fff0d520 100755 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -1594,7 +1594,7 @@ SIPVoIPLink::SIPCallReleased (SIPCall *call) void -SIPVoIPLink::SIPCallAnswered (SIPCall *call, pjsip_rx_data *rdata) +SIPVoIPLink::SIPCallAnswered (SIPCall *call, pjsip_rx_data *rdata UNUSED) { _info ("UserAgent: SIP call answered"); @@ -3021,27 +3021,9 @@ void set_voicemail_info (AccountID account, pjsip_msg_body *body) Manager::instance().startVoiceMessageNotification (account, voicemail); } -void SIPVoIPLink::handle_reinvite (SIPCall *call) +void SIPVoIPLink::handle_reinvite (SIPCall *call UNUSED) { - _debug ("UserAgent: Handle reinvite"); - /* - // Close the previous RTP session - call->getAudioRtp()->stop (); - call->setAudioStart (false); - - _debug ("Create new rtp session from handle_reinvite : %s:%i", call->getLocalIp().c_str(), call->getLocalAudioPort()); - _debug ("UserAgent: handle_reinvite"); - - try { - call->getAudioRtp()->initAudioRtpSession (call); - } catch (...) { - _debug ("! SIP Failure: Unable to create RTP Session (%s:%d)", __FILE__, __LINE__); - } - - - _debug("Handle reINVITE"); - */ } // This callback is called when the invite session state has changed @@ -3059,8 +3041,6 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e) _error ("UserAgent: Error: Call is NULL in call state changed callback"); return; } else { - // _debug(" call_on_state_changed: call id %s", call->getCallId().c_str()); - // _debug(" call_on_state_changed: call state %s", invitationStateMap[call->getInvSession()->state]); } //Retrieve the body message @@ -3364,11 +3344,11 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status) } -void call_on_forked (pjsip_inv_session *inv, pjsip_event *e) +void call_on_forked (pjsip_inv_session *inv UNUSED, pjsip_event *e UNUSED) { } -void call_on_tsx_changed (pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e) +void call_on_tsx_changed (pjsip_inv_session *inv UNUSED, pjsip_transaction *tsx, pjsip_event *e) { assert(tsx); @@ -4263,7 +4243,7 @@ void xfer_svr_cb (pjsip_evsub *sub, pjsip_event *event) } } -void on_rx_offer (pjsip_inv_session *inv, const pjmedia_sdp_session *offer) +void on_rx_offer (pjsip_inv_session *inv, const pjmedia_sdp_session *offer UNUSED) { _info("UserAgent: Received SDP offer"); @@ -4540,7 +4520,7 @@ std::vector<std::string> SIPVoIPLink::getAllIpInterfaceByName(void) } -pj_bool_t stun_sock_on_status (pj_stun_sock *stun_sock, pj_stun_sock_op op, pj_status_t status) +pj_bool_t stun_sock_on_status (pj_stun_sock *stun_sock UNUSED, pj_stun_sock_op op UNUSED, pj_status_t status) { if (status == PJ_SUCCESS) return PJ_TRUE; @@ -4548,7 +4528,7 @@ pj_bool_t stun_sock_on_status (pj_stun_sock *stun_sock, pj_stun_sock_op op, pj_s return PJ_FALSE; } -pj_bool_t stun_sock_on_rx_data (pj_stun_sock *stun_sock, void *pkt, unsigned pkt_len, const pj_sockaddr_t *src_addr, unsigned addr_len) +pj_bool_t stun_sock_on_rx_data (pj_stun_sock *stun_sock UNUSED, void *pkt UNUSED, unsigned pkt_len UNUSED, const pj_sockaddr_t *src_addr UNUSED, unsigned addr_len UNUSED) { return PJ_TRUE; }