<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. 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> </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> </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 <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></DIV></BODY></HTML>