GNOME Bugzilla – Bug 707611
rtspsrc state change always blocks when source is offline (waiting for connect timeout)
Last modified: 2013-09-18 16:51:37 UTC
gst_element_set_state (playbin, GST_STATE_PLAYING) always blocks for a pipeline with rtspsrc when source IP is not responding, i.e. it appears to wait synchronously for connect() to complete. The problem appears to be because of the following lines in gstrtspsrc.c: case GST_STATE_CHANGE_PLAYING_TO_PAUSED: /* unblock the tcp tasks and make the loop waiting */ gst_rtspsrc_loop_send_cmd (rtspsrc, CMD_WAIT, CMD_LOOP); /* make sure it is waiting before we send PAUSE or PLAY below */ // BUG: BLOCKS HERE GST_RTSP_STREAM_LOCK (rtspsrc); GST_RTSP_STREAM_UNLOCK (rtspsrc); Lock/unlock pair wasn't there in older versions, and gst_element_set_state() did not block (there was proper async state change). Here are backtraces from my app for two threads. The first one is the application thread which should not block, but it blocks because of this bug. The second one is gstreamer's rtspsrc thread. Line numbers are for gstreamer-1.0.9 release. Application thread:
+ Trace 232454
Backtraces have been automatically screwed up by bugzilla. Repeating: Application thread:
+ Trace 232455
GStreamer rtspsrc thread:
+ Trace 232456
Reverting gst-plugins-base commit b96d931bf4ce5c3c8c5be4fa76f5c75bca85d0c4 fixes the problem.
In gst-plugins-good though: commit b96d931bf4ce5c3c8c5be4fa76f5c75bca85d0c4 Author: Wim Taymans <wim.taymans@collabora.co.uk> Date: Thu Jun 20 14:43:47 2013 +0200 rtspsrc: fix race in state change to paused When we go to paused, we first flush the connection and then send the pause command. As a result of the flushing, the scheduled paused command can get lost. Wait until the connection is completely flushed and the rtsp task is waiting before issuing the paused or playing request. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=702705 Also a blocker for 1.0.11!
Please try this an reopen if still a problem: commit 9f9bcbc40578847821412e6949984cdc96ebf77a Author: Wim Taymans <wim.taymans@collabora.co.uk> Date: Mon Sep 9 15:11:51 2013 +0200 rtspsrc: only wait if we flushed Only wait for the STREAM_LOCK when we flushed something when sending a command for PAUSED or PLAYING. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=707611