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


Java Header.getSize方法代码示例

本文整理汇总了Java中org.red5.server.net.rtmp.message.Header.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java Header.getSize方法的具体用法?Java Header.getSize怎么用?Java Header.getSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.red5.server.net.rtmp.message.Header的用法示例。


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

示例1: getHeaderType

import org.red5.server.net.rtmp.message.Header; //导入方法依赖的package包/类
/**
 * Determine type of header to use.
 * 
 * @param header RTMP message header
 * @param lastHeader Previous header
 * @return Header type to use
 */
private byte getHeaderType(final Header header, final Header lastHeader) {
    //int lastFullTs = ((RTMPConnection) Red5.getConnectionLocal()).getState().getLastFullTimestampWritten(header.getChannelId());
    if (lastHeader == null || header.getStreamId() != lastHeader.getStreamId() || header.getTimer() < lastHeader.getTimer()) {
        // new header mark if header for another stream
        return HEADER_NEW;
    } else if (header.getSize() != lastHeader.getSize() || header.getDataType() != lastHeader.getDataType()) {
        // same source header if last header data type or size differ
        return HEADER_SAME_SOURCE;
    } else if (header.getTimer() != lastHeader.getTimer()) {
        // timer change marker if there's time gap between header time stamps
        return HEADER_TIMER_CHANGE;
    }
    // continue encoding
    return  HEADER_CONTINUE;
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:23,代码来源:RTMPProtocolEncoder.java

示例2: getHeaderType

import org.red5.server.net.rtmp.message.Header; //导入方法依赖的package包/类
/**
 * Determine type of header to use.
 * 
 * @param rtmp        The protocol state
 * @param header      RTMP message header
 * @param lastHeader  Previous header
 * @return            Header type to use.
 */
private byte getHeaderType(final RTMP rtmp, final Header header, final Header lastHeader) {
	if (lastHeader == null) {
		return HEADER_NEW;
	}
	final Integer lastFullTs = rtmp.getLastFullTimestampWritten(header.getChannelId());
	if (lastFullTs == null) {
		return HEADER_NEW;
	}
	final byte headerType;
	final long diff = RTMPUtils.diffTimestamps(header.getTimer(), lastHeader.getTimer());
	final long timeSinceFullTs = RTMPUtils.diffTimestamps(header.getTimer(), lastFullTs);
	if (header.getStreamId() != lastHeader.getStreamId() || diff < 0 || timeSinceFullTs >= 250) {
		// New header mark if header for another stream
		headerType = HEADER_NEW;
	} else if (header.getSize() != lastHeader.getSize() || header.getDataType() != lastHeader.getDataType()) {
		// Same source header if last header data type or size differ
		headerType = HEADER_SAME_SOURCE;
	} else if (header.getTimer() != lastHeader.getTimer() + lastHeader.getTimerDelta()) {
		// Timer change marker if there's time gap between header time stamps
		headerType = HEADER_TIMER_CHANGE;
	} else {
		// Continue encoding
		headerType = HEADER_CONTINUE;
	}
	return headerType;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:35,代码来源:RTMPProtocolEncoder.java


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