我从 Github 源代码 1.5.2 构建了 Gstreamer。我尝试通过 UDP 接收四个 RTP 流并将它们混合到一个接收器。
gst-launch-1.0
执行管道没有问题:
gst-launch-1.0 adder name=mix \
mix. ! audioresample ! "audio/x-raw, rate=(int)48000" ! audioconvert ! alsasink device=hw:0,0 sync=true\
udpsrc port=8001 ! "application/x-rtp, payload=(int)127, clock-rate=(int)48000, encoding-name=(string)L24, channels=(int)2" ! queue ! rtpL24depay ! audiorate ! "audio/x-raw, rate=(int)48000" ! audioconvert ! mix. \
udpsrc port=8002 ! "application/x-rtp, payload=(int)127, clock-rate=(int)48000, encoding-name=(string)L24, channels=(int)2" ! queue ! rtpL24depay ! audiorate ! "audio/x-raw, rate=(int)48000" ! audioconvert ! mix. \
udpsrc port=8003 ! "application/x-rtp, payload=(int)127, clock-rate=(int)48000, encoding-name=(string)L24, channels=(int)2" ! queue ! rtpL24depay ! audiorate ! "audio/x-raw, rate=(int)48000" ! audioconvert ! mix. \
udpsrc port=8004 ! "application/x-rtp, payload=(int)127, clock-rate=(int)48000, encoding-name=(string)L24, channels=(int)2" ! queue ! rtpL24depay ! audiorate ! "audio/x-raw, rate=(int)48000" ! audioconvert ! mix.
这是调试输出的片段:
0:00:00.030580800 7944 0x1a0a180 DEBUG udpsrc gstudpsrc.c:920:gst_udpsrc_open:<udpsrc0> allocating socket for 0.0.0.0:8001
0:00:00.030776434 7944 0x1a0a180 DEBUG udpsrc gstudpsrc.c:891:gst_udpsrc_resolve:<udpsrc0> IP address for host 0.0.0.0 is 0.0.0.0
0:00:00.030906105 7944 0x1a0a180 DEBUG udpsrc gstudpsrc.c:933:gst_udpsrc_open:<udpsrc0> got socket 0x1a82130
0:00:00.030973628 7944 0x1a0a180 DEBUG udpsrc gstudpsrc.c:940:gst_udpsrc_open:<udpsrc0> binding on port 8001
0:00:00.031013585 7944 0x1a0a180 INFO udpsrc gstudpsrc.c:1008:gst_udpsrc_open:<udpsrc0> have udp buffer of 212992 bytes
0:00:00.031048025 7944 0x1a0a180 DEBUG udpsrc gstudpsrc.c:1081:gst_udpsrc_open:<udpsrc0> bound, on port 8001
当我在 Python 3.4 程序中构建此管道时,udpsrc
失败并显示以下输出:
0:00:00.209166227 8783 0x7f23ac005330 DEBUG udpsrc gstudpsrc.c:920:gst_udpsrc_open:<udpsrc0> allocating socket for 0.0.0.0:8001
0:00:00.209216934 8783 0x7f23ac005330 DEBUG udpsrc gstudpsrc.c:891:gst_udpsrc_resolve:<udpsrc0> IP address for host 0.0.0.0 is 0.0.0.0
0:00:00.209256307 8783 0x7f23ac005330 DEBUG udpsrc gstudpsrc.c:933:gst_udpsrc_open:<udpsrc0> got socket 0x7f23b4012bb0
0:00:00.209281194 8783 0x7f23ac005330 DEBUG udpsrc gstudpsrc.c:940:gst_udpsrc_open:<udpsrc0> binding on port 8001
0:00:00.209318428 8783 0x7f23ac005330 INFO udpsrc gstudpsrc.c:1008:gst_udpsrc_open:<udpsrc0> have udp buffer of 212992 bytes
0:00:00.209351430 8783 0x7f23ac005330 DEBUG udpsrc gstudpsrc.c:1081:gst_udpsrc_open:<udpsrc0> bound, on port 8001
...
0:00:00.216234022 10012 0x7f1e80001d90 LOG udpsrc gstudpsrc.c:628:gst_udpsrc_create:<udpsrc0> read packet of 1398 bytes
0:00:00.216279688 10012 0x7f1e80001d90 WARN basesrc gstbasesrc.c:2943:gst_base_src_loop:<udpsrc0> error: Internal data flow error.
0:00:00.216297871 10012 0x7f1e80001d90 WARN basesrc gstbasesrc.c:2943:gst_base_src_loop:<udpsrc0> error: streaming task paused, reason not-negotiated (-4)
Error received from element udpsrc0: Internal data flow error.
Debugging information: gstbasesrc.c(2943): gst_base_src_loop (): /GstPipeline:INPUT/GstUDPSrc:udpsrc0:
streaming task paused, reason not-negotiated (-4)OUTPUT Pipeline state changed from ready to paused.
我在调试输出中看到的唯一区别是套接字地址。
gst-launch-1.0
打印一个 7 字节的套接字地址,我的 Python 程序打印一个 12 字节的套接字地址。
这里出了什么问题?我是忘记了queue
还是设置了错误的属性?