2014-05-22 44 views
0

我開發一個VoIP應用程序使用的GStreamer,我使用GStreamer中RTP示例創建的應用程序,我把客戶端,並在相同的代碼在服務器和每一個過程中,我做到了工作,但問題是回聲,所以我試圖實現speex aec,但問題是我只有麥克風的輸入,但我不能從揚聲器輸出。語音發送的聲學回聲消除GStreamer的

部分是

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的一部分嗎? 感謝

回答

0

你並不需要「從揚聲器輸出」,你需要被髮送到揚聲器的音頻。

+0

事實上,在Speex的回聲消除器,speex_echo_cancellation(echo_state,input_frame,echo_frame,output_frame); 所以我們需要麥克風和揚聲器中的回聲,以減少發送到麥克風的揚聲器信號! – user3618055

+0

AEC需要獲取兩個信號:1.您從麥克風捕捉到的內容(其中還包含回聲)2.您要發送給揚聲器以播放的內容。 – Jim

+0

所以第二個問題,因爲這兩個信號是在不同的過程中,我怎麼可以用gstreamer提取? – user3618055

0

上游GStreamer中包含回聲消除器。它將隨GStreamer 1.10一起發貨。它使用WebRTC項目中的DSP模塊,這比speex更好。我會推薦使用它。回聲迴路簡單使用:

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

請參閱http://ndufresne.ca/2016/06/gstreamer-echo-canceller/瞭解更多詳情。