gstreamer gstrtpbin发送器/接收器在同一个管道中

时间:2013-01-08 21:05:39

标签: gstreamer rtp

我希望构建一个同时执行rtp音频发送和接收的gstreamer管道。

基于我发现的示例(很少),这是我几乎正在使用的代码。

(该程序是用Rexx编写的,但我觉得很明显发生了什么。在这里,它看起来很像bash!)。行catenation char是逗号。 “”,只是插入空行以便于阅读。

rtp_recv_port = 8554
rtp_send_port = 8555

 pipeline =  "gst-launch -e",
         "",
            "gstrtpbin",
            "   name=rtpbin",
         "",
            "udpsrc   port="rtp_recv_port,     -- do-timestamp=true
            '  ! "application/x-rtp,media=audio,payload=8,clock-rate=8000,encoding-name=PCMA,channels=1" ',
            "  ! rtpbin.recv_rtp_sink_0",
         "",
            "rtpbin. ",
            "  ! rtppcmadepay",
            "  ! decodebin         ",
            '  ! "audio/x-raw-int, width=16, depth=16, rate=8000, channels=1" ',
            "  ! volume volume=5.0 ",
            "  ! autoaudiosink sync=false",
         "",
            "autoaudiosrc          ",
            "  ! audioconvert      ",
            '  ! "audio/x-raw-int,width=16,depth=16,rate=8000,channels=1" ',
            "  ! alawenc           ",
            "  ! rtppcmapay perfect-rtptime=true mtu=2000",
            "  ! rtpbin.send_rtp_sink_1",
         "",
            "rtpbin.send_rtp_src_1 ",
            "  ! audioconvert",
            "  ! audioresample",
            "  ! udpsink port="rtp_send_port "host="ipaddr

pipeline "> pipe.out"

如果我在

之后注释掉这些行
"  ! autoaudiosink sync=false",

仅接收部分工作得很好。但是,如果我将这些线留在原位,我会收到此错误:

ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2582): gst_base_src_loop (): /GstPipeline:pipeline0/GstUDPSrc:udpsrc0:
streaming task paused, reason not-linked (-1)

那么什么突然变得无关紧要?我知道错误是否在autoaudiosrc部分,但突然出现在udpsrc部分?

建议帮助,任何人?

(FWIW)我得到这部分工作后,我将返回并添加rtcp部分或管道。

1 个答案:

答案 0 :(得分:1)

这是一个发送和接收音频的管道(全双工)。我手动设置源以使其可扩展(您可以将视频放在此上,如果您想同时执行这两个操作,我还有一个示例管道)。我将jitter buffer mode设置为BUFFER,因为我的网络是在具有TON抖动的网络上实现的。现在,在此示例管道中,您可以添加所有变量(volume,音频源,编码和解码等)。

 sudo gst-launch gstrtpbin \ 

 name=rtpbin audiotestsrc ! queue ! audioconvert ! alawenc ! \ 

 rtppcmapay pt=8 ! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 ! \ 
 multiudpsink clients="127.0.0.1:5002" sync=false async=false \ 

 udpsrc port=5004 caps="application/x-rtp, media=audio, payload=8, clock-rate=8000, \ 
 encoding-name=PCMA" ! queue ! rtpbin.recv_rtp_sink_0  \ 
 rtpbin. buffer-mode=RTP_JITTER_BUFFER_MODE_BUFFER ! rtppcmadepay ! alawdec ! alsasink

我遇到了控制(RTCP)数据包的问题。我发现如果你使用RTCP,循环测试是不够的。您将不得不在两台计算机上进行测试。

让我知道这是否适合您,因为我已经在4台不同的机器上进行了测试,并且都已经完成了。

相关问题