> On Mar 27, 2020, at 7:50 PM, Steve Ha <stev...@u2sr.com> wrote:
> 
> Hi Ross,
> 
> My RTSP client application needs to recognize disconnect event triggered from 
> the RTSP server.

The way to do this is to look for, and handle, a RTCP “BYE” packet that the 
server should send when it ends the stream.  And the way to do that is to call 
“setByeHandler()” or “setByeWithReasonHandler()” on the “RTCPInstance” object.

See, for example, the code in “openRTSP” that does this:
        
subsession->rtcpInstance()->setByeWithReasonHandler(subsessionByeHandler, 
subsession);
where “subsessionByeHandler()” is defined as:
        void subsessionByeHandler(void* clientData, char const* reason) {
                MediaSubsession* subsession = (MediaSubsession*)clientData;
                …
        }


> But I could not find any way to get such event. By debugging I could see the 
> disconnect event happening inside the function 
> RTSPClient::handleResponseBytes() when the argument 
> 'newBytesRead' has a value of -1.

No, you’re ‘barking up the wrong tree’ here.  All that is doing is detecting 
when the RTSP TCP connection has ended.  And that can happen at any time during 
the stream - not necessarily when the stream ends.  (It is perfectly legal for 
a RTSP server to close the RTSP TCP connection at any time - even while the RTP 
stream is ongoing.  Should that happen, our “RTSPClient” code would recover 
from this automatically; it is of no concern to application code.)


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to