RTSP runOnDemand keeps Gstreamer source running until 60s session timeout #3109
Replies: 2 comments 4 replies
-
Yes it is because the the RTSP session is not being torn down correctly, so it's keeping the listener around in case of a potential reconnect. This timeout duration is hardcoded in some library (gortsplib? cant remember, its been a while) and not configurable via mediamtx. One way around this is to create some IPC "callback" in the runOnUndemand hook. There, you can notify your application that all stream consumers have abandoned your stream and decide if you want to tear down the RTSP session ahead of the timeout. |
Beta Was this translation helpful? Give feedback.
-
Doing some experiments using a shell script to start and stop the gstreamer video stream I observed that the runOnUnDemand still doesn't execute until after the session timeout so this doesn't seem like a viable workaround to me currently. I did find if I killed the gstreamer stream process manually/externally to MediaMTX that the "readTimeout" parameter in the mediamtx.yml file is respected and destroys the session according the provided time. But then I receive system messages: Is it not a bug that MediaMTX isn't destroying the session when receiving the "INF [RTSP] [conn [::1]:34110] closed: EOF"? Best Regards |
Beta Was this translation helpful? Give feedback.
-
Question
Greetings,
I'm new to MediaMTX but impressed with what I've seen with its functionality and community support. I'm currently observing an issue on my custom Onvif image sensor setup. I'm currently using the built release file v1.6.0_linux_arm64v8 (I was also having the same issue on v1.5.1 that I built from source). I'm using AgentDVR crossplatform software to capture the steam from an embedded system running Yocto Kirkstone Linux that has the image sensor attached.
There are a few hardware related plugins in my gstreamer command but the runOnDemand is as follows:
runOnDemand: gst-launch-1.0 v4l2src io-mode=dmabuf-import device=/dev/video3 ! video/x-bayer, width=2600, height=1952, format=grbg10 ! tiovxisp sink_0::device=/dev/v4l-subdev2 sensor-name=SENSOR_ONSEMI_AR0521 dcc-isp-file=/opt/imaging/ar0521/linear/dcc_viss_GRBG_10b_2600x1952.bin sink_0::dcc-2a-file=/opt/imaging/ar0521/linear/dcc_2a_GRBG_10b_2600x1952.bin format-msb=9 sink_0::pool-size=8 src_0::pool-size=8 ! queue ! v4l2h264enc ! rtspclientsink location=rtsp://localhost:554/test
Here is the output of my server log:
I'm not sure why it is keeping the session open after receiving "2024/02/25 00:13:23 INF [RTSP] [conn 192.168.10.133:58145] closed: EOF"
I can't start streaming from the image sensor successfully again unless I let it timeout, which is unwanted behavior for me. Perhaps I can easily change the Session Timeout time (perhaps just as a test)?
Or is this perhaps due to AgentDVR not sending the proper message to disconnect and close the session?
I was (perhaps incorrectly) expecting an RTSP TEARDOWN but didn't see one in Wireshark using an rtsp filter. AgentDVR is able to stop and start as fast as I can manually enable and disable the stream using another Onvif image sensor product however.
I also don't experience this issue using Gstreamer's gst-rtsp-server library's test example instead but getting away from that is why I'm evaluating MediaMTX.
Thank you for your support
Beta Was this translation helpful? Give feedback.
All reactions