How to enable advanced monitoring and resetting of MediaCaster streams

You can use the ModuleMediaCasterStreamMonitorAdvanced module to monitor native-RTP or MPEG-TS encoder streams and reset them if they become unhealthy, according to the property settings below. The settings are quite conservative. It's probably best to set streamMonitorVideoTCToleranceEnable and streamMonitorAudioTCToleranceEnable to true to more closely monitor timecode jumps that may occur.

The module can be used along with the MediaStreamNameGroups module to monitor and reset groups of streams if any one becomes unhealthy.

Install Steps
  1. Add this <Module> definition to the end of the <Modules> list in [install-dir]/conf/[application]/Application.xml:
     
    <Module>
    	<Name>ModuleMediaCasterStreamMonitorAdvanced</Name>
    	<Description>ModuleMediaCasterStreamMonitorAdvanced</Description>
    	<Class>com.wowza.wms.module.ModuleMediaCasterStreamMonitorAdvanced</Class>
    </Module>
    Note: If you're using this with the MediaStreamNameGroups, then this module only needs to be added to the origin. The edge server configuration doesn't need to change.
  2. Add the following properties to the application-level <Properties> container at the bottom of [install-dir]/conf/[application]/Application.xml (be sure to get the correct <Properties> container - there are several in the Application.xml file). Carefully read the instructions above each set of properties and set accordingly:
     
    <!--
    Monitor incoming packets (stream, audio, video) to be sure packets continue to flow from encoder to stream. The streamMonitor[type]StartTimeout controls the timeout (milliseconds) for the first packet. The streamMonitor[type]Timeout controls the timeout (milliseconds) for packets after the first packet. The stream type refers to a catch-all of any packet of any type (audio, video, data). If any of these values are set to zero, the test is turned off.
    -->
    <Property>
    	<Name>streamMonitorStreamStartTimeout</Name>
    	<Value>20000</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>streamMonitorStreamTimeout</Name>
    	<Value>12000</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>streamMonitorVideoStartTimeout</Name>
    	<Value>0</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>streamMonitorVideoTimeout</Name>
    	<Value>0</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>streamMonitorAudioStartTimeout</Name>
    	<Value>0</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>streamMonitorAudioTimeout</Name>
    	<Value>0</Value>
    	<Type>Integer</Type>
    </Property>
    
    <!--
    Monitor the incoming packet timecodes (audio, video or data) to be sure packets do not arrive out of order or late. The streamMonitor[type]TCPosTolerance and streamMonitor[type]TCNegTolerance (milliseconds) values define a sliding window based on the timecode of the previous packet. For example if these values are set to -500 and 3000 respectively then the timecode difference between the current arriving packet and the previous packet of that type must fall within -500 and 3000 milliseconds.  If not and streamMonitor[type]TCToleranceEnable is set to true then stream will be considered unhealthy and will be reset.
    -->
    <Property>
    	<Name>streamMonitorVideoTCToleranceEnable</Name>
    	<Value>true</Value>
    	<Type>Boolean</Type>
    </Property>
    <Property>
    	<Name>streamMonitorVideoTCPosTolerance</Name>
    	<Value>3000</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>streamMonitorVideoTCNegTolerance</Name>
    	<Value>-500</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>streamMonitorAudioTCToleranceEnable</Name>
    	<Value>true</Value>
    	<Type>Boolean</Type>
    </Property>
    <Property>
    	<Name>streamMonitorAudioTCPosTolerance</Name>
    	<Value>3000</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>streamMonitorAudioTCNegTolerance</Name>
    	<Value>-500</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>streamMonitorDataTCToleranceEnable</Name>
    	<Value>false</Value>
    	<Type>Boolean</Type>
    </Property>
    <Property>
    	<Name>streamMonitorDataTCPosTolerance</Name>
    	<Value>3000</Value>
    	<Type>Integer</Type>
    </Property>
    <Property>
    	<Name>streamMonitorDataTCNegTolerance</Name>
    	<Value>-500</Value>
    	<Type>Integer</Type>
    </Property>
    
    <!--
    Monitors the time difference between the audio and video channel of a stream. If the difference between the currently arriving video packet and the previous audio packet (or vice-versa) is greater than streamMonitorAVSyncTolerance and streamMonitorAVSyncToleranceEnable is set to true, then the stream will be considered unhealthy and will be reset.
    -->
    <Property>
    	<Name>streamMonitorAVSyncToleranceEnable</Name>
    	<Value>false</Value>
    	<Type>Boolean</Type>
    </Property>
    <Property>
    	<Name>streamMonitorAVSyncTolerance</Name>
    	<Value>1500</Value>
    	<Type>Integer</Type>
    </Property>
    
    <!--
    If set to true, then when a stream is reset and it belong to a MediaStreamNameGroup all streams in the group will be reset. If false only the unhealthy stream will be reset.
    -->
    <Property>
    	<Name>streamMonitorResetNameGroups</Name>
    	<Value>true</Value>
    	<Type>Boolean</Type>
    </Property>
    
    <!--
    Turns on debug logging of the monitoring.
    -->
    <Property>
    	<Name>streamMonitorDebug</Name>
    	<Value>false</Value>
    	<Type>Boolean</Type>
    </Property>

If you're having problems or want to discuss this article, post in our forum.