GNOME Bugzilla – Bug 768232
rtspsrc: protocols aren't reset after rtsp redirect
Last modified: 2016-07-25 10:26:41 UTC
When consuming an RTSP source such as in fig.2, and assuming the protocol order such as in fig.1 everything works properly as long as the RTSP source doesn't redirect. I'm experiencing an issue where the unicast UDP protocol is attempted, then the server redirects to another URI, the RTSP negotiation starts over again using the new URI only this time unicast UDP is not attempted by gstreamer, instead it moves on to the next protocol. [Fig.1] GST_RTSP_LOWER_TRANS_UDP GST_RTSP_LOWER_TRANS_UDP_MCAST GST_RTSP_LOWER_TRANS_TCP [Fig.2] gst-launch-1.0 rtspsrc debug=true location="rtsp://192.168.1.118:554/live" ! queue ! rtph264depay ! h264parse ! matroskamux ! filesink location=file.mkv
Do you want to provide a patch to reset it so it starts again from UDP unicast?
Sure, cloning the code for the first time now so bear with me.
Created attachment 330680 [details] [review] Patch allowing redirection Added the patch as an attachment. The gst_rtspsrc_reconnect function was forcing TCP be used previously, I modified it to use the protocols parameter when the stream is being redirected otherwise use TCP as before.
Review of attachment 330680 [details] [review]: ::: gst/rtsp/gstrtspsrc.c @@ +4890,3 @@ + * try TCP when we were configured with an SDP. */ + if(!src->need_redirect) { + if (!(src->protocols & GST_RTSP_LOWER_TRANS_TCP) || src->from_sdp) These two ifs could be combined into one @@ +4898,3 @@ + GST_ELEMENT_WARNING (src, RESOURCE, READ, (NULL), + ("RTSP redirect occurred after %.4f seconds.", + gst_guint64_to_gdouble (src->udp_timeout / 1000000.0))); Why a warning on redirect? That's not really a problem, is it?
Created attachment 330708 [details] [review] Patch with suggestions implemented Your suggestions have been added in this new patch
commit 6d3071f20070dd5ca5338908d3fa0b4c41be0e86 Author: Brad Lackey <blackey@gmail.com> Date: Fri Jul 1 10:05:00 2016 +0000 rtspsrc: Don't disable UDP protocols on redirecting https://bugzilla.gnome.org/show_bug.cgi?id=768232