Gst-rtsp-server can't prepare media for some specific clients


I am using Xavier NX (L4T 32.4.3) and trying to build a RTSP server taking frames from the CSI camera.

We are using the gst-rtsp-server library as a base:

This is the gst srcipt we are using:
GST_DEBUG=3 ./test-launch “nvarguscamerasrc ! video/x-raw(memory:NVMM), format=NV12, width=3264, height=2464, framerate=15/1 ! nvvidconv ! video/x-raw(memory:NVMM), format=NV12, width=1920, height=1080, framerate=15/1 ! nvvidconv ! clockoverlay time-format=”%Y/%m/%d %H:%M:%S" ! nvvidconv ! omxh264enc preset-level=3 bitrate=1000000 control-rate=3 ! video/x-h264 ! h264parse ! rtph264pay name=pay0 config-interval=1"

It generally works fine when my RTSP clients are from the same network (within the same router). However, when I try to connect to the server from a remote RTSP clients, I have a very high chance (> 80%) seeing the follow error:

0:01:23.230270747 30967 0x7f880c4590 WARN omxvideoenc gstomxvideoenc.c:1860:gst_omx_video_enc_set_format: Error setting temporal_tradeoff 0 : Vendor specific error (0x00000001)
H264: Profile = 66, Level = 40
0:01:43.179526025 30967 0x55a71e3b70 WARN rtspmedia rtsp-media.c:3272:wait_preroll: failed to preroll pipeline
0:01:43.179633290 30967 0x55a71e3b70 WARN rtspmedia rtsp-media.c:3652:gst_rtsp_media_prepare: failed to preroll pipeline
0:01:43.190663867 30967 0x55a71e3b70 ERROR rtspclient rtsp-client.c:1077:find_media: client 0x7f7c012d10: can’t prepare media
0:01:43.191728265 30967 0x55a71e3b70 ERROR rtspclient rtsp-client.c:2963:handle_describe_request: client 0x7f7c012d10: no media
0:01:43.203113565 30967 0x7f38004800 FIXME default gstutils.c:3981:gst_pad_create_stream_id_internal:nvarguscamerasrc6:src Creating random stream-id, consider implementing a deterministic way of creating a stream-id

It would be great if someone can give me some clue on this. I have been trying to fix this for weeks :(


It looks to be an issue in RTSP communication. Could you try the pipeline:

videotestsrc ! video/x-raw,width=1920,height=1080 ! x264enc ! h264parse ! rtph264pay name=pay0 config-interval=1

NVIDIA plugins are to enable hardware acceleration and should not trigger the issue. Would like to know if the issue is there without our plugins.

I have finally found the root cause, it is an issue in the gst-rtsp-server library. When you open up a single RTSP path to more than 1 port (e.g. you want to expose your RTSP to the public internet and set a different external port in port-forwarding), the gst-rtsp-server will try to open a new pipeline which will fail. I believe the reason is that the CSI camera feed can only be consumed by one process at a time, creating a new pipeline will not get data from the camera.

The default nvarguscamerasrc may not support this case. It is actually open source. You may check the source code and see if it can be customized to support the usecase.
The source code is in
L4T Driver Package (BSP) Sources