<HTML dir=ltr><HEAD>
<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=idOWAReplyText71780>
<DIV dir=ltr><FONT color=#000000 size=2 face="Courier New">Hi,</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">I am using gst-plugins-good-0.10.25 and trying to add functionality to rtspsrc plugin so I can react to a server MULTIPLE_CHOICES (300) response.</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">I am successfully trapping the message and extracting the redirect uri.</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">It is all going wrong when I attempt to force the redirect...... from what I understand the following is happening;</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">The pipeline is constructed using gst-launch e.g.</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">gst-launch -v rtspsrc location=rtsp://x.x.x.x/video ! \<BR>rtpmp2tdepay ! playpump ! decode (playpump and decode are just symbolic of the rest of the pipeline)<BR></FONT></DIV>
<DIV dir=ltr><FONT size=2><FONT face="Courier New">The startup works OK and I get the negotiation as should happen, except for when there is a 300 response.</FONT></DIV></FONT>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">I have traced the path through the rtspsrc and I see the following path</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">gst_rtspsrc_change_state -> gst_rtspsrc_open -> gst_rtspsrc_retrieve_sdp</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> gst_rtspsrc_open_from_sdp -> gst_rtspsrc_send</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">I have modified gst_rtspsrc_send to trap the error code</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> case GST_RTSP_STS_MULTIPLE_CHOICES:<BR> {<BR> gchar *new_location;</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> 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> }</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> 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> }</FONT><BR></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">Then in gst_rtspsrc_open I trap the src->need_redirect </FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">open_failed:<BR> {<BR> GST_WARNING_OBJECT (src, "can't setup streaming from sdp");<BR> GST_RTSP_STATE_UNLOCK (src);</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> if ( src->need_redirect )<BR> {<BR> //Lets emit a message to the playbin.....<BR> GstStructure *messageStruct;<BR> GstMessage *message;</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> gchar * uri = g_strdup (src->addr);</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> messageStruct = gst_structure_new ("redirect_message",<BR> "uri", G_TYPE_STRING, uri,<BR> NULL);</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> message = gst_message_new_element (GST_OBJECT (src), messageStruct);<BR> gst_element_post_message (GST_ELEMENT(src), message);</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> printf("Going to redirect to [ %s ]\n", uri);</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> gst_rtspsrc_close(src);<BR></FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> //We are being asked to redirect.<BR> gst_rtspsrc_uri_set_uri (GST_URI_HANDLER (src),<BR> src->addr);<BR> goto retry;</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"> }</FONT></DIV><FONT size=2 face="Courier New"></FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">The jump to retry goes back to the beginning of the gst_rtspsrc_open function. I would have thought that if I use the gst_rtspsrc_close(src); call before attempting to open with the new connection it would destroy all the current sockets to the RTSP server (RTP and RTCP ports). </FONT>
<DIV dir=ltr><BR></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">Here is a session log;</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">Setting pipeline to PAUSED ...<BR>gst_rtspsrc_change_state --- gst_rtspsrc_open<BR>RTSP request message 0x7fa13918<BR> request line:<BR> method: 'OPTIONS'<BR> uri: 'rtsp://x.x.x.x/video'<BR> version: '1.0'<BR> headers:<BR> body:<BR>RTSP response message 0x7fa13934<BR> status line:<BR> code: '200'<BR> reason: 'OK'<BR> version: '1.0'<BR> headers:<BR> key: 'CSeq', value: '1'<BR> key: 'Public', value: 'OPTIONS'<BR> key: 'Public', value: 'DESCRIBE'<BR> key: 'Public', value: 'SETUP'<BR> key: 'Public', value: 'PLAY'<BR> key: 'Public', value: 'PAUSE'<BR> key: 'Public', value: 'GET_PARAMETER'<BR> key: 'Public', value: 'TEARDOWN'<BR> key: 'Server', value: 'Kasenna MediaBase version 9.0'<BR> key: 'Date', value: 'Fri, 25 Feb 2011 14:30:42 GMT'<BR> body: length 0<BR>RTSP request message 0x7fa13918<BR> request line:<BR> method: 'DESCRIBE'<BR> uri: 'rtsp://x.x.x.x/video'<BR> version: '1.0'<BR> headers:<BR> key: 'Accept', value: 'application/x-rtsp-mh, application/sdp'<BR> body:<BR>RTSP response message 0x7fa13934<BR> status line:<BR> code: '200'<BR> reason: 'OK'<BR> version: '1.0'<BR> headers:<BR> key: 'CSeq', value: '2'<BR> key: 'Date', value: 'Fri, 25 Feb 2011 14:30:42 GMT'<BR> key: 'Server', value: 'Kasenna MediaBase version 9.0'<BR> key: 'Content-Type', value: 'application/x-rtsp-mh'<BR> key: 'Content-Length', value: '445'<BR> body: length 446<BR>00000000 (0x4abb80): 3c 4d 65 64 69 61 44 65 73 63 72 69 70 74 69 6f <MediaDescriptio<BR>00000010 (0x4abb90): 6e 3e 0a 3c 4d 65 64 69 61 43 6f 6e 74 61 69 6e n>.<MediaContain<BR>00000020 (0x4abba0): 65 72 0a 4e 75 6d 53 74 72 65 61 6d 73 20 3d 20 er.NumStreams =<BR>00000030 (0x4abbb0): 31 0a 3e 0a 3c 4d 65 64 69 61 53 74 72 65 61 6d 1.>.<MediaStream<BR>00000040 (0x4abbc0): 73 3e 0a 3c 4d 65 64 69 61 53 74 72 65 61 6d 0a s>.<MediaStream.<BR>00000050 (0x4abbd0): 53 74 72 65 61 6d 49 44 20 3d 20 30 0a 4d 69 6d StreamID = 0.Mim<BR>00000060 (0x4abbe0): 65 54 79 70 65 20 3d 20 61 70 70 6c 69 63 61 74 eType = applicat<BR>00000070 (0x4abbf0): 69 6f 6e 2f 78 2d 73 67 69 6d 62 0a 4d 61 78 42 ion/x-sgimb.MaxB<BR>00000080 (0x4abc00): 69 74 52 61 74 65 20 3d 20 33 33 36 38 32 33 39 itRate = 3368239<BR>00000090 (0x4abc10): 0a 48 65 69 67 68 74 20 3d 20 35 37 36 0a 57 69 .Height = 576.Wi<BR>000000a0 (0x4abc20): 64 74 68 20 3d 20 37 36 38 0a 46 72 61 6d 65 73 dth = 768.Frames<BR>000000b0 (0x4abc30): 50 65 72 53 65 63 6f 6e 64 20 3d 20 32 35 2e 30 PerSecond = 25.0<BR>000000c0 (0x4abc40): 30 30 30 30 30 0a 41 73 70 65 63 74 52 61 74 69 00000.AspectRati<BR>000000d0 (0x4abc50): 6f 20 3d 20 30 2e 30 30 30 30 30 30 0a 46 72 61 o = 0.000000.Fra<BR>000000e0 (0x4abc60): 6d 65 73 54 6f 49 46 72 61 6d 65 73 52 61 74 69 mesToIFramesRati<BR>000000f0 (0x4abc70): 6f 20 3d 20 30 2e 30 30 30 30 30 30 0a 41 75 64 o = 0.000000.Aud<BR>00000100 (0x4abc80): 69 6f 48 65 61 64 65 72 20 3d 20 30 0a 44 75 72 ioHeader = 0.Dur<BR>00000110 (0x4abc90): 61 74 69 6f 6e 20 3d 20 34 39 36 35 37 39 32 30 ation = 49657920<BR>00000120 (0x4abca0): 30 30 0a 53 74 61 72 74 54 69 6d 65 20 3d 20 30 00.StartTime = 0<BR>00000130 (0x4abcb0): 0a 50 6c 61 79 4d 6f 64 65 73 20 3d 20 37 0a 4e .PlayModes = 7.N<BR>00000140 (0x4abcc0): 75 6d 54 72 69 63 6b 53 70 65 65 64 20 3d 20 31 umTrickSpeed = 1<BR>00000150 (0x4abcd0): 0a 54 72 69 63 6b 53 70 65 65 64 73 20 3d 20 31 .TrickSpeeds = 1<BR>00000160 (0x4abce0): 32 0a 54 79 70 65 53 70 65 63 69 66 69 63 44 61 2.TypeSpecificDa<BR>00000170 (0x4abcf0): 74 61 20 3d 20 4d 50 45 47 2d 32 0a 56 69 64 65 ta = MPEG-2.Vide<BR>00000180 (0x4abd00): 6f 50 69 64 20 3d 20 30 0a 41 75 64 69 6f 50 69 oPid = 0.AudioPi<BR>00000190 (0x4abd10): 64 20 3d 20 30 0a 3c 2f 4d 65 64 69 61 53 74 72 d = 0.</MediaStr<BR>000001a0 (0x4abd20): 65 61 6d 73 3e 0a 3c 2f 4d 65 64 69 61 44 65 73 eams>.</MediaDes<BR>000001b0 (0x4abd30): 63 72 69 70 74 69 6f 6e 3e 0d 0a 0d 0a 00 cription>.....<BR>RTSP request message 0x7fa13768<BR> request line:<BR> method: 'SETUP'<BR> uri: 'rtsp://x.x.x.x/video/'<BR> version: '1.0'<BR> headers:<BR> key: 'Transport', value: 'RTP/AVP/UDP;unicast;client_port=8254-8255'<BR> key: 'User-Agent', value: 'GSTREAMER_USER_AGENT_KA'<BR> body:<BR>RTSP response message 0x7fa13784<BR> status line:<BR> code: '300'<BR> reason: 'Multiple Choices'<BR> version: '1.0'<BR> headers:<BR> key: 'CSeq', value: '3'<BR> key: 'Location', value: 'rtsp://x.x.x.newx/video'<BR> key: 'Connection', value: 'close'<BR> key: 'Date', value: 'Fri, 25 Feb 2011 14:30:42 GMT'<BR> body: length 0<BR>Going to redirect to [ rtsp://x.x.x.newx/video ]<BR>make sure we're not flushing anymore<BR>close connections<BR>cleanup</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">(gst-launch-0.10:447): GStreamer-WARNING **: Element udpsrc0 is not in bin rtspsrc0</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">(gst-launch-0.10:447): GStreamer-WARNING **: Element udpsrc1 is not in bin rtspsrc0<BR>RTSP request message 0x7fa13918<BR> request line:<BR> method: 'OPTIONS'<BR> uri: 'rtsp://x.x.x.newx/video'<BR> version: '1.0'<BR> headers:<BR> body:<BR>RTSP response message 0x7fa13934<BR> status line:<BR> code: '200'<BR> reason: 'OK'<BR> version: '1.0'<BR> headers:<BR> key: 'CSeq', value: '1'<BR> key: 'Public', value: 'OPTIONS'<BR> key: 'Public', value: 'DESCRIBE'<BR> key: 'Public', value: 'SETUP'<BR> key: 'Public', value: 'PLAY'<BR> key: 'Public', value: 'PAUSE'<BR> key: 'Public', value: 'GET_PARAMETER'<BR> key: 'Public', value: 'TEARDOWN'<BR> key: 'Server', value: 'Kasenna MediaBase version 9.0'<BR> key: 'Date', value: 'Fri, 25 Feb 2011 14:30:42 GMT'<BR> body: length 0<BR>RTSP request message 0x7fa13918<BR> request line:<BR> method: 'DESCRIBE'<BR> uri: 'rtsp://x.x.x.newx/video'<BR> version: '1.0'<BR> headers:<BR> key: 'Accept', value: 'application/x-rtsp-mh, application/sdp'<BR> body:<BR>RTSP response message 0x7fa13934<BR> status line:<BR> code: '200'<BR> reason: 'OK'<BR> version: '1.0'<BR> headers:<BR> key: 'CSeq', value: '2'<BR> key: 'Date', value: 'Fri, 25 Feb 2011 14:30:42 GMT'<BR> key: 'Server', value: 'Kasenna MediaBase version 9.0'<BR> key: 'Content-Type', value: 'application/x-rtsp-mh'<BR> key: 'Content-Length', value: '445'<BR> body: length 446<BR>00000000 (0x4addf8): 3c 4d 65 64 69 61 44 65 73 63 72 69 70 74 69 6f <MediaDescriptio<BR>00000010 (0x4ade08): 6e 3e 0a 3c 4d 65 64 69 61 43 6f 6e 74 61 69 6e n>.<MediaContain<BR>00000020 (0x4ade18): 65 72 0a 4e 75 6d 53 74 72 65 61 6d 73 20 3d 20 er.NumStreams =<BR>00000030 (0x4ade28): 31 0a 3e 0a 3c 4d 65 64 69 61 53 74 72 65 61 6d 1.>.<MediaStream<BR>00000040 (0x4ade38): 73 3e 0a 3c 4d 65 64 69 61 53 74 72 65 61 6d 0a s>.<MediaStream.<BR>00000050 (0x4ade48): 53 74 72 65 61 6d 49 44 20 3d 20 30 0a 4d 69 6d StreamID = 0.Mim<BR>00000060 (0x4ade58): 65 54 79 70 65 20 3d 20 61 70 70 6c 69 63 61 74 eType = applicat<BR>00000070 (0x4ade68): 69 6f 6e 2f 78 2d 73 67 69 6d 62 0a 4d 61 78 42 ion/x-sgimb.MaxB<BR>00000080 (0x4ade78): 69 74 52 61 74 65 20 3d 20 33 33 36 38 32 33 39 itRate = 3368239<BR>00000090 (0x4ade88): 0a 48 65 69 67 68 74 20 3d 20 35 37 36 0a 57 69 .Height = 576.Wi<BR>000000a0 (0x4ade98): 64 74 68 20 3d 20 37 36 38 0a 46 72 61 6d 65 73 dth = 768.Frames<BR>000000b0 (0x4adea8): 50 65 72 53 65 63 6f 6e 64 20 3d 20 32 35 2e 30 PerSecond = 25.0<BR>000000c0 (0x4adeb8): 30 30 30 30 30 0a 41 73 70 65 63 74 52 61 74 69 00000.AspectRati<BR>000000d0 (0x4adec8): 6f 20 3d 20 30 2e 30 30 30 30 30 30 0a 46 72 61 o = 0.000000.Fra<BR>000000e0 (0x4aded8): 6d 65 73 54 6f 49 46 72 61 6d 65 73 52 61 74 69 mesToIFramesRati<BR>000000f0 (0x4adee8): 6f 20 3d 20 30 2e 30 30 30 30 30 30 0a 41 75 64 o = 0.000000.Aud<BR>00000100 (0x4adef8): 69 6f 48 65 61 64 65 72 20 3d 20 30 0a 44 75 72 ioHeader = 0.Dur<BR>00000110 (0x4adf08): 61 74 69 6f 6e 20 3d 20 34 39 36 35 37 39 32 30 ation = 49657920<BR>00000120 (0x4adf18): 30 30 0a 53 74 61 72 74 54 69 6d 65 20 3d 20 30 00.StartTime = 0<BR>00000130 (0x4adf28): 0a 50 6c 61 79 4d 6f 64 65 73 20 3d 20 37 0a 4e .PlayModes = 7.N<BR>00000140 (0x4adf38): 75 6d 54 72 69 63 6b 53 70 65 65 64 20 3d 20 31 umTrickSpeed = 1<BR>00000150 (0x4adf48): 0a 54 72 69 63 6b 53 70 65 65 64 73 20 3d 20 31 .TrickSpeeds = 1<BR>00000160 (0x4adf58): 32 0a 54 79 70 65 53 70 65 63 69 66 69 63 44 61 2.TypeSpecificDa<BR>00000170 (0x4adf68): 74 61 20 3d 20 4d 50 45 47 2d 32 0a 56 69 64 65 ta = MPEG-2.Vide<BR>00000180 (0x4adf78): 6f 50 69 64 20 3d 20 30 0a 41 75 64 69 6f 50 69 oPid = 0.AudioPi<BR>00000190 (0x4adf88): 64 20 3d 20 30 0a 3c 2f 4d 65 64 69 61 53 74 72 d = 0.</MediaStr<BR>000001a0 (0x4adf98): 65 61 6d 73 3e 0a 3c 2f 4d 65 64 69 61 44 65 73 eams>.</MediaDes<BR>000001b0 (0x4adfa8): 63 72 69 70 74 69 6f 6e 3e 0d 0a 0d 0a 00 cription>.....<BR>RTSP request message 0x7fa13768<BR> request line:<BR> method: 'SETUP'<BR> uri: 'rtsp://x.x.x.newx/video/'<BR> version: '1.0'<BR> headers:<BR> key: 'Transport', value: 'RTP/AVP/UDP;unicast;client_port=8254-8255'<BR> key: 'User-Agent', value: 'GSTREAMER_USER_AGENT_KA'<BR> body:<BR>RTSP response message 0x7fa13784<BR> status line:<BR> code: '200'<BR> reason: 'OK'<BR> version: '1.0'<BR> headers:<BR> key: 'CSeq', value: '3'<BR> key: 'Transport', value: 'RTP/AVP/UDP;unicast;source=62.142.123.24;client_port=8254-8255;server_port=60398-60399;ssrc=163c081b'<BR> key: 'Session', value: '1293466192;timeout=60'<BR> body: length 0<BR>/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:rtpbin0: latency = 2000<BR>/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:rtpbin0: buffer-mode = slave (1)<BR>/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc2: timeout = 5000000<BR>Pipeline is live and does not need PREROLL ...<BR>ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not write to resource.<BR>Additional debug info:<BR>gstrtspsrc.c(5066): gst_rtspsrc_setup_streams (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:<BR>Could not send message. (Unknown error (1))<BR>ERROR: pipeline doesn't want to preroll.<BR>Setting pipeline to PAUSED ...<BR>Setting pipeline to READY ...<BR>make sure we're not flushing anymore<BR>construct a control url<BR>construct a control url<BR>try aggregate<BR>do TEARDOWN<BR>RTSP request message 0x7fa14208<BR> request line:<BR> method: 'TEARDOWN'<BR> uri: 'rtsp://x.x.x.newx/video'<BR> version: '1.0'<BR> headers:<BR> key: 'User-Agent', value: 'GSTREAMER_USER_AGENT_KA'<BR> body:<BR>RTSP response message 0x7fa14224<BR> status line:<BR> code: '200'<BR> reason: 'OK'<BR> version: '1.0'<BR> headers:<BR> key: 'CSeq', value: '4'<BR> key: 'Date', value: 'Fri, 25 Feb 2011 14:30:43 GMT'<BR> body: length 0<BR>parse result?<BR>close connections<BR>cleanup<BR>Setting pipeline to NULL ...<BR>Freeing pipeline ...<BR>Caught SIGSEGV accessing address 0x2b2f5bd8</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">Its almost as if the old ports havent been closed or discarded. It will successfully re-negotiate the connection but not UDP data is coming through.</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">If I dont do the redirect and let the pipeline go through the state change </FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">Setting pipeline to NULL ...<BR>Freeing pipeline ...<BR></FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">I can successfully use the new redirect address. I dont understand the difference between the forced close and the close applied by the pipeline going from PLAYING to READY to NULL. I thought the rtspsrc would handle its own sources and sinks and connect to the rest of the pipeline when dataflow is active.</DIV></FONT>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">This has been driving me mental. If anyone can point me to how I can successfully debug or find out where the blockage in the pipeline is it would be fantastic. The target is an embedded platform not a PC.</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">Regards</FONT></DIV>
<DIV dir=ltr><FONT size=2 face="Courier New">Marc</FONT></DIV>
<DIV dir=ltr><FONT color=#000000 face=Arial><SPAN style="FONT-SIZE: 10pt"><FONT size=1></SPAN></FONT> </DIV></DIV></FONT></BODY></HTML>