为什么'gst.Element.get_request_pad(self.filter,'filter')返回'None'(gstreamer | python)

为什么'gst.Element.get_request_pad(self.filter,'filter')返回'None'(gstreamer | python),python,gstreamer,Python,Gstreamer,我对gstreamer及其发展一无所知。我正在尝试使用Gstreamer-Python混合RTP流。客户端发送不同的videotest源,这些流的混合应该使用RTP在接收方进行。至少有四名参与者可以这样做 接收器端将有一个已链接的videotestbackground,它将首先显示。当接收器接收到videotest源时,应进行videotest源的混合,并在videotestbackground上显示 以下是receiver side receiver.py的代码: 及 以下是客户端send_c

我对gstreamer及其发展一无所知。我正在尝试使用Gstreamer-Python混合RTP流。客户端发送不同的videotest源,这些流的混合应该使用RTP在接收方进行。至少有四名参与者可以这样做

接收器端将有一个已链接的videotestbackground,它将首先显示。当接收器接收到videotest源时,应进行videotest源的混合,并在videotestbackground上显示

以下是receiver side receiver.py的代码: 及

以下是客户端send_client.py的代码:

我收到的错误消息如下:

ankit@fh:~/$ ./receiver4.py 
Started...
Running...
new ssrc
  session 0
  ssrc 3217594798
3217594798
filter:  /GstPipeline:server/GstCapsFilter:filter (__main__.GstCapsFilter) || Type:: <class '__main__.__main__.GstCapsFilter'>
srcpad1:  /GstPipeline:server/GstUDPSrc:udpsrc0.GstPad:src (gst.Pad)  || Type:::  <type 'gst.Pad'>
sinkpad1:  None
Traceback (most recent call last):

  File "./receiver4.py", line 132, in on_new_ssrc
    lres = gst.Pad.link(srcpad1, sinkpad1)
TypeError: GstPad.link() argument 1 must be gst.Pad, not None
我无法理解为什么我在请求“sinkpad1”时得到“无”。文件中指出,updsrc sinkpad是“应要求”提供的

PS:请参考代码以参考我用于获取“sinkpad1”的语法和逻辑


我无法让它运行。我费了很大劲才找到解决办法。请有人帮我找出逻辑错误。提前感谢。

这是我最终找到的解决方案:

我忘了记住我必须使用“rtpbin”,我从客户那里收到它。“gstrtpbin”$gst inspect gstrtpbin的焊盘属性如下所示

Pad Templates:
  SINK template: 'recv_rtp_sink_%d'
    Availability: On request
      Has request_new_pad() function: gst_rtp_bin_request_new_pad
    Capabilities:
      application/x-rtp

  SINK template: 'recv_rtcp_sink_%d'
    Availability: On request
      Has request_new_pad() function: gst_rtp_bin_request_new_pad
    Capabilities:
      application/x-rtcp

  SINK template: 'send_rtp_sink_%d'
    Availability: On request
      Has request_new_pad() function: gst_rtp_bin_request_new_pad
    Capabilities:
      application/x-rtp

  SRC template: 'recv_rtp_src_%d_%d_%d'
    Availability: Sometimes
    Capabilities:
      application/x-rtp

  SRC template: 'send_rtcp_src_%d'
    Availability: On request
      Has request_new_pad() function: gst_rtp_bin_request_new_pad
    Capabilities:
      application/x-rtcp

  SRC template: 'send_rtp_src_%d'
    Availability: Sometimes
    Capabilities:
      application/x-rtp
根据上述焊盘属性,我必须使用“recv_rtp_sink_u%d”焊盘,该焊盘仅可根据要求提供

我替换/修改了源“receiver.py”文件:

@line 130: sinkpad1 = gst.Element.get_request_pad(rtpbin, 'recv_rtp_sink_%d')
@line 132: we do not need to link this as it is already linked above. DELETED
@line 133: we have unlink udpsrc0 then link it. unlink eg.: self.udpsrc0.unlink(rtpbin)
当我继续修复它时,会发现很多小错误。但是我在这里发布的这个问题的主要目标已经实现了。所以,我决定提供答案,以防像我这样的人陷入这个愚蠢的疏忽和逻辑问题