GNOME Bugzilla – Bug 796160
Race when client sends some udp packets before play request
Last modified: 2018-06-27 10:54:02 UTC
Created attachment 372108 [details] [review] patch in gst-rtsp-server ( minimum for solving problem ) There is a race in plug_src in rtsp-stream between setting src to playing and linking the pads, when src is udpsrc and client sending udp data before play. Then the udpsrc want to push data on src pad before it's linked this causing a link error. We have come across a client doing that. When client is not sending udp data the thread caused by setting udp src to playing is stuck at.
+ Trace 238617
This is not the case when client sending udp data just befor play request !!! One solution is to remove the strange part in plug_src were setting a single element to playing before adding to bin. Instead we sync the element with the state in bin after it have been added to bin. Please find attachment (Fix problem) 0001-rtsp-stream-Give-all-elements-in-pipeline-same-statu.patch (Refactor) 0002-rtsp-stream-Refactor-plug_src.patch
Created attachment 372111 [details] [review] patch in gst-rtsp-server ( refactor )
Any news about this ?
There might be a perfomance problem with this patch. i will get back when I know more.
There are no performance problem with this patch. The root cause of the performance problem is in our downstream code.
Could one also solve this by simply blocking the udpsrc's src pad before setting it to PLAYING state and unblocking again after it has been linked to the funnel? Then we don't need to touch this state code and it seems to be a more direct way of addressing the issue.
Created attachment 372846 [details] [review] gst-rtsp-server patch Attached a new patch.
Thanks, fixed indentation and rephrased wording in the commit message and comment a bit: commit c1fab570d8e845685b7e890b2a588314382c1ded (HEAD -> master) Author: Göran Jönsson <goranjn@axis.com> Date: Wed Jun 27 08:30:42 2018 +0200 rtsp-stream: avoid pushing data on unlinked udpsrc pad during setup Fix race when setting up source elements. Since we set the source element(s) to PLAYING state before hooking them up to the downstream funnel, it's possible for the source element to receive packets before we actually get to linking it to the funnel, in which case buffers would be pushed out on an unlinked pad, causing it to error out and stop receiving more data. We fix this by blocking the source's srcpad until we have linked it. https://bugzilla.gnome.org/show_bug.cgi?id=796160