# Detecting stream drop in RTSP interleaved mode

**URL:** <https://community.wowza.com/t/detecting-stream-drop-in-rtsp-interleaved-mode/36708>\
**Category:** Wowza Streaming Engine\
**Created:** [April 11, 2013, 8:52am UTC](https://community.wowza.com/t/detecting-stream-drop-in-rtsp-interleaved-mode/36708 "2013-04-11T08:52:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Micah\_Nolte](https://avatars.discourse-cdn.com/v4/letter/m/9de0a6/32.png) [@Micah\_Nolte](https://community.wowza.com/u/Micah_Nolte)\
**Post date:** [April 11, 2013, 8:52am UTC](https://community.wowza.com/t/detecting-stream-drop-in-rtsp-interleaved-mode/36708/1 "2013-04-11T08:52:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 11, 2013, 3:27pm UTC](https://community.wowza.com/t/detecting-stream-drop-in-rtsp-interleaved-mode/36708/2 "2013-04-11T15:27:03Z")

</div>

Take a look at IMediaCasterNotify2

[https://www.wowza.com/docs/imediacasternotify2-example](https://www.wowza.com/docs/imediacasternotify2-example)

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 11, 2013, 5:05pm UTC](https://community.wowza.com/t/detecting-stream-drop-in-rtsp-interleaved-mode/36708/3 "2013-04-11T17:05:02Z")

</div>

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

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 11, 2013, 6:39pm UTC](https://community.wowza.com/t/detecting-stream-drop-in-rtsp-interleaved-mode/36708/4 "2013-04-11T18:39:18Z")

</div>

Okay, I see. This might work for you:

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

Richard

---

<div class="post-metadata">

**Author:** ![Micah\_Nolte](https://avatars.discourse-cdn.com/v4/letter/m/9de0a6/32.png) [@Micah\_Nolte](https://community.wowza.com/u/Micah_Nolte)\
**Post date:** [April 11, 2013, 10:22am UTC](https://community.wowza.com/t/detecting-stream-drop-in-rtsp-interleaved-mode/36708/5 "2013-04-11T10:22:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Micah\_Nolte](https://avatars.discourse-cdn.com/v4/letter/m/9de0a6/32.png) [@Micah\_Nolte](https://community.wowza.com/u/Micah_Nolte)\
**Post date:** [April 11, 2013, 11:46am UTC](https://community.wowza.com/t/detecting-stream-drop-in-rtsp-interleaved-mode/36708/6 "2013-04-11T11:46:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Micah\_Nolte](https://avatars.discourse-cdn.com/v4/letter/m/9de0a6/32.png) [@Micah\_Nolte](https://community.wowza.com/u/Micah_Nolte)\
**Post date:** [April 12, 2013, 8:13am UTC](https://community.wowza.com/t/detecting-stream-drop-in-rtsp-interleaved-mode/36708/7 "2013-04-12T08:13:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Micah\_Nolte](https://avatars.discourse-cdn.com/v4/letter/m/9de0a6/32.png) [@Micah\_Nolte](https://community.wowza.com/u/Micah_Nolte)\
**Post date:** [April 12, 2013, 10:01am UTC](https://community.wowza.com/t/detecting-stream-drop-in-rtsp-interleaved-mode/36708/8 "2013-04-12T10:01:54Z")

</div>

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](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.

```auto
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
