【问题标题】:Acoustic Echo Cancellation in gstreamergstreamer 中的声学回声消除
【发布时间】:2014-05-22 14:57:58
【问题描述】:

我正在使用 gstreamer 开发 Voip 应用程序,我使用 gstreamer 中的 rtp 示例创建了应用程序,我将客户端和服务器放在相同的代码中,并且每个都在一个进程中,我让它工作但问题出在echo,所以我尝试实现 speex aec,但问题是我只有麦克风的输入,但我无法从扬声器获得输出。

语音发送部分是

 pipeline = gst_pipeline_new (NULL);
  g_assert (pipeline);

  /* the audio capture and format conversion */
  audiosrc = gst_element_factory_make (AUDIO_SRC, "audiosrc");
  g_assert (audiosrc);
  audioconv = gst_element_factory_make ("audioconvert", "audioconv");
  g_assert (audioconv);
  audiores = gst_element_factory_make ("audioresample", "audiores");
  g_assert (audiores);
  /* the encoding and payloading */
  audioenc = gst_element_factory_make (AUDIO_ENC, "audioenc");
  g_assert (audioenc);
  audiopay = gst_element_factory_make (AUDIO_PAY, "audiopay");
  g_assert (audiopay);

  /* add capture and payloading to the pipeline and link */
  gst_bin_add_many (GST_BIN (pipeline), audiosrc, audioconv, audiores,
      audioenc, audiopay, NULL);

  if (!gst_element_link_many (audiosrc, audioconv, audiores, audioenc,
          audiopay, NULL)) {
    g_error ("Failed to link audiosrc, audioconv, audioresample, "
        "audio encoder and audio payloader");
  }

以及接收语音的部分

    gst_bin_add_many (GST_BIN (pipeline), rtpsrc, rtcpsrc, rtcpsink, NULL);

  /* the depayloading and decoding */
  audiodepay = gst_element_factory_make (AUDIO_DEPAY, "audiodepay");
  g_assert (audiodepay);
  audiodec = gst_element_factory_make (AUDIO_DEC, "audiodec");
  g_assert (audiodec);
  /* the audio playback and format conversion */
  audioconv = gst_element_factory_make ("audioconvert", "audioconv");
  g_assert (audioconv);
  audiores = gst_element_factory_make ("audioresample", "audiores");
  g_assert (audiores);
  audiosink = gst_element_factory_make (AUDIO_SINK, "audiosink");
  g_assert (audiosink);

  /* add depayloading and playback to the pipeline and link */
  gst_bin_add_many (GST_BIN (pipeline), audiodepay, audiodec, audioconv,
      audiores, audiosink, NULL);

  res = gst_element_link_many (audiodepay, audiodec, audioconv, audiores,
      audiosink, NULL);
  g_assert (res == TRUE);

我可以使用 speex AEC 吗? 谢谢

【问题讨论】:

    标签: c linux gstreamer voip rtp


    【解决方案1】:

    现在上游 GStreamer 中包含回声消除器。它将随 GStreamer 1.10 一起提供。它使用 WebRTC 项目中的 DSP 模块,比 speex 好得多。我建议使用它。 echo 循环的简单用法:

    gst-launch-1.0 autoaudiosrc ! webrtcdsp ! webrtcechoprobe ! autoaudiosink
    

    更多详情请见http://ndufresne.ca/2016/06/gstreamer-echo-canceller/。

    【讨论】:

      【解决方案2】:

      您不需要“扬声器的输出”,您需要发送到扬声器的音频。

      【讨论】:

      • 其实在speex回声消除器中,speex_echo_cancellation(echo_state, input_frame, echo_frame, output_frame);所以我们需要一个来自麦克风的回声和一个来自扬声器的回声,从发送到麦克风的信号中减去扬声器信号!
      • AEC 需要获得两个信号:1. 您从麦克风捕获的内容(当然也包含回声) 2. 您发送到扬声器以便播放的内容。跨度>
      • 那么第二个的问题,因为这两个信号在不同的过程中,我如何用gstreamer提取?
      猜你喜欢
      • 2016-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多