Commutation between two video streams to gst-rtsp-server

Дмитрий В. Середа sd at bp.pp.ru
Mon Oct 26 01:38:25 PDT 2015


Hi, gstreamer community.

I have live h264 stream from Android MediaCodec forwarded to this pipeline (code: http://pastie.org/10508310):
appsrc ! queue ! h264parse ! queue ! rtph264pay config-interval=1 ! rtph264depay ! mpegtsmux ! tcpserversink

I can connect to this pipeline with VLC tcp://address:port or with pipeline 
tcpclientsink ! tsdemux ! h264parse ! avdec_h264 ! d3dvideosink

Also I have another pipeline, for which i must switch when Android application activity go to background, and stream from camera must be stopped:
videotestsrc pattern=0 horizontal-speed=5 ! textoverlay text="my device" ! x264enc tune="zerolatency" threads=1 ! h264parse ! rtph264pay config-interval=1 ! rtph264depay ! mpegtsmux ! tcpserversink

I have general task: perform commutation between two streams, and introduce result with gst-rtsp-server.

Task looks easy but i have run into troubles setting proper pipeline for GstRTSPMediaFactory.

I have tried different commutation decisions between source pipelines and gst-rtsp-media pipeline: appsink/appsrc, tcpserversink/tcpclientsrc, gdppay/tcpserversink/tcpclientsrc/gdpdepay.

Only rtp over udpsink/udpsrc works passable. 

First problem that I have struggled with: resending h264 SPS/PPS when client connects to sender pipeline what already playing. I have decided it with little trick: adding elements rtph264pay config-interval=1 ! rtph264depay to sender pipeline. 
It is worse decision: receiver lost averagely half a second(practically more) of streaming data before stream will go properly. This is occurs due to “h264parse” element drops all NAL units until SPS/PPS data will be received.

1) So, first question: does anybody knows way to request instantly resend SPS/PPS, or how to get SPS/PPS data to manually send it to newly connected receiver? 

Second problem: transmission pipelines what works independently does not works with GstRTSPMedia:

source: videotestsrc pattern=0 horizontal-speed=5 ! textoverlay text="my device" ! x264enc tune="zerolatency" threads=1 ! h264parse ! rtph264pay config-interval=1 ! rtph264depay ! mpegtsmux ! tcpserversink

I can connect to this pipeline with VLC tcp://address:port or with pipeline 
tcpclientsink ! tsdemux ! h264parse ! avdec_h264 ! d3dvideosink

But I can't connect to it by transmitter pipeline within gst-rtsp-server:
tcpclientsrc ! queue ! tsdemux ! h264parse ! rtph264pay config-interval=1 name=pay0 pt=96

Failure log messages after dropping many NAL units: 
rtspmedia rtsp-media.c:2790:gst_rtsp_media_suspend: suspend for dynamic pipelines needs fixing
0:01:43.047543744 12538  0x9c5d430 WARN                 tsdemux tsdemux.c:864:gst_ts_demux_srcpad_event: seeking failed
0:01:43.047588491 12538  0x9c5d430 WARN                 tsdemux tsdemux.c:864:gst_ts_demux_srcpad_event: seeking failed
0:01:43.047619596 12538  0x9c5d430 WARN                 tsdemux tsdemux.c:864:gst_ts_demux_srcpad_event: seeking failed
0:01:43.047631398 12538  0x9c5d430 WARN                 tsdemux tsdemux.c:864:gst_ts_demux_srcpad_event: seeking failed
0:02:03.049644956 12538  0x9c5d430 WARN               rtspmedia rtsp-media.c:2127:wait_preroll: failed to preroll pipeline
0:02:03.049693759 12538  0x9c5d430 WARN               rtspmedia rtsp-media.c:1720:gst_rtsp_media_seek: failed to preroll after seek
0:02:03.049712805 12538  0x9c5d430 ERROR       rtspsessionmedia rtsp-session-media.c:334:gst_rtsp_session_media_get_rtpinfo:<GstRTSPSessionMedia at 0x9cce0c8> media was not prepared
0:02:03.049724477 12538  0x9c5d430 WARN               rtspmedia rtsp-media.c:1499:gst_rtsp_media_get_range_string: media 0x9cf20e0 was not prepared
0:02:03.049823270 12538  0x9c5d430 WARN               rtspmedia rtsp-media.c:3075:gst_rtsp_media_set_state: media 0x9cf20e0 in error status while changing to state 4
0:02:03.099794882 12538  0x9c5d430 WARN               rtspmedia rtsp-media.c:3075:gst_rtsp_media_set_state: media 0x9cf20e0 in error status while changing to state 1
0:02:03.099830465 12538  0x9c5d430 WARN               rtspmedia rtsp-media.c:3075:gst_rtsp_media_set_state: media 0x9cf20e0 in error status while changing to state 1

2) Second question: why pipeline what works independently does not works with GstRTSPMedia?

Thanks in advance for any useful advice.

--------------------------------
With best regards, dzen Tiur.



More information about the gstreamer-devel mailing list