1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-12-02 09:37:52 +01:00
libtgvoip/EchoCanceller.h

64 lines
1.6 KiB
C
Raw Normal View History

2017-02-02 17:24:40 +01:00
//
// libtgvoip is free and unencumbered public domain software.
// For more information, see http://unlicense.org or the UNLICENSE file
// you should have received with this source code distribution.
//
#ifndef LIBTGVOIP_ECHOCANCELLER_H
#define LIBTGVOIP_ECHOCANCELLER_H
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif
2017-03-30 16:06:59 +02:00
/*#if TARGET_OS_IPHONE
2017-02-02 17:24:40 +01:00
#define TGVOIP_NO_AEC
2017-03-30 16:06:59 +02:00
#endif*/
2017-02-02 17:24:40 +01:00
#include "threading.h"
#include "BufferPool.h"
#include "BlockingQueue.h"
#ifndef TGVOIP_NO_AEC
#include "external/include/webrtc/echo_control_mobile.h"
//#include "external/include/webrtc/echo_cancellation.h"
#include "external/include/webrtc/splitting_filter_wrapper.h"
#include "external/include/webrtc/noise_suppression_x.h"
2017-03-30 16:06:59 +02:00
#include "external/include/webrtc/gain_control.h"
2017-02-02 17:24:40 +01:00
#endif
class CEchoCanceller{
public:
2017-03-30 16:06:59 +02:00
CEchoCanceller(bool enableAEC, bool enableNS, bool enableAGC);
2017-02-02 17:24:40 +01:00
virtual ~CEchoCanceller();
virtual void Start();
virtual void Stop();
void SpeakerOutCallback(unsigned char* data, size_t len);
void Enable(bool enabled);
void ProcessInput(unsigned char* data, unsigned char* out, size_t len);
private:
2017-03-30 16:06:59 +02:00
bool enableAEC;
bool enableAGC;
bool enableNS;
2017-02-02 17:24:40 +01:00
#ifndef TGVOIP_NO_AEC
static void* StartBufferFarendThread(void* arg);
void RunBufferFarendThread();
bool didBufferFarend;
2017-03-30 16:06:59 +02:00
tgvoip_mutex_t aecMutex;
void* aec;
tgvoip_splitting_filter_t* splittingFilter;
tgvoip_splitting_filter_t* splittingFilterFarend;
2017-02-02 17:24:40 +01:00
tgvoip_thread_t bufferFarendThread;
CBlockingQueue* farendQueue;
CBufferPool* farendBufferPool;
bool running;
NsxHandle* ns;
2017-03-30 16:06:59 +02:00
void* agc;
int32_t agcMicLevel;
2017-02-02 17:24:40 +01:00
#endif
};
#endif //LIBTGVOIP_ECHOCANCELLER_H