Wowza Community

Detecting stream drop in RTSP interleaved mode

Hello,

We have an iPhone app that streams to Wowza 2.2.4.07 build27628 in RTSP interleaved mode. Sometimes we are faced with the issue that due to the network delay, connection issues or some other valid network reasons Wowza drops the stream. The problem is that we cannot detect it from the client. The socket remains open by Wowza and it keeps accepting RTP traffic but stream never gets recorded. When we use RTP over multi-cast UDP it all works fine. RTCP reports stop coming in to us from Wowza, which indicates that stream is lost. Unfortunately, for some other non-Wowza related reasons we cannot use RTP over UDP.

Is there a way to get feedback from Wowza reliably in RTSP interleaved mode?

Thank you.

Take a look at IMediaCasterNotify2

https://www.wowza.com/docs/imediacasternotify2-example

Richard

It should run if you are pulling RTSP stream from the device. Otherwise, I am not sure what you can do.

Richard

Okay, I see. This might work for you:

https://www.wowza.com/docs/how-to-use-imediastreamactionnotify2-to-monitor-live-streams-modulestreamwatchdog

Richard

Hmm… I am not sure I understand how it can help me. We cannot use Mediacaster API on iOS. We have our own RTSP interleaving client code.

We are sending from the device to the server. So we are pushing to Wowza. The device is establishing the connection to wowza, and that stream isn’t publically available

I have determined that Wowza does not send any RTCP RR packets in RTSP interleaved mode. This is the underlying root of the problem for me. Is there a reason for that? I am getting RR packets back just fine in RTP Multicast mode.

A related problem is when we try and shut down an RTSP stream from the StreamWatchdog. We’re using code adapted from the Watchdog example in the forums here:

https://www.wowza.com/docs/how-to-use-imediastreamactionnotify2-to-monitor-live-streams-modulestreamwatchdog

For the part that disconnects the stream, it is able to stop the RTSP stream, but the connection remains open. Because of this, the iPhone app that is streaming is not notified that its stream has been killed.

Do you know of a way to close the RTP connection, given an RTSP stream that’s using it? If so, this could solve our problems.

Here is the code we have that attempts to close the streams. We’ve found that the “client” isn’t available on the inbound RTSP streams, so we’re using getRTPStream() if that happens to find the correct thing to close.

log.info("StreamWatchDog: stalled: " + streamName);
IMediaStream liveStream = (IMediaStream) appInstance.getProperties().getProperty("live-" + streamName);
IClient client = liveStream.getClient();
if ( client != null )
{
    log.info("StreamWatchDog: trying to shutdown: live-" + streamName);
    client.setShutdownClient(true);
}
else
{
    log.info("StreamWatchDog: client was null, so unable to close connection:" + streamName);
    log.info("StreamWatchDog: trying to shutdown: " + streamName);
    RTPStream rtpstream = liveStream.getRTPStream();
    if ( rtpstream != null ) {
        log.info("StreamWatchDog: found RTP stream: " + streamName);
        RTPSession rtpsession = rtpstream.getSession();
        if ( rtpsession != null ) {
            log.info("StreamWatchDog: found RTP session: " + streamName);
            rtpsession.shutdown();
        }
    }
    // I don't think these actually do anything, but are there just in case.
    appInstance.stopMediaCasterStream(streamName);
    liveStream.close();
}

Thanks for the help,

Micah