From 26d2d2f85c7f588d11f95f9b66ad54fc9771f84f Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 28 Jan 2020 11:16:55 +0100 Subject: [PATCH] Better echo cancel config! --- src/dcall.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/dcall.c b/src/dcall.c index d95d0d4..f261701 100644 --- a/src/dcall.c +++ b/src/dcall.c @@ -17,7 +17,7 @@ int create_rx_chain(GstElement *pipeline) { } g_object_set(G_OBJECT (rx_tap), "port", 5000, NULL); - g_object_set(G_OBJECT (rx_tap), "address", "127.0.0.1", NULL); + //g_object_set(G_OBJECT (rx_tap), "address", "127.0.0.1", NULL); g_object_set(G_OBJECT (rx_tap), "caps", gst_caps_new_simple("application/x-rtp", "media", G_TYPE_STRING, "audio", NULL), NULL); g_object_set(G_OBJECT (rx_jitterbuffer), "do-lost", TRUE, NULL); @@ -34,16 +34,17 @@ int create_rx_chain(GstElement *pipeline) { } int create_tx_chain(GstElement *pipeline, char* remote_host) { - GstElement *tx_tap, *tx_echocancel, *tx_resample, *tx_opusenc, *tx_pay, *tx_sink; + GstElement *tx_tap, *tx_echocancel, *tx_queue, *tx_resample, *tx_opusenc, *tx_pay, *tx_sink; tx_tap = gst_element_factory_make("autoaudiosrc", "tx-tap"); tx_echocancel = gst_element_factory_make("webrtcdsp", "tx-echocancel"); + //tx_queue = gst_element_factory_make("queue", "tx-queue"); tx_resample = gst_element_factory_make("audioresample", "tx-resample"); tx_opusenc = gst_element_factory_make("opusenc", "tx-opusenc"); tx_pay = gst_element_factory_make("rtpopuspay", "tx-rtpopuspay"); tx_sink = gst_element_factory_make("udpsink", "tx-sink"); - if (!tx_tap || !tx_echocancel || !tx_resample || !tx_opusenc || !tx_pay || !tx_sink) { + if (!tx_tap || !tx_echocancel || /*!tx_queue ||*/ !tx_resample || !tx_opusenc || !tx_pay || !tx_sink) { g_printerr("One element of the tx chain could not be created. Exiting.\n"); return -1; } @@ -58,8 +59,17 @@ int create_tx_chain(GstElement *pipeline, char* remote_host) { g_object_set(G_OBJECT(tx_sink), "port", 5000, NULL); g_object_set(G_OBJECT(tx_sink), "async", FALSE, NULL); - gst_bin_add_many(GST_BIN(pipeline), tx_tap, tx_echocancel, tx_resample, tx_opusenc, tx_pay, tx_sink, NULL); - gst_element_link_many(tx_tap, tx_echocancel, tx_resample, tx_opusenc, tx_pay, tx_sink, NULL); + g_object_set(G_OBJECT(tx_echocancel), "echo-cancel", TRUE, NULL); + g_object_set(G_OBJECT(tx_echocancel), "extended-filter", TRUE, NULL); + g_object_set(G_OBJECT(tx_echocancel), "gain-control", TRUE, NULL); + g_object_set(G_OBJECT(tx_echocancel), "high-pass-filter", TRUE, NULL); + g_object_set(G_OBJECT(tx_echocancel), "limiter", FALSE, NULL); + g_object_set(G_OBJECT(tx_echocancel), "noise-suppression", TRUE, NULL); + g_object_set(G_OBJECT(tx_echocancel), "probe", "rx-echocancel", NULL); + g_object_set(G_OBJECT(tx_echocancel), "voice-detection", FALSE, NULL); + + gst_bin_add_many(GST_BIN(pipeline), tx_tap, tx_echocancel, /*tx_queue,*/ tx_resample, tx_opusenc, tx_pay, tx_sink, NULL); + gst_element_link_many(tx_tap, tx_echocancel, /*tx_queue,*/ tx_resample, tx_opusenc, tx_pay, tx_sink, NULL); return 0; }