本文整理汇总了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;
}
示例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;
}