Modify or fix SDP data sent from IP cameras with the Wowza Streaming Engine Java API

You can create a class that overrides the code that's used to communicate with IP cameras, modifying the RTSP request sent to the IP camera and the resultant SDP data that's sent to Wowza Streaming Engine to publish the stream. Create this class, and add to a JAR file in the Wowza Streaming Engine server [install-dir]/lib folder.

The following example class overrides the default RTSP handler:

package com.wowza.wms.plugin.rtpprovideroverride;

import com.wowza.wms.mediacaster.rtp.*;
import com.wowza.wms.logging.*;

public class RTPSessionDescriptionDataProviderOverride extends RTPSessionDescriptionDataProviderBasic
{
    protected void rtspMessageHook(RTPSessionDescriptionDataProviderBasicRTSPRequest request)
    {
        // Here you can modify the RTSP message requests
        //request.addHeader("X-No-Keepalive", "1");
    }

    protected String filterSessionDescriptionData(String streamInfo)
    {
        // Here you can modify the SDP data that is sent to Wowza Streaming Engine for publishing
        //streamInfo = streamInfo.replace("profile-level-id", "hide-profile-level-id");

        return streamInfo;
    }

}

Edit [install-dir]/conf/[application-name]/Application.xml and add the following property to the <MediaCaster>/<Properties> container. Be sure to get the proper container—there are several in the Application.xml file.

<Property>
    <Name>rtpSessionDescriptionDataProviderClass</Name>
    <Value>com.wowza.wms.plugin.rtpprovideroverride.RTPSessionDescriptionDataProviderOverride </Value>
</Property>