Transmitting streams between processes
dv
dv at pseudoterminal.org
Thu Nov 22 05:35:28 PST 2012
Hello,
I want to decode media in one process and transmit it to another, which
will playback the media.
Both processes will always run on the same host.
It is also important for the second process to be able to join in at any
moment, and hear what is currently being decoded.
In other words, the first process does not have to keep decoded data
cached. You could see the first process as something
like a "local web cast".
I have to use GStreamer 0.10 for the time being, since a port of the
underlying application to 1.0 will not be done soon.
The problem I have is with transmitting the caps. The caps can change at
any moment (for example, because now a stereo song
is playing, and the last song was a mono one). Here are some notes about
solutions I've tried so far:
- gdppay works, but transmits the header only once. So, if a receiver
exits and rejoins, it won't work.
- rtpgstpay is an interesting option, but I have to explicitely give the
depayloader the caps of the media, which means
I'd have to establish an out-of-band connection for transmitting caps
like SDP, and that sounds like overkill if both processes are on
the same host.
- The same goes for the TCP sinks and sources, they work, and can
retransmit GDP headers, but I'd like to avoid the TCP overhead.
Also, the TCP method requires the sender to be running before the
receiver starts, and suffers from queuing problems
(it often does not start to play right away).
- ALSA loopback is actually not GStreamer specific, but can be used for
this. However, it does not allow to change the sample rate,
number of channels etc. unless both sender and receiver disconnect
from it.
Here is an example using shmsink and rtpgstpay:
sender:
gst-launch-0.10 videotestsrc pattern=ball ! rtpgstpay ! shmsink
socket-path=/tmp/abc wait-for-connection=false
receiver:
gst-launch-0.10 shmsrc socket-path=/tmp/abc ! "application/x-rtp,
media=(string)application, clock-rate=(int)90000,
encoding-name=(string)X-GST,
caps=(string)\"dmlkZW8veC1yYXcteXV2LCBmb3JtYXQ9KGZvdXJjYylZVVkyLCBjb2xvci1tYXRyaXg9KHN0cmluZylzZHR2LCBjaHJvbWEtc2l0ZT0oc3RyaW5nKW1wZWcyLCB3aWR0aD0oaW50KTMyMCwgaGVpZ2h0PShpbnQpMjQwLCBmcmFtZXJhdGU9KGZyYWN0aW9uKTMwLzE\\=\",
payload=(int)96" ! rtpgstdepay ! autovideosink
this is almost perfect, it suffers from two problems: the sender must be
running before the receiver starts, and the caps string must be set.
Does anyone have an idea? It seems like a common use case.
More information about the gstreamer-devel
mailing list