开发者

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

开发者 https://www.devze.com 2023-04-09 16:01 出处:网络
I am new to gstreamer and its development. I am trying to mix RTP streams using Gstreamer Python. The client sends the different videotest sources and the mixing of these streams should happen on the

I am new to gstreamer and its development. I am trying to mix RTP streams using Gstreamer Python. The client sends the different videotest sources and the mixing of these streams should happen on the receiver side using RTP. This should be possible for atleast four participants.

The receiver side will have a videotestbackground already linked with it which will be displayed f开发者_如何转开发irst. When the receiver will receive the videotest sources then the mixing of the videotest sources should take place and displayed on the videotestbackground.

Here is the code for the receiver side "receiver.py": http://pastebin.com/dM2LcNM2 And

Here is the code for the client side "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'. In the documentation, it is stated that updsrc sinkpad are 'on request'.

PS: Please refer code for referring the syntax and logic I used for getting '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. The Pad properties of 'gstrtpbin' ($gst-inspect gstrtpbin) are as follows.

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.

I replaced/modified the source 'receiver.py' file:

@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.

0

精彩评论

暂无评论...
验证码 换一张
取 消