<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I am using a derivative of the testRTSPClient in an application. I
am detecting stream failure by looking for missing frames. When I
detect that the stream has been "silent" for too long, I need to
close that stream and reopen it. I know the stream source is still
working because other clients are still receiving. I am currently
using only a single stream, but I left the code to handle multiple
streams should I need it.<br>
<br>
When I need to restart a stream, I call this function:<br>
<br>
<pre>short StopAllRtspStreams(void)</pre>
<pre>{</pre>
<pre> *env << "\n\n*** StopAllRtspStreams()\n";</pre>
<pre>
CaptureEnabled = false;</pre>
<pre>
if (initialized)</pre>
<pre> StopExecThread();</pre>
<pre> for (int i = 0; i < rtspClientCount; ++i)</pre>
<pre> {</pre>
<pre> if (rtspClients[i] != NULL)</pre>
<pre> {</pre>
<pre> *env << "shutting down " << *rtspClients[i] << "\n";</pre>
<pre> shutdownStream(rtspClients[i]);</pre>
<pre> }</pre>
<pre> rtspClients[i] = NULL;</pre>
<pre> }</pre>
<pre> rtspClientCount = 0;</pre>
<pre>
// TODO anything else?</pre>
<pre>
return 0;</pre>
<pre>}
</pre>
Then when restarting the stream, I call:<br>
<br>
<pre>short StartRtspStream(char * rtspURL,</pre>
<pre> BufferPool_t * videoPool,</pre>
<pre> BufferPool_t * leftPool,</pre>
<pre> BufferPool_t * rightPool,</pre>
<pre> BUFFER_CAPTURE_CALLBACK_PROC callback)</pre>
<pre>{</pre>
<pre> if (!initialized)</pre>
<pre> StartExecThread();</pre>
<pre> *env << "\n\n*** StartRtspStream(" << rtspURL << ", ...)\n";</pre>
<pre> RTSPClient* rtspClient = ourRTSPClient::createNew(*env, rtspURL, RTSP_CLIENT_VERBOSITY_LEVEL, 0, videoPool, leftPool, rightPool, callback);</pre>
<pre> if (rtspClient == NULL)</pre>
<pre> {</pre>
<pre> *env << "Failed to create a RTSP client for URL \"" << rtspURL << "\": " << env->getResultMsg() << "\n";</pre>
<pre> return 0;</pre>
<pre> }</pre>
<pre> rtspClient->sendDescribeCommand(continueAfterDESCRIBE); </pre>
<pre> rtspClients[rtspClientCount] = rtspClient;</pre>
<pre> ++rtspClientCount;</pre>
<pre> return 1;</pre>
<pre>}</pre>
On the restart, the thing gets hung up waiting for the socket to
connect:<br>
<tt><br>
*** StartRtspStream(rtsp://192.168.233.1/test, ...)<br>
openConnection() entry<br>
Opening connection to 192.168.233.1, port 554, socket 2148...<br>
...connection pending (10035)</tt><br>
<br>
My code will detect that it didn't work, shut it down, and try to
start it again. Over and over again. I'm guessing that I'm not
shutting something down properly. I just can't figure out what.<br>
<br>
Suggestions?<br>
<br>
Mike [;-}><br>
<br>
</body>
</html>