How to dynamically receive RTP streams?

Sebastian Dröge sebastian at centricular.com
Sat Jan 25 03:20:49 PST 2014


On Mi, 2014-01-22 at 16:18 -0500, Joshua Kurland wrote:
> Hi,
> 
> My application needs to receive and play an RTP video stream.  The format
> of the video stream could be either mpeg4/h264 or mpeg2-ts, but the
> receiver will not know in advance which one it is, and it does not
> communicate with the transmitter at all.  How can I set the caps of the
> udpsrc without knowing the video format?  One option that has been
> suggested was to use typefind, but I don't understand how this can work.
>  In order to receive the stream the caps need to be set already.  And to
> get the caps using typefind, the video needs to be available.  Do I need to
> hard-code the caps, get the stream, check the caps with typefind then reset
> the caps?

RTP packets are not typefindable, you need to get the media type of the
RTP stream via different means. Usually this is done by sending some SDP
from the transmitter to the clients, e.g. when using SIP or RTSP. If you
don't have that you need to find a different way to tell the clients
about the media type they have to expect (and any other important
properties that go into the application/x-rtp caps).

> I plan on using decodebin to decode the stream once it arrives.  However I
> have not had any experience with using decodebin.  Am I able to link the
> rtpbin to the decodebin as soon as I have a live stream, or do I need to
> wait for the 'pad-added' signal of the decodebin then link them inside of a
> callback function?

You will have udpsrc, then the rtpbin (and another udpsrc for rtcp
linked to rtpbin, and a udpsink for rtcp linked to it too), then rtpbin
linked to decodebin. And decodebin then adds pads for the raw media.

> Lastly, my code is already using the playbin to set the source and sink
> elements.  Is their some way to keep that portion of code, but use the
> rtpbin instead of the uri to attach the stream to playbin?

If you use raw RTP you can't use playbin currently unless you implement
a source element for your custom protocol. Similar to what rtspsrc does
for example, which is usable in playbin. You can use decodebin and
playsink without that though.

The reason for this is also that RTP by itself is not very useable
unless you also transfer the media type via a different channel.

-- 
Sebastian Dröge, Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140125/5a3a4775/attachment.pgp>


More information about the gstreamer-devel mailing list