Commit e976366c authored by Tristan Matthews's avatar Tristan Matthews

* #7842: fixed Weffc++ warnings/uninitialized variables

parent ce437dc3
...@@ -178,7 +178,7 @@ DBUS_CPP_REQUIRED_VERSION=0.6.0-pre1 ...@@ -178,7 +178,7 @@ DBUS_CPP_REQUIRED_VERSION=0.6.0-pre1
PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,, PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,,
AC_MSG_ERROR([You need the DBus-c++ libraries (version $DBUS_CPP_REQUIRED_VERSION or better)])) AC_MSG_ERROR([You need the DBus-c++ libraries (version $DBUS_CPP_REQUIRED_VERSION or better)]))
CXXFLAGS="${CXXFLAGS} -g -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor -Wfatal-errors" CXXFLAGS="${CXXFLAGS} -g -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor -Weffc++ -Wfatal-errors"
AC_CHECK_LIB([expat], XML_ParserCreate_MM, AC_CHECK_LIB([expat], XML_ParserCreate_MM,
[AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)], [AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)],
......
...@@ -35,16 +35,20 @@ ...@@ -35,16 +35,20 @@
Account::Account(const std::string& accountID, const std::string &type) : Account::Account(const std::string& accountID, const std::string &type) :
accountID_(accountID) accountID_(accountID)
, username_()
, hostname_()
, alias_()
, link_(NULL) , link_(NULL)
, enabled_(true) , enabled_(true)
, type_(type) , type_(type)
, registrationState_(Unregistered) , registrationState_(Unregistered)
, codecOrder_() , codecOrder_()
, codecStr_("") , codecStr_()
, ringtonePath_("/usr/share/sflphone/ringtones/konga.ul") , ringtonePath_("/usr/share/sflphone/ringtones/konga.ul")
, ringtoneEnabled_(true) , ringtoneEnabled_(true)
, displayName_("") , displayName_("")
, userAgent_("SFLphone") , userAgent_("SFLphone")
, mailBox_()
{ {
// Initialize the codec order, used when creating a new account // Initialize the codec order, used when creating a new account
loadDefaultCodecs(); loadDefaultCodecs();
......
...@@ -39,6 +39,7 @@ AudioLayer::AudioLayer() ...@@ -39,6 +39,7 @@ AudioLayer::AudioLayer()
, urgentRingBuffer_(SIZEBUF, Call::DEFAULT_ID) , urgentRingBuffer_(SIZEBUF, Call::DEFAULT_ID)
, audioSampleRate_(Manager::instance().getMainBuffer()->getInternalSamplingRate()) , audioSampleRate_(Manager::instance().getMainBuffer()->getInternalSamplingRate())
, mutex_() , mutex_()
, dcblocker_()
, audioPref(Manager::instance().audioPreference) , audioPref(Manager::instance().audioPreference)
, converter_(new SamplerateConverter(audioSampleRate_)) , converter_(new SamplerateConverter(audioSampleRate_))
, lastNotificationTime_(0) , lastNotificationTime_(0)
......
...@@ -133,11 +133,8 @@ class AudioLayer { ...@@ -133,11 +133,8 @@ class AudioLayer {
* Lock for the entire audio layer * Lock for the entire audio layer
*/ */
ost::Mutex mutex_; ost::Mutex mutex_;
DcBlocker dcblocker_; DcBlocker dcblocker_;
AudioPreference &audioPref; AudioPreference &audioPref;
SamplerateConverter *converter_; SamplerateConverter *converter_;
private: private:
......
...@@ -52,6 +52,7 @@ struct wavhdr { ...@@ -52,6 +52,7 @@ struct wavhdr {
AudioRecord::AudioRecord() : fileHandle_(NULL) AudioRecord::AudioRecord() : fileHandle_(NULL)
, fileType_(FILE_INVALID)
, channels_(1) , channels_(1)
, byteCounter_(0) , byteCounter_(0)
, sndSmplRate_(8000) , sndSmplRate_(8000)
...@@ -62,6 +63,7 @@ AudioRecord::AudioRecord() : fileHandle_(NULL) ...@@ -62,6 +63,7 @@ AudioRecord::AudioRecord() : fileHandle_(NULL)
, mixBuffer_(new SFLDataFormat[nbSamplesMax_]) , mixBuffer_(new SFLDataFormat[nbSamplesMax_])
, micBuffer_(new SFLDataFormat[nbSamplesMax_]) , micBuffer_(new SFLDataFormat[nbSamplesMax_])
, spkBuffer_(new SFLDataFormat[nbSamplesMax_]) , spkBuffer_(new SFLDataFormat[nbSamplesMax_])
, savePath_()
{ {
createFilename(); createFilename();
} }
......
...@@ -35,11 +35,12 @@ ...@@ -35,11 +35,12 @@
#include <cstdlib> #include <cstdlib>
#include "global.h" #include "global.h"
#include "noncopyable.h"
class AudioRecord { class AudioRecord {
public: public:
enum FILE_TYPE { FILE_RAW, FILE_WAV }; enum FILE_TYPE { FILE_RAW, FILE_WAV, FILE_INVALID };
AudioRecord(); AudioRecord();
...@@ -237,6 +238,8 @@ class AudioRecord { ...@@ -237,6 +238,8 @@ class AudioRecord {
*/ */
std::string savePath_; std::string savePath_;
private:
NON_COPYABLE(AudioRecord);
}; };
#endif // _AUDIO_RECORD_H #endif // _AUDIO_RECORD_H
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
int AudioRecorder::count_ = 0; int AudioRecorder::count_ = 0;
AudioRecorder::AudioRecorder(AudioRecord *arec, MainBuffer *mb) : Thread(), mbuffer_(mb), arecord_(arec) AudioRecorder::AudioRecorder(AudioRecord *arec, MainBuffer *mb) : Thread(),
recorderId_(), mbuffer_(mb), arecord_(arec)
{ {
assert(mb); assert(mb);
setCancel(cancelDeferred); setCancel(cancelDeferred);
......
...@@ -42,7 +42,10 @@ ...@@ -42,7 +42,10 @@
namespace sfl { namespace sfl {
AudioRtpFactory::AudioRtpFactory(SIPCall *ca) : rtpSession_(NULL), remoteContext_(NULL), localContext_(NULL), ca_(ca) AudioRtpFactory::AudioRtpFactory(SIPCall *ca) : rtpSession_(NULL),
audioRtpThreadMutex_(), srtpEnabled_(false),
keyExchangeProtocol_(Symmetric), helloHashEnabled_(false),
remoteContext_(NULL), localContext_(NULL), ca_(ca)
{} {}
AudioRtpFactory::~AudioRtpFactory() AudioRtpFactory::~AudioRtpFactory()
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <cc++/thread.h> #include <cc++/thread.h>
#include <ccrtp/CryptoContext.h> #include <ccrtp/CryptoContext.h>
#include "audio_rtp_session.h" #include "audio_rtp_session.h"
#include "noncopyable.h"
#include "sip/sdes_negotiator.h" #include "sip/sdes_negotiator.h"
...@@ -138,6 +139,7 @@ class AudioRtpFactory { ...@@ -138,6 +139,7 @@ class AudioRtpFactory {
void sendDtmfDigit(int digit); void sendDtmfDigit(int digit);
private: private:
NON_COPYABLE(AudioRtpFactory);
AudioRtpSession *rtpSession_; AudioRtpSession *rtpSession_;
ost::Mutex audioRtpThreadMutex_; ost::Mutex audioRtpThreadMutex_;
......
...@@ -47,8 +47,10 @@ AudioRtpRecord::AudioRtpRecord() : ...@@ -47,8 +47,10 @@ AudioRtpRecord::AudioRtpRecord() :
, codecSampleRate_(0) , codecSampleRate_(0)
, codecFrameSize_(0) , codecFrameSize_(0)
, converterSamplingRate_(0) , converterSamplingRate_(0)
, dtmfQueue_()
, micAmplFactor_(initFadeinFactor) , micAmplFactor_(initFadeinFactor)
, noiseSuppress_(0) , noiseSuppress_(0)
, audioProcessMutex_()
, callId_("") , callId_("")
, dtmfPayloadType_(101) // same as Asterisk , dtmfPayloadType_(101) // same as Asterisk
{ {
......
...@@ -169,18 +169,14 @@ class AudioRtpRecordHandler { ...@@ -169,18 +169,14 @@ class AudioRtpRecordHandler {
void putDtmfEvent(int digit); void putDtmfEvent(int digit);
protected: protected:
AudioRtpRecord audioRtpRecord_; AudioRtpRecord audioRtpRecord_;
private: private:
const std::string id_; const std::string id_;
EchoSuppress echoCanceller; EchoSuppress echoCanceller;
GainControl gainController; GainControl gainController;
}; };
} }
#endif // AUDIO_RTP_RECORD_HANDLER_H__ #endif // AUDIO_RTP_RECORD_HANDLER_H__
...@@ -47,6 +47,8 @@ AudioRtpSession::AudioRtpSession(SIPCall * sipcall, RtpMethod type, ost::RTPData ...@@ -47,6 +47,8 @@ AudioRtpSession::AudioRtpSession(SIPCall * sipcall, RtpMethod type, ost::RTPData
AudioRtpRecordHandler(sipcall) AudioRtpRecordHandler(sipcall)
, ca_(sipcall) , ca_(sipcall)
, type_(type) , type_(type)
, remote_ip_()
, remote_port_(0)
, timestamp_(0) , timestamp_(0)
, timestampIncrement_(0) , timestampIncrement_(0)
, timestampCount_(0) , timestampCount_(0)
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <audio/codecs/audiocodec.h> #include <audio/codecs/audiocodec.h>
#include <ccrtp/rtp.h> #include <ccrtp/rtp.h>
#include <ccrtp/formats.h> #include <ccrtp/formats.h>
#include "noncopyable.h"
class SIPCall; class SIPCall;
...@@ -96,6 +97,7 @@ class AudioRtpSession : public AudioRtpRecordHandler { ...@@ -96,6 +97,7 @@ class AudioRtpSession : public AudioRtpRecordHandler {
RtpMethod type_; RtpMethod type_;
private: private:
NON_COPYABLE(AudioRtpSession);
/** /**
* Set the audio codec for this RTP session * Set the audio codec for this RTP session
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "audio_rtp_session.h" #include "audio_rtp_session.h"
#include "audio_symmetric_rtp_session.h" #include "audio_symmetric_rtp_session.h"
#include "sip/sdes_negotiator.h" #include "sip/sdes_negotiator.h"
#include "noncopyable.h"
#include <ccrtp/CryptoContext.h> #include <ccrtp/CryptoContext.h>
#include <vector> #include <vector>
...@@ -109,6 +110,7 @@ class AudioSrtpSession : public AudioSymmetricRtpSession { ...@@ -109,6 +110,7 @@ class AudioSrtpSession : public AudioSymmetricRtpSession {
ost::CryptoContext* localCryptoCtx_; ost::CryptoContext* localCryptoCtx_;
private: private:
NON_COPYABLE(AudioSrtpSession);
/** /**
* Init local master key according to current crypto context * Init local master key according to current crypto context
......
...@@ -44,6 +44,7 @@ namespace sfl { ...@@ -44,6 +44,7 @@ namespace sfl {
AudioSymmetricRtpSession::AudioSymmetricRtpSession(SIPCall * sipcall) : AudioSymmetricRtpSession::AudioSymmetricRtpSession(SIPCall * sipcall) :
ost::SymmetricRTPSession(ost::InetHostAddress(sipcall->getLocalIp().c_str()), sipcall->getLocalAudioPort()) ost::SymmetricRTPSession(ost::InetHostAddress(sipcall->getLocalIp().c_str()), sipcall->getLocalAudioPort())
, AudioRtpSession(sipcall, Symmetric, this, this) , AudioRtpSession(sipcall, Symmetric, this, this)
, echoCanceller()
, rtpThread_(new AudioRtpThread(this)) , rtpThread_(new AudioRtpThread(this))
{ {
INFO("AudioSymmetricRtpSession: Setting new RTP session with destination %s:%d", ca_->getLocalIp().c_str(), ca_->getLocalAudioPort()); INFO("AudioSymmetricRtpSession: Setting new RTP session with destination %s:%d", ca_->getLocalIp().c_str(), ca_->getLocalAudioPort());
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "noncopyable.h" #include "noncopyable.h"
using std::ptrdiff_t; using std::ptrdiff_t;
#include <ccrtp/rtp.h> #include <ccrtp/rtp.h>
#include <ccrtp/iqueue.h> #include <ccrtp/iqueue.h>
#include <cc++/numbers.h> // ost::Time #include <cc++/numbers.h> // ost::Time
...@@ -70,6 +71,7 @@ class AudioSymmetricRtpSession : public ost::TimerPort, public ost::SymmetricRTP ...@@ -70,6 +71,7 @@ class AudioSymmetricRtpSession : public ost::TimerPort, public ost::SymmetricRTP
} }
private: private:
NON_COPYABLE(AudioSymmetricRtpSession);
class AudioRtpThread : public ost::Thread, public ost::TimerPort { class AudioRtpThread : public ost::Thread, public ost::TimerPort {
public: public:
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
* as that of the covered work. * as that of the covered work.
*/ */
#include "zrtp_session_callback.h" #include "zrtp_session_callback.h"
#include "global.h" #include "global.h"
#include "sip/sipcall.h" #include "sip/sipcall.h"
#include "dbus/dbusmanager.h" #include "dbus/dbusmanager.h"
......
...@@ -39,6 +39,7 @@ using std::ptrdiff_t; ...@@ -39,6 +39,7 @@ using std::ptrdiff_t;
#include <libzrtpcpp/ZrtpUserCallback.h> #include <libzrtpcpp/ZrtpUserCallback.h>
#include <exception> #include <exception>
#include <map> #include <map>
#include "noncopyable.h"
class SIPCall; class SIPCall;
...@@ -57,6 +58,7 @@ class ZrtpSessionCallback: public ZrtpUserCallback { ...@@ -57,6 +58,7 @@ class ZrtpSessionCallback: public ZrtpUserCallback {
void confirmGoClear(); void confirmGoClear();
private: private:
NON_COPYABLE(ZrtpSessionCallback);
SIPCall* sipcall_; SIPCall* sipcall_;
static std::map<int32, std::string> infoMap_; static std::map<int32, std::string> infoMap_;
static std::map<int32, std::string> warningMap_; static std::map<int32, std::string> warningMap_;
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#define __AUDIO_CODEC_H__ #define __AUDIO_CODEC_H__
#include <string> #include <string>
#include <iostream>
#include <dlfcn.h> #include <dlfcn.h>
#include "codec.h" #include "codec.h"
...@@ -161,6 +160,7 @@ class AudioCodec : public Codec { ...@@ -161,6 +160,7 @@ class AudioCodec : public Codec {
bool hasDynamicPayload_; bool hasDynamicPayload_;
private: private:
AudioCodec& operator=(const AudioCodec&);
uint8 payload_; uint8 payload_;
ost::DynamicPayloadFormat* payloadFormat_; ost::DynamicPayloadFormat* payloadFormat_;
......
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
#include <algorithm> // for std::find #include <algorithm> // for std::find
#include "fileutils.h" #include "fileutils.h"
AudioCodecFactory::AudioCodecFactory() : codecsMap_() AudioCodecFactory::AudioCodecFactory() :
codecsMap_(), defaultCodecOrder_(), libCache_(), codecInMemory_()
{ {
typedef std::vector<sfl::Codec*> CodecVector; typedef std::vector<sfl::Codec*> CodecVector;
CodecVector codecDynamicList(scanCodecDirectory()); CodecVector codecDynamicList(scanCodecDirectory());
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
class Celt : public sfl::AudioCodec { class Celt : public sfl::AudioCodec {
public: public:
Celt(int payload = 115) : sfl::AudioCodec(payload, "celt") { Celt(int payload = 115) : sfl::AudioCodec(payload, "celt"), mode_(0), enc_(0), dec_(0) {
clockRate_ = 32000; clockRate_ = 32000;
frameSize_ = 320; // fixed frameSize, TODO: support variable size from 64 to 512 frameSize_ = 320; // fixed frameSize, TODO: support variable size from 64 to 512
channel_ = 1; channel_ = 1;
...@@ -119,14 +119,10 @@ class Celt : public sfl::AudioCodec { ...@@ -119,14 +119,10 @@ class Celt : public sfl::AudioCodec {
} }
private: private:
CELTMode *mode_; CELTMode *mode_;
CELTEncoder *enc_; CELTEncoder *enc_;
CELTDecoder *dec_; CELTDecoder *dec_;
celt_int32 celt_frame_size_;
celt_int32 skip_;
}; };
// the class factories // the class factories
......
...@@ -36,34 +36,26 @@ ...@@ -36,34 +36,26 @@
#include "../common.h" #include "../common.h"
#include "audiocodec.h" #include "audiocodec.h"
#include "g722.h" #include "g722.h"
#include "noncopyable.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <cassert> #include <cassert>
#define TRUE 1
#define FALSE 0
class G722 : public sfl::AudioCodec { class G722 : public sfl::AudioCodec {
public: public:
G722(int payload=9) : sfl::AudioCodec(payload, "G722"),
G722(int payload=9) decode_s(new g722_decode_state_t),
: sfl::AudioCodec(payload, "G722") { encode_s(new g722_encode_state_t) {
clockRate_ = 16000; clockRate_ = 16000;
frameSize_ = 320; // samples, 20 ms at 16kHz frameSize_ = 320; // samples, 20 ms at 16kHz
channel_ = 1; channel_ = 1;
bitrate_ = 64; bitrate_ = 64;
hasDynamicPayload_ = false; hasDynamicPayload_ = false;
decode_s = new g722_decode_state_t;
encode_s = new g722_encode_state_t;
g722_decode_init(); g722_decode_init();
g722_encode_init(); g722_encode_init();
} }
~G722() { ~G722() {
...@@ -84,17 +76,16 @@ class G722 : public sfl::AudioCodec { ...@@ -84,17 +76,16 @@ class G722 : public sfl::AudioCodec {
void g722_encode_init() { void g722_encode_init() {
encode_s->itu_test_mode = FALSE; encode_s->itu_test_mode = false;
// 8 => 64 kbps; 7 => 56 kbps; 6 => 48 kbps // 8 => 64 kbps; 7 => 56 kbps; 6 => 48 kbps
encode_s->bits_per_sample = 8; encode_s->bits_per_sample = 8;
// Enable 8khz mode, encode using lower subband only // Enable 8khz mode, encode using lower subband only
encode_s->eight_k = FALSE; encode_s->eight_k = false;
// Never set packed true when using 64 kbps
// Never set packed TRUE when using 64 kbps encode_s->packed = false;
encode_s->packed = FALSE;
memset(encode_s->band, 0, sizeof(decode_s->band)); memset(encode_s->band, 0, sizeof(decode_s->band));
encode_s->band[0].det = 32; encode_s->band[0].det = 32;
...@@ -110,16 +101,16 @@ class G722 : public sfl::AudioCodec { ...@@ -110,16 +101,16 @@ class G722 : public sfl::AudioCodec {
void g722_decode_init() { void g722_decode_init() {
decode_s->itu_test_mode = FALSE; decode_s->itu_test_mode = false;
// 8 => 64 kbps; 7 => 56 kbps; 6 => 48 kbps // 8 => 64 kbps; 7 => 56 kbps; 6 => 48 kbps
decode_s->bits_per_sample = 8; decode_s->bits_per_sample = 8;
// Enable 8khz mode, encode using lower subband only // Enable 8khz mode, encode using lower subband only
decode_s->eight_k = FALSE; decode_s->eight_k = false;
// Never set packed TRUE when using 64 kbps // Never set packed true when using 64 kbps
decode_s->packed = FALSE; decode_s->packed = false;
memset(decode_s->band, 0, sizeof(decode_s->band)); memset(decode_s->band, 0, sizeof(decode_s->band));
decode_s->band[0].det = 32; decode_s->band[0].det = 32;
...@@ -811,6 +802,7 @@ class G722 : public sfl::AudioCodec { ...@@ -811,6 +802,7 @@ class G722 : public sfl::AudioCodec {
} }
private: private:
NON_COPYABLE(G722);
g722_decode_state_t *decode_s; g722_decode_state_t *decode_s;
g722_encode_state_t *encode_s; g722_encode_state_t *encode_s;
...@@ -828,4 +820,3 @@ extern "C" void destroy(sfl::Codec* a) ...@@ -828,4 +820,3 @@ extern "C" void destroy(sfl::Codec* a)
delete a; delete a;
} }
...@@ -65,29 +65,32 @@ const SpeexMode* speexMode[3] = { ...@@ -65,29 +65,32 @@ const SpeexMode* speexMode[3] = {
class Speex : public sfl::AudioCodec { class Speex : public sfl::AudioCodec {
public: public:
Speex(int payload) : sfl::AudioCodec(payload, "speex") { Speex(int payload) :
assert(payload >= 110 && payload <= 112); sfl::AudioCodec(payload, "speex"), speex_dec_bits_(),
assert(110 == PAYLOAD_CODEC_SPEEX_8000 && speex_enc_bits_(), speex_dec_state_(0), speex_enc_state_(0),
111 == PAYLOAD_CODEC_SPEEX_16000 && speex_frame_size_(0) {
112 == PAYLOAD_CODEC_SPEEX_32000); assert(payload >= 110 && payload <= 112);
int type = payload - 110; assert(110 == PAYLOAD_CODEC_SPEEX_8000 &&
111 == PAYLOAD_CODEC_SPEEX_16000 &&
112 == PAYLOAD_CODEC_SPEEX_32000);
int type = payload - 110;
clockRate_ = clockRate[type]; clockRate_ = clockRate[type];
frameSize_ = frameSize[type]; frameSize_ = frameSize[type];
channel_ = 1; channel_ = 1;
bitrate_ = bitRate[type]; bitrate_ = bitRate[type];
hasDynamicPayload_ = dynamicPayload[type]; hasDynamicPayload_ = dynamicPayload[type];
// Init the decoder struct // Init the decoder struct
speex_bits_init(&speex_dec_bits_); speex_bits_init(&speex_dec_bits_);
speex_dec_state_ = speex_decoder_init(speexMode[type]); speex_dec_state_ = speex_decoder_init(speexMode[type]);
// Init the encoder struct // Init the encoder struct
speex_bits_init(&speex_enc_bits_); speex_bits_init(&speex_enc_bits_);
speex_enc_state_ = speex_encoder_init(speexMode[type]); speex_enc_state_ = speex_encoder_init(speexMode[type]);
speex_encoder_ctl(speex_enc_state_, SPEEX_SET_SAMPLING_RATE, &clockRate_); speex_encoder_ctl(speex_enc_state_, SPEEX_SET_SAMPLING_RATE, &clockRate_);
speex_decoder_ctl(speex_dec_state_, SPEEX_GET_FRAME_SIZE, &speex_frame_size_); speex_decoder_ctl(speex_dec_state_, SPEEX_GET_FRAME_SIZE, &speex_frame_size_);
} }
NON_COPYABLE(Speex); NON_COPYABLE(Speex);
...@@ -117,8 +120,8 @@ class Speex : public sfl::AudioCodec { ...@@ -117,8 +120,8 @@ class Speex : public sfl::AudioCodec {
} }
private: private:
SpeexBits speex_dec_bits_; SpeexBits speex_dec_bits_;
SpeexBits speex_enc_bits_; SpeexBits speex_enc_bits_;
void *speex_dec_state_; void *speex_dec_state_;
void *speex_enc_state_; void *speex_enc_state_;
int speex_frame_size_; int speex_frame_size_;
......
...@@ -97,11 +97,15 @@ void FirFilter::reset() ...@@ -97,11 +97,15 @@ void FirFilter::reset()
} }
DelayDetection::DelayDetection() : internalState_(WaitForSpeaker), decimationFilter_(ird), bandpassFilter_(irb), segmentSize_(DELAY_BUFF_SIZE), downsamplingFactor_(8) DelayDetection::DelayDetection() :
internalState_(WaitForSpeaker), decimationFilter_(ird),
bandpassFilter_(irb), segmentSize_(DELAY_BUFF_SIZE),
downsamplingFactor_(8),
spkrDownSize_(DELAY_BUFF_SIZE / downsamplingFactor_),
micDownSize_(WINDOW_SIZE / downsamplingFactor_),
nbMicSampleStored_(0),
nbSpkrSampleStored_(0)
{ {
micDownSize_ = WINDOW_SIZE / downsamplingFactor_;
spkrDownSize_ = DELAY_BUFF_SIZE / downsamplingFactor_;
memset(spkrReference_, 0, sizeof(float) *WINDOW_SIZE*2);