mirror of
https://github.com/danog/libtgvoip.git
synced 2024-11-27 04:34:42 +01:00
b1a0b3d94a
- Nonblocking sockets - Better ShittyInternetMode - Fixed a bunch of bugs - Probably added some new bugs too
82 lines
2.1 KiB
C++
Executable File
82 lines
2.1 KiB
C++
Executable File
//
|
|
// 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
|
|
|
|
#include "threading.h"
|
|
#include "Buffers.h"
|
|
#include "BlockingQueue.h"
|
|
#include "MediaStreamItf.h"
|
|
#include "utils.h"
|
|
|
|
namespace tgvoip{
|
|
class EchoCanceller{
|
|
|
|
public:
|
|
TGVOIP_DISALLOW_COPY_AND_ASSIGN(EchoCanceller);
|
|
EchoCanceller(bool enableAEC, bool enableNS, bool enableAGC);
|
|
virtual ~EchoCanceller();
|
|
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);
|
|
void SetAECStrength(int strength);
|
|
|
|
private:
|
|
bool enableAEC;
|
|
bool enableAGC;
|
|
bool enableNS;
|
|
bool isOn;
|
|
#ifndef TGVOIP_NO_DSP
|
|
void RunBufferFarendThread();
|
|
bool didBufferFarend;
|
|
Mutex aecMutex;
|
|
void* aec;
|
|
void* splittingFilter; // webrtc::SplittingFilter
|
|
void* splittingFilterIn; // webrtc::IFChannelBuffer
|
|
void* splittingFilterOut; // webrtc::IFChannelBuffer
|
|
void* splittingFilterFarend; // webrtc::SplittingFilter
|
|
void* splittingFilterFarendIn; // webrtc::IFChannelBuffer
|
|
void* splittingFilterFarendOut; // webrtc::IFChannelBuffer
|
|
Thread* bufferFarendThread;
|
|
BlockingQueue<int16_t*>* farendQueue;
|
|
BufferPool* farendBufferPool;
|
|
bool running;
|
|
void* ns; // NsxHandle
|
|
void* agc;
|
|
int32_t agcMicLevel;
|
|
//int32_t outstandingFarendFrames=0;
|
|
#endif
|
|
};
|
|
|
|
class AudioEffect{
|
|
public:
|
|
virtual ~AudioEffect()=0;
|
|
virtual void Process(int16_t* inOut, size_t numSamples)=0;
|
|
virtual void SetPassThrough(bool passThrough);
|
|
protected:
|
|
bool passThrough;
|
|
};
|
|
|
|
class AutomaticGainControl : public AudioEffect{
|
|
public:
|
|
AutomaticGainControl();
|
|
virtual ~AutomaticGainControl();
|
|
virtual void Process(int16_t* inOut, size_t numSamples);
|
|
|
|
private:
|
|
void* agc;
|
|
void* splittingFilter;
|
|
void* splittingFilterIn;
|
|
void* splittingFilterOut;
|
|
int32_t agcMicLevel;
|
|
};
|
|
};
|
|
|
|
#endif //LIBTGVOIP_ECHOCANCELLER_H
|