简体   繁体   English

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

[英]why 'gst.Element.get_request_pad(self.filter, 'filter')' returns 'None' (gstreamer | python)

I am new to gstreamer and its development. 我是gstreamer及其发展的新手。 I am trying to mix RTP streams using Gstreamer Python. 我正在尝试使用Gstreamer Python混合RTP流。 The client sends the different videotest sources and the mixing of these streams should happen on the receiver side using RTP. 客户端发送不同的视频测试源,并且这些流的混合应该在接收方使用RTP进行。 This should be possible for atleast four participants. 对于至少四个参与者,这应该是可能的。

The receiver side will have a videotestbackground already linked with it which will be displayed first. 接收方将具有已链接的videotestbackground,它将首先显示。 When the receiver will receive the videotest sources then the mixing of the videotest sources should take place and displayed on the videotestbackground. 当接收方将接收视频测试源时,应将视频测试源进行混合并显示在videotest背景上。

Here is the code for the receiver side "receiver.py": http://pastebin.com/dM2LcNM2 And 这是接收方“ receiver.py”的代码: http : //pastebin.com/dM2LcNM2

Here is the code for the client side "send_client.py": http://pastebin.com/33edcQ40 这是客户端“ send_client.py”的代码: http : //pastebin.com/33edcQ40

I am getting ERROR message like: 我收到如下错误消息:

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

I am not able to understand why I am getting 'None' on request for 'sinkpad1'. 我无法理解为什么我对“ sinkpad1”的要求无法得到“ None”。 In the documentation, it is stated that updsrc sinkpad are 'on request'. 在文档中,指出updsrc sinkpad是“根据请求”的。

PS: Please refer code for referring the syntax and logic I used for getting 'sinkpad1' PS:请参考代码以引用我用于获取“ sinkpad1”的语法和逻辑

I am not able to get it running. 我无法使其运行。 I Struggled a lot to find the solution. 我努力寻找解决方案。 Please somebody help me in finding the logical error. 请有人帮助我发现逻辑错误。 Thanks in advance. 提前致谢。

Here is the solution finally I found. 这是我终于找到的解决方案。 :) :)

I forgot to keep in mind that I have to use 'rtpbin' which I am receiving it from client. 我忘记要记住,我必须使用从客户端收到的“ rtpbin”。 The Pad properties of 'gstrtpbin' ( $gst-inspect gstrtpbin ) are as follows. 'gstrtpbin'( $gst-inspect gstrtpbin )的Pad属性如下。

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

Looking on the above Pad properties, I have to use 'recv_rtp_sink_%d' pad which is available only on request. 查看以上Pad属性,我必须使用“ recv_rtp_sink_%d” pad,该pad仅应要求提供。

I replaced/modified the source 'receiver.py' file: 我替换/修改了源文件“ 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)

And many minor bugs when I go on fixing it. 当我继续修复它时,还有许多小错误。 But my main goal for this question posted here is fulfilled. 但是我在这里发布的这个问题的主要目标已经实现。 So, I decided to provide answer in case other people like me get stuck on this silly negligence and logical problem. 因此,我决定提供答案,以防像我这样的其他人陷入这个愚蠢的疏忽和逻辑问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM