当前位置: 首页>>代码示例>>Java>>正文


Java RemotePayloadChangeEvent类代码示例

本文整理汇总了Java中javax.media.rtp.event.RemotePayloadChangeEvent的典型用法代码示例。如果您正苦于以下问题:Java RemotePayloadChangeEvent类的具体用法?Java RemotePayloadChangeEvent怎么用?Java RemotePayloadChangeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RemotePayloadChangeEvent类属于javax.media.rtp.event包,在下文中一共展示了RemotePayloadChangeEvent类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performMisMatchedPayloadCheck

import javax.media.rtp.event.RemotePayloadChangeEvent; //导入依赖的package包/类
/**
 * Check whether the payload type of the current packet is different from
 * the previous type on this SSRC.  If it's changed, stop the data source
 * and fire a <tt>RemotePayloadChangeEvent</tt> so that the
 * <tt>MediaStream</tt> will reprogram the codec chain for the new codec.
 *
 * @param rtpPacket The current RTP packet to check
 * @param ssrcinfo The existing SSRC info
 */
private void performMisMatchedPayloadCheck(RTPPacket rtpPacket,
                                           SSRCInfo ssrcinfo)
{
    if (ssrcinfo.lastPayloadType != -1 &&
        ssrcinfo.lastPayloadType != rtpPacket.payloadType)
    {
        ssrcinfo.currentformat = null;

        if (ssrcinfo.dsource != null)
        {
            RTPControlImpl rtpcontrolimpl = (RTPControlImpl) ssrcinfo.dsource
                    .getControl(controlName);
            if (rtpcontrolimpl != null)
            {
                rtpcontrolimpl.currentformat = null;
                rtpcontrolimpl.payload = -1;
            }

            try
            {
                StringBuffer buf = new StringBuffer("[");
                for (PushBufferStream aStream : ssrcinfo.dsource.getStreams())
                {
                    buf.append(aStream.hashCode());
                    buf.append(" ");
                }

                buf.append("]");
                Log.warning("Stopping datasource " + ssrcinfo.dsource.hashCode() +
                    " (used by stream(s) " + buf.toString() +
                    ")because of payload type mismatch: expecting pt=" +
                    ssrcinfo.lastPayloadType + ", got pt=" +
                    rtpPacket.payloadType);
                ssrcinfo.dsource.stop();
            }
            catch (IOException ioexception)
            {
                Log.warning("Problem stopping DataSource after PT change " +
                    ioexception.getMessage());
            }
        }

        ssrcinfo.lastPayloadType = rtpPacket.payloadType;

        RemotePayloadChangeEvent remotepayloadchangeevent = new RemotePayloadChangeEvent(
                cache.sm, (ReceiveStream) ssrcinfo,
                ssrcinfo.lastPayloadType, rtpPacket.payloadType);
        cache.eventhandler.postEvent(remotepayloadchangeevent);
    }
}
 
开发者ID:Metaswitch,项目名称:fmj,代码行数:60,代码来源:RTPReceiver.java


注:本文中的javax.media.rtp.event.RemotePayloadChangeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。