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


Java ITag.setTimestamp方法代码示例

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


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

示例1: write

import org.red5.io.ITag; //导入方法依赖的package包/类
protected void write(int timeStamp, byte type, IoBuffer data) throws IOException {
	log.trace("timeStamp :: {}", timeStamp);
	ITag tag = new Tag();
	tag.setDataType(type);

	tag.setBodySize(data.limit());
	tag.setTimestamp(timeStamp);
	tag.setBody(data);

	writer.writeTag(tag);
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:12,代码来源:BaseStreamWriter.java

示例2: write

import org.red5.io.ITag; //导入方法依赖的package包/类
/**
 * Adjust timestamp and write to the file.
 * 
 * @param queued
 *            queued data for write
 */
private final void write(QueuedData queued) {
    // get data type
    byte dataType = queued.getDataType();
    // get timestamp
    int timestamp = queued.getTimestamp();
    log.debug("Write - timestamp: {} type: {}", timestamp, dataType);
    // get queued
    ITag tag = queued.getData();
    if (tag != null) {
        // only allow blank tags if they are of audio type
        if (tag.getBodySize() > 0 || dataType == ITag.TYPE_AUDIO) {
            // if the last message was a reset or we just started, use the header timer
            if (startTimestamp == -1) {
                startTimestamp = timestamp;
                timestamp = 0;
            } else {
                timestamp -= startTimestamp;
            }
            // update the timestamp
            tag.setTimestamp(timestamp);
            try {
                if (timestamp >= 0) {
                    if (!writer.writeTag(tag)) {
                        log.warn("Tag was not written");
                    }
                } else {
                    log.warn("Skipping message with negative timestamp.");
                }
            } catch (ClosedChannelException cce) {
                // the channel we tried to write to is closed, we should not try
                // again on that writer
                log.error("The writer is no longer able to write to the file: {} writable: {}", path.getFileName(), path.toFile().canWrite());
            } catch (IOException e) {
                log.warn("Error writing tag", e);
                if (e.getCause() instanceof ClosedChannelException) {
                    // the channel we tried to write to is closed, we should not
                    // try again on that writer
                    log.error("The writer is no longer able to write to the file: {} writable: {}", path.getFileName(), path.toFile().canWrite());
                }
            } finally {
                queued.dispose();
            }
        }
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:52,代码来源:FileConsumer.java

示例3: write

import org.red5.io.ITag; //导入方法依赖的package包/类
/**
 * Write incoming data to the file.
 * 
 * @param timestamp adjusted timestamp
 * @param msg stream data
 */
private final void write(int timestamp, IRTMPEvent msg) {
	byte dataType = msg.getDataType();
	log.debug("Write - timestamp: {} type: {}", timestamp, dataType);
	//if the last message was a reset or we just started, use the header timer
	if (startTimestamp == -1) {
		startTimestamp = timestamp;
		timestamp = 0;
	} else {
		timestamp -= startTimestamp;
	}
	// create a tag
	ITag tag = new Tag();
	tag.setDataType(dataType);
	tag.setTimestamp(timestamp);
	// get data bytes
	IoBuffer data = ((IStreamData<?>) msg).getData().duplicate();
	if (data != null) {
		tag.setBodySize(data.limit());
		tag.setBody(data);
	}
	// only allow blank tags if they are of audio type
	if (tag.getBodySize() > 0 || dataType == ITag.TYPE_AUDIO) {
		try {
			if (timestamp >= 0) {
				if (!writer.writeTag(tag)) {
					log.warn("Tag was not written");
				}
			} else {
				log.warn("Skipping message with negative timestamp.");
			}
		} catch (IOException e) {
			log.error("Error writing tag", e);
		} finally {
			if (data != null) {
				data.clear();
				data.free();
			}
		}
	}
	data = null;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:48,代码来源:FileConsumer.java


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