<HTML dir=ltr><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>
<DIV dir=ltr id=idOWAReplyText43020>
<DIV dir=ltr><FONT color=#000000 size=2>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.&nbsp; 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><A href="https://exchange.marcm.co.uk/exchweb/bin/redir.asp?URL=http://gstreamer-devel.966125.n4.nabble.com/file/n3328215/rtspsrc_multichoice.patch" target=_blank>http://gstreamer-devel.966125.n4.nabble.com/file/n3328215/rtspsrc_multichoice.patch</A><BR>rtspsrc_multichoice.patch</FONT></DIV>
<DIV dir=ltr><FONT color=#000000 size=2 face=Arial></FONT>&nbsp;</DIV></DIV>
<DIV dir=ltr id=idSignature69016>
<DIV><FONT color=#000000 face=Arial>
<DIV class=MsoNormal><FONT size=2><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #4f81bd">w</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #fabf8f"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'"><A href="http://www.marcm.co.uk/">www.marcm.co.uk</A></SPAN></FONT></DIV><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #4f81bd">
<DIV class=MsoNormal></SPAN><SPAN style="FONT-SIZE: 10pt"><FONT size=1>MARCM CONSULTANCY LTD registered office: </FONT></SPAN></DIV>
<DIV class=MsoNormal><SPAN style="FONT-SIZE: 10pt"><FONT size=1>10 Church Road, Cheadle Hulme, Cheadle, Cheshire, SK8 7JU. Registered no:</FONT> </SPAN><FONT size=2><FONT size=1><SPAN style="COLOR: black">792 9557 66</SPAN>,<SPAN style="FONT-SIZE: 10pt"> <FONT size=1>England.</FONT></SPAN></FONT></FONT></DIV>
<DIV class=MsoNormal><FONT size=2><FONT size=1><SPAN style="FONT-SIZE: 10pt"></SPAN></FONT></FONT><SPAN style="FONT-SIZE: 10pt"><FONT size=1></FONT></SPAN>&nbsp;</DIV>
<DIV class=MsoNormal><SPAN style="FONT-SIZE: 10pt"><FONT size=1>This communication contains information which is confidential and may also be privileged. It is for the exclusive</FONT><FONT size=1> use of the addressee. If you are not the addressee please note that any distribution, reproduction, copying, publication or use of this communication or the information is prohibited. If you have received this communication in error, please contact us immediately and also delete the communication from your computer.</SPAN></FONT></DIV></FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> gstreamer-devel-bounces+marcmltd=marcm.co.uk@lists.freedesktop.org on behalf of Marco Ballesio<BR><B>Sent:</B> Sat 26/02/2011 16:15<BR><B>To:</B> Discussion of the development of and with GStreamer<BR><B>Subject:</B> Re: Problems with rtspsrc<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>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 &lt;marcmltd@marcm.co.uk&gt; wrote:<BR>..snip..<BR>&gt;<BR>&gt; 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>&gt; &nbsp;&nbsp; case GST_RTSP_STS_MULTIPLE_CHOICES:<BR>&gt; &nbsp;&nbsp; {<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gchar *new_location;<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GST_INFO("got redirection");<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* if we don't have a Location Header, we must error */<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (gst_rtsp_message_get_header (response, GST_RTSP_HDR_LOCATION,<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;new_location, 0) &lt; 0)<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;{<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; GST_INFO("Ooops no Location Header");<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;}<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GST_INFO("Source Address %p", src);<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;src-&gt;addr = g_strdup (new_location);<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;GST_INFO("Redirect to [ %s ]", src-&gt;addr);<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; src-&gt;need_redirect = TRUE;<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; src-&gt;state = GST_RTSP_STATE_INIT;<BR>&gt; //&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; res = GST_RTSP_OK;<BR><BR>Why is this commented?<BR><BR>&gt; &nbsp;&nbsp; }<BR>&gt; Then in gst_rtspsrc_open I trap the src-&gt;need_redirect<BR>&gt;<BR>&gt; open_failed:<BR>&gt; &nbsp; {<BR>&gt; &nbsp;&nbsp;&nbsp; GST_WARNING_OBJECT (src, "can't setup streaming from sdp");<BR>&gt; &nbsp;&nbsp;&nbsp; GST_RTSP_STATE_UNLOCK (src);<BR>&gt; &nbsp;&nbsp;&nbsp; if ( src-&gt;need_redirect )<BR>&gt; &nbsp;&nbsp; &nbsp;{<BR>&gt; &nbsp;&nbsp; &nbsp;&nbsp;//Lets emit a message to the playbin.....<BR>&gt; &nbsp;&nbsp; &nbsp;&nbsp;GstStructure *messageStruct;<BR>&gt; &nbsp;&nbsp; &nbsp;&nbsp;GstMessage&nbsp;&nbsp; *message;<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gchar * uri = g_strdup (src-&gt;addr);<BR>&gt; &nbsp;&nbsp; &nbsp;&nbsp;messageStruct = gst_structure_new ("redirect_message",<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "uri",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_TYPE_STRING, uri,<BR>&gt; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL);<BR>&gt; &nbsp;&nbsp; &nbsp;&nbsp;message = gst_message_new_element (GST_OBJECT (src), messageStruct);<BR>&gt; &nbsp;&nbsp; &nbsp;&nbsp;gst_element_post_message (GST_ELEMENT(src), message);<BR>&gt; &nbsp;&nbsp; &nbsp;&nbsp;printf("Going to redirect to [ %s ]\n", uri);<BR>&gt;<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp; gst_rtspsrc_close(src);<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp; //We are being asked to redirect.<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gst_rtspsrc_uri_set_uri (GST_URI_HANDLER (src),<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;src-&gt;addr);<BR><BR>After setting the URI you should probably need to go through a state<BR>change READY-&gt;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&amp;id=6d545e29add17f1c02ee4fe5623409ed63369c17#n5328">http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/gst/rtsp/gstrtspsrc.c?h=0.11&amp;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>&gt; &nbsp;&nbsp; &nbsp;&nbsp;goto retry;<BR>&gt; &nbsp;}<BR>&gt; The jump to retry goes back to the beginning of the gst_rtspsrc_open<BR>&gt; function.<BR><BR>Spaghetti are good :D<BR><BR>&gt; I would have thought that if I use the gst_rtspsrc_close(src);<BR>&gt; call before attempting to open with the new connection it would destroy all<BR>&gt; 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>&gt; Here is a session log;<BR>&gt;<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>&gt; Caught SIGSEGV accessing address 0x2b2f5bd8<BR>&gt;<BR><BR>This is interesting as well.. any backtraces available?<BR><BR>&gt;<BR>&gt; 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&lt;your_interface&gt; -s0 -w/path/to/dump.cap<BR><BR>Regards<BR><BR>It will<BR>&gt; successfully re-negotiate the connection but not UDP data is coming through.<BR>&gt;<BR>&gt; If I dont do the redirect and let the pipeline go through the state change<BR>&gt; Setting pipeline to NULL ...<BR>&gt; Freeing pipeline ...<BR>&gt; I can successfully use the new redirect address.&nbsp; I dont understand the<BR>&gt; difference between the forced close and the close applied by the pipeline<BR>&gt; going from PLAYING to READY to NULL.&nbsp; I thought the rtspsrc would handle its<BR>&gt; own sources and sinks and connect to the rest of the pipeline when dataflow<BR>&gt; is active.<BR>&gt;<BR>&gt; This has been driving me mental. If anyone can point me to how I can<BR>&gt; successfully debug or find out where the blockage in the pipeline is it<BR>&gt; would be fantastic.&nbsp; The target is an embedded platform not a PC.<BR>&gt;<BR>&gt; Regards<BR>&gt; Marc<BR>&gt;<BR>&gt; _______________________________________________<BR>&gt; gstreamer-devel mailing list<BR>&gt; gstreamer-devel@lists.freedesktop.org<BR>&gt; <A href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</A><BR>&gt;<BR>&gt;<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></DIV></BODY></HTML>