<HTML><HEAD><TITLE>RE: Problems with rtspsrc</TITLE>
<META content="text/html; charset=unicode" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18928"></HEAD>
<BODY>
<P><FONT size=2>I'll try with the correct link this time ;o)<BR><BR>Hi Marco<BR>I have managed to fix it after looking at the extremely verbose logs.<BR><BR>The problem was that the udp sockets were being closed too early and later<BR>in the close process a message was trying to be posted and the socket was no<BR>longer there so there was an error.<BR><BR>I have created a unique fallthrough for MULTIPLE_CHOICES.<BR><BR>I have a patch if you can have a look and see if it doesn't break anything,<BR>apply to gstrtspsrc.c. I am now getting reliable redirects and rtsp<BR>sessions.<BR><BR>Once it is fully tested I will submit for integration to future releases.<BR><BR>Thanks<BR>Marc<BR><BR>w www.marcm.co.uk<BR><BR><BR>-----Original Message-----<BR>From: gstreamer-devel-bounces+marcmltd=marcm.co.uk@lists.freedesktop.org [<A href="mailto:gstreamer-devel-bounces+marcmltd=marcm.co.uk@lists.freedesktop.org">mailto:gstreamer-devel-bounces+marcmltd=marcm.co.uk@lists.freedesktop.org</A>] On Behalf Of Marco Ballesio<BR>Sent: 26 February 2011 16:15<BR>To: Discussion of the development of and with GStreamer<BR>Subject: Re: Problems with rtspsrc<BR><BR>Hi Marc,<BR><BR>some comments below, I hope this will help..<BR><BR>On Fri, Feb 25, 2011 at 5:12 PM, Marc Murphy <marcmltd@marcm.co.uk> wrote:<BR>..snip..<BR>><BR>> I have modified gst_rtspsrc_send to trap the error code<BR><BR>I understand you have added the case GST_RTSP_STS_MULTIPLE_CHOICES as<BR>a fall-through for MOVED_PERMANENTLY and MOVE_TEMPORARILY.<BR><BR>In case you've done something more, would it be possible to provide a<BR>patch, either as an attachment in this thread or as something pullable<BR>from a repo?<BR><BR>> case GST_RTSP_STS_MULTIPLE_CHOICES:<BR>> {<BR>> gchar *new_location;<BR>> GST_INFO("got redirection");<BR>> /* if we don't have a Location Header, we must error */<BR>> if (gst_rtsp_message_get_header (response, GST_RTSP_HDR_LOCATION,<BR>> &new_location, 0) < 0)<BR>> {<BR>> GST_INFO("Ooops no Location Header");<BR>> }<BR>> GST_INFO("Source Address %p", src);<BR>> src->addr = g_strdup (new_location);<BR>> GST_INFO("Redirect to [ %s ]", src->addr);<BR>> src->need_redirect = TRUE;<BR>> src->state = GST_RTSP_STATE_INIT;<BR>> // res = GST_RTSP_OK;<BR><BR>Why is this commented?<BR><BR>> }<BR>> Then in gst_rtspsrc_open I trap the src->need_redirect<BR>><BR>> open_failed:<BR>> {<BR>> GST_WARNING_OBJECT (src, "can't setup streaming from sdp");<BR>> GST_RTSP_STATE_UNLOCK (src);<BR>> if ( src->need_redirect )<BR>> {<BR>> //Lets emit a message to the playbin.....<BR>> GstStructure *messageStruct;<BR>> GstMessage *message;<BR>> gchar * uri = g_strdup (src->addr);<BR>> messageStruct = gst_structure_new ("redirect_message",<BR>> "uri", G_TYPE_STRING, uri,<BR>> NULL);<BR>> message = gst_message_new_element (GST_OBJECT (src), messageStruct);<BR>> gst_element_post_message (GST_ELEMENT(src), message);<BR>> printf("Going to redirect to [ %s ]\n", uri);<BR>><BR>> gst_rtspsrc_close(src);<BR>> //We are being asked to redirect.<BR>> gst_rtspsrc_uri_set_uri (GST_URI_HANDLER (src),<BR>> src->addr);<BR><BR>After setting the URI you should probably need to go through a state<BR>change READY->PAUSED to initiate the new sessions (I don't recommend<BR>you to force a state change from the element itself) but I don't<BR>understand, in the first place, why the default handling of the<BR>redirection does not suffice in your case:<BR><BR><A href="http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/gst/rtsp/gstrtspsrc.c?h=0.11&id=6d545e29add17f1c02ee4fe5623409ed63369c17#n5328">http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/gst/rtsp/gstrtspsrc.c?h=0.11&id=6d545e29add17f1c02ee4fe5623409ed63369c17#n5328</A><BR><BR>The handling of need_redirect would automatically retry with the new<BR>URI after your modification of above. Or is there something particular<BR>you want the application to perform?<BR><BR>> goto retry;<BR>> }<BR>> The jump to retry goes back to the beginning of the gst_rtspsrc_open<BR>> function.<BR><BR>Spaghetti are good :D<BR><BR>> I would have thought that if I use the gst_rtspsrc_close(src);<BR>> call before attempting to open with the new connection it would destroy all<BR>> the current sockets to the RTSP server (RTP and RTCP ports).<BR><BR>It's not clear to me how we can have RTP/RTCP ports already opened if<BR>we're still in the session initiation phase. When seeing those, it's<BR>probably already too late and a proper redirection has been missed.<BR><BR>> Here is a session log;<BR>><BR>..snip..<BR><BR>Could you use a lower verbosity and possibly dump packets in a network<BR>capture with tcpdump? Something I could see with Wireshark..<BR><BR>.<BR>> Caught SIGSEGV accessing address 0x2b2f5bd8<BR>><BR><BR>This is interesting as well.. any backtraces available?<BR><BR>><BR>> Its almost as if the old ports havent been closed or discarded.<BR><BR>Which old ports do you mean? Unless I've missed something from the<BR>log, no RTP/RTCP sessions have started yet (you got a 300 right at the<BR>beginning of the SETUP). Again, a proper network dump, possibly taken<BR>from the client, will clarify our ideas here.<BR><BR>Suggested command:<BR><BR>tcpdump -i<your_interface> -s0 -w/path/to/dump.cap<BR><BR>Regards<BR><BR>It will<BR>> successfully re-negotiate the connection but not UDP data is coming through.<BR>><BR>> If I dont do the redirect and let the pipeline go through the state change<BR>> Setting pipeline to NULL ...<BR>> Freeing pipeline ...<BR>> I can successfully use the new redirect address. I dont understand the<BR>> difference between the forced close and the close applied by the pipeline<BR>> going from PLAYING to READY to NULL. I thought the rtspsrc would handle its<BR>> own sources and sinks and connect to the rest of the pipeline when dataflow<BR>> is active.<BR>><BR>> This has been driving me mental. If anyone can point me to how I can<BR>> successfully debug or find out where the blockage in the pipeline is it<BR>> would be fantastic. The target is an embedded platform not a PC.<BR>><BR>> Regards<BR>> Marc<BR>><BR>> _______________________________________________<BR>> gstreamer-devel mailing list<BR>> gstreamer-devel@lists.freedesktop.org<BR>> <A href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</A><BR>><BR>><BR>_______________________________________________<BR>gstreamer-devel mailing list<BR>gstreamer-devel@lists.freedesktop.org<BR><A href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</A><BR><BR><BR></FONT></P></BODY></HTML>