Commit 9d226b80 authored by Alexandre Savard's avatar Alexandre Savard

[#5855] Make echo canceller optional

parent b2f1910f
......@@ -1067,6 +1067,7 @@ GtkWidget* create_audio_configuration()
g_signal_connect(G_OBJECT(enableEchoCancel), "clicked", active_echo_cancel, NULL);
gtk_table_attach(GTK_TABLE(table), enableEchoCancel, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
/*
gint value = dbus_get_echo_cancel_tail_length();
echoTailLength = gtk_hscale_new_with_range(100, 500, 5);
gtk_range_set_value(GTK_RANGE(echoTailLength), (gdouble)value);
......@@ -1078,6 +1079,7 @@ GtkWidget* create_audio_configuration()
gtk_range_set_value(GTK_RANGE(echoDelay), (gdouble)value);
gtk_table_attach(GTK_TABLE(table), echoDelay, 0, 1, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
g_signal_connect(G_OBJECT(echoDelay), "value-changed", G_CALLBACK(echo_delay_changed), NULL);
*/
gtk_widget_show_all (ret);
......
......@@ -54,7 +54,7 @@ AudioRtpRecord::AudioRtpRecord () : _audioCodec (NULL)
, _audioProcess (NULL)
, _noiseSuppress (NULL)
, _callId ("")
, _dtmfPayloadType(101) // same as Asterisk
, _dtmfPayloadType(101) // same as Asterisk
{
}
......@@ -123,7 +123,10 @@ AudioRtpRecord::~AudioRtpRecord()
}
AudioRtpRecordHandler::AudioRtpRecordHandler (SIPCall *ca) : _audioRtpRecord (), _ca (ca), echoCanceller(ca->getMemoryPool()) {}
AudioRtpRecordHandler::AudioRtpRecordHandler (SIPCall *ca) : _audioRtpRecord (), _ca (ca), echoCanceller(ca->getMemoryPool())
{
}
AudioRtpRecordHandler::~AudioRtpRecordHandler() {}
......
......@@ -14,34 +14,17 @@ EchoSuppress::EchoSuppress(pj_pool_t *pool)
{
pj_status_t status;
_debug("********************************************************************** Init echo suppress");
// pj_thread_register
pj_thread_desc aPJThreadDesc;
pj_thread_t *pjThread;
_debug("EchoCancel: Thread not yet registered to pjsip, registering");
status = pj_thread_register("EchoCanceller", aPJThreadDesc, &pjThread);
if (status != PJ_SUCCESS) {
_error("EchoCancel: Error: Could not register new thread");
}
// if (!pj_thread_is_registered()) {
// }
if (!pj_thread_is_registered()) {
_warn("EchoCancel: Thread not registered...");
}
// pj_thread_register();
// status = pj_init();
// if(status != PJ_SUCCESS) {
// _error("EchoCancel: Error: could not init pj");
// }
//
// pj_caching_pool_init(&echoCachingPool, &pj_pool_factory_default_policy, ECHO_CANCEL_MEM_SIZE);
// echoCancelPool = pj_pool_create_int(&echoCachingPool.factory, "EchoCancelPool", 1000, 1000, NULL);
echoCancelPool = pool;
status = pjmedia_echo_create(echoCancelPool, 8000, 160, 250, 0, PJMEDIA_ECHO_SIMPLE, &echoState);
......@@ -52,11 +35,6 @@ EchoSuppress::EchoSuppress(pj_pool_t *pool)
EchoSuppress::~EchoSuppress()
{
// pjmedia_echo_destroy(echoState);
// pj_pool_destroy(echoCancelPool);
//pj_caching_pool_destroy(&echoCachingPool);
}
void EchoSuppress::reset()
......@@ -66,25 +44,25 @@ void EchoSuppress::reset()
void EchoSuppress::putData (SFLDataFormat *inputData, int nbBytes)
{
pj_status_t status;
pj_status_t status;
status = pjmedia_echo_playback(echoState, reinterpret_cast<pj_int16_t *>(inputData));
status = pjmedia_echo_playback(echoState, reinterpret_cast<pj_int16_t *>(inputData));
if(status != PJ_SUCCESS) {
_warn("EchoCancel: Warning: Problem while putting input data");
}
if(status != PJ_SUCCESS) {
_warn("EchoCancel: Warning: Problem while putting input data");
}
}
int EchoSuppress::getData(SFLDataFormat *outputData)
{
pj_status_t status;
pj_status_t status;
status = pjmedia_echo_capture(echoState, reinterpret_cast<pj_int16_t *>(outputData), 0);
if(status != PJ_SUCCESS) {
_warn("EchoCancel: Warning: Problem while getting output data");
}
status = pjmedia_echo_capture(echoState, reinterpret_cast<pj_int16_t *>(outputData), 0);
if(status != PJ_SUCCESS) {
_warn("EchoCancel: Warning: Problem while getting output data");
}
return 0;
return 0;
}
void EchoSuppress::process (SFLDataFormat *data UNUSED, int nbBytes UNUSED) {}
......
......@@ -15,9 +15,9 @@
class EchoSuppress: public Algorithm {
public:
EchoSuppress(pj_pool_t *pool);
EchoSuppress(pj_pool_t *pool);
virtual ~EchoSuppress();
virtual ~EchoSuppress();
virtual void reset (void);
......
......@@ -484,11 +484,11 @@ AudioPreference::AudioPreference() : _cardin (atoi (ALSA_DFT_CARD)) // ALSA_DFT_
, _deviceRecord ("")
, _deviceRingtone ("")
, _recordpath ("") // DFT_RECORD_PATH
, _alwaysRecording(false)
, _alwaysRecording(false)
, _volumemic (atoi (DFT_VOL_SPKR_STR)) // DFT_VOL_SPKR_STR
, _volumespkr (atoi (DFT_VOL_MICRO_STR)) // DFT_VOL_MICRO_STR
, _noisereduce (true)
, _echocancel(false)
, _echocancel(false)
{
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment