Better echo cancel config!

This commit is contained in:
Quentin 2020-01-28 11:16:55 +01:00
parent c24f65cd43
commit 26d2d2f85c

View file

@ -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;
}