本文整理汇总了Java中org.red5.server.net.rtmp.message.Header.setChannelId方法的典型用法代码示例。如果您正苦于以下问题:Java Header.setChannelId方法的具体用法?Java Header.setChannelId怎么用?Java Header.setChannelId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.red5.server.net.rtmp.message.Header
的用法示例。
在下文中一共展示了Header.setChannelId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import org.red5.server.net.rtmp.message.Header; //导入方法依赖的package包/类
/**
* Writes packet from event data to RTMP connection and stream id.
*
* @param event
* Event data
* @param streamId
* Stream id
*/
private void write(IRTMPEvent event, Number streamId) {
log.trace("write to stream id: {} channel: {}", streamId, id);
final Header header = new Header();
final Packet packet = new Packet(header, event);
// set the channel id
header.setChannelId(id);
int ts = event.getTimestamp();
if (ts != 0) {
header.setTimer(event.getTimestamp());
}
header.setStreamId(streamId);
header.setDataType(event.getDataType());
// should use RTMPConnection specific method..
//log.trace("Connection type for write: {}", connection.getClass().getName());
connection.write(packet);
}
示例2: write
import org.red5.server.net.rtmp.message.Header; //导入方法依赖的package包/类
/**
* Writes packet from event data to RTMP connection and stream id.
*
* @param event Event data
* @param streamId Stream id
*/
private void write(IRTMPEvent event, int streamId) {
log.trace("write channel: {} stream id: {}", id, streamId);
final Header header = new Header();
final Packet packet = new Packet(header, event);
header.setChannelId(id);
int ts = event.getTimestamp();
if (ts != 0) {
header.setTimer(event.getTimestamp());
} else {
// TODO may need to add generated timestamps at some point
// int timestamp = connection.getTimer();
// header.setTimerBase(timestamp);
// event.setTimestamp(timestamp);
}
header.setStreamId(streamId);
header.setDataType(event.getDataType());
// should use RTMPConnection specific method..
//log.trace("Connection type for write: {}", connection.getClass().getName());
connection.write(packet);
}
示例3: testHeaders
import org.red5.server.net.rtmp.message.Header; //导入方法依赖的package包/类
public void testHeaders() {
RTMP rtmp = new RTMP();
Header header = new Header();
header.setChannelId((byte) 0x12);
header.setDataType(TYPE_INVOKE);
header.setStreamId(100);
header.setTimer(2);
header.setSize(320);
IoBuffer buf = encoder.encodeHeader(rtmp, header, null);
buf.flip();
log.debug(buf.getHexDump());
Assert.assertNotNull(buf);
Header result = decoder.decodeHeader(buf, null);
Assert.assertEquals(header, result);
}