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