Receiving RTP without udpsrc

Peter Maersk-Moller pmaersk at gmail.com
Sun Dec 25 12:36:56 UTC 2016


Hi

Using a named pipe is notoriously difficult to get to work. The following
pipeline using unnamed pipe works.

gst-launch-1.0 audiotestsrc is-live=1 ! audioconvert ! audioresample !
mulawenc ! rtppcmupay ! fdsink fd=3 3>&1 1>&2 | gst-launch-1.0 fdsrc fd=0
!  "application/x-rtp, media=(string)audio, clock-rate=(int)8000,
encoding-name=(string)PCMU" ! queue ! rtpjitterbuffer ! rtppcmudepay !
mulawdec ! queue ! pulsesink

However that won't get you where you say you want to go. However worth
noting is that using fdsrc and fdsink is easy to get to work.

I use xinetd (inetd's replacement). It will listen for UDP packets on a
port and start up a process and forward these packets to the stdin of the
process. The process can then use GStreamer's fdsrc to receive the packets.
You pipeline can use chroot to sandbox it if set up corrrectly and xinetd
can be setup to only accept packets from the IP addresses you define.

I use this xinetd configuration (place it in /etc/xinetd.d/something-audio)

service snowmix-audio-feed-udp-1-1
{
        disable         = yes
        type            = UNLISTED
        id              = snowmix-audio-feed-udp-1-1-stream
        socket_type     = dgram
        protocol        = udp
        user            = stream
        wait            = yes
        instances       = 1
        server          =
/home/stream/Projects/Snowmix-0.5.2/xinetd/xinetd-audio-feed
        #server_args    = port format rate channels
        server_args     = 9100 vorbis/rtp 44100 1
        port            = 9100
        only_from       = 127.0.0.1/32 192.168.0.0/16
}

When xinetd receives a udp packet on port 9100, it will here execute the
script /home/stream/Projects/Snowmix-0.5.2/xinetd/xinetd-audio-feed with
the 4 arguments "9100 vorbis/rtp 44100 1"

In my case, my script uses the arguments to setup a pipeline suitable for
decoding and the execute the pipeline using "fdsrc fd=0" as the source of
the stream.

I usually use an audio encoding and a packet format suitable and robust for
streaming. You use ulaw. Some may say that it is not the obvious first
choice for a robust streaming, but if it works for you and you are happy
about it ...




On Sun, Dec 25, 2016 at 12:11 PM, <wsnark at tuta.io> wrote:

> Hi,
>
> I'm trying to build a GStreamer-based RTP receiver in a sandboxed
> architecture:
> - A "listener" process listens at UDP port and redirect the stream to
> receiver
> - "Receiver" process runs in a sandbox without network access, gets data
> from "listener" over a pipe.
>
> The reason for such architecture is increased security - so that
> vulnerable parsing code is run with minimum privileges.
>
> At prototyping phase I'm trying to create a PoC using "gst-launch-1.0",
> but I cannot find a way to create a working pipeline to play RTP stream
> from a pipe instead of udpsrc.
>
> For example, usual udpsrc receiving pipeline that works:
> gst-launch-1.0 udpsrc  port=3000 caps="application/x-rtp,
> media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMU" !
> rtppcmudepay ! mulawdec ! pulsesink
>
> Corresponding sending part is
> gst-launch-1.0 filesrc location="test.wav" ! wavparse ! audioconvert !
> audioresample ! mulawenc ! rtppcmupay ! udpsink host=127.0.0.1 port=3000
>
> Changing udpsrc to filesrc doesn't work:
> gst-launch-1.0 filesrc location="/tmp/pipe" !  "application/x-rtp,
> media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMU" !
> rtppcmudepay ! mulawdec ! pulsesink
>
> Sending part:
> gst-launch-1.0 filesrc location="test.wav" ! wavparse ! audioconvert !
> audioresample ! mulawenc ! rtppcmupay ! filesink location=/tmp/pipe
>
> The stream is actually played, but just garbled sound. Error output:
> WARNING: from element /GstPipeline:pipeline0/GstRtpPcmuDepay:rtppcmudepay0:
> Could not decode stream.
> Additional debug info:
> gstrtpbasedepayload.c(503): gst_rtp_base_depayload_handle_buffer ():
> /GstPipeline:pipeline0/GstRtpPcmuDepay:rtppcmudepay0:
> Received invalid RTP payload, dropping
>
> If I capture incoming stream to file, then I'm unable to play it either
> (same behavior). If I remove RTP elements from the pipeline, raw PCMU is
> played fine.
>
> So my questions are:
> 1. Is it possible to play RTP stream without udpsrc using gst-launch-1.0?
> 2. Is it possible to implement this in code, in own application?
>
> Thanks,
> Wire Snark
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161225/17ee3bed/attachment.html>


More information about the gstreamer-devel mailing list