Java Code Examples for org.red5.server.net.rtmp.event.IRTMPEvent#setTimestamp()
The following examples show how to use
org.red5.server.net.rtmp.event.IRTMPEvent#setTimestamp() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayEngine.java From red5-server-common with Apache License 2.0 | 5 votes |
/** * Performs the processes needed for VOD / pre-recorded streams. * * @param withReset * whether or not to perform reset on the stream * @param itemLength * length of the item to be played * @return message for the consumer * @throws IOException */ private final IMessage playVOD(boolean withReset, long itemLength) throws IOException { IMessage msg = null; // change state subscriberStream.setState(StreamState.PLAYING); if (withReset) { releasePendingMessage(); } sendVODInitCM(currentItem.get()); // Don't use pullAndPush to detect IOExceptions prior to sending NetStream.Play.Start int start = (int) currentItem.get().getStart(); if (start > 0) { streamOffset = sendVODSeekCM(start); // We seeked to the nearest keyframe so use real timestamp now if (streamOffset == -1) { streamOffset = start; } } IMessageInput in = msgInReference.get(); msg = in.pullMessage(); if (msg instanceof RTMPMessage) { // Only send first video frame IRTMPEvent body = ((RTMPMessage) msg).getBody(); if (itemLength == 0) { while (body != null && !(body instanceof VideoData)) { msg = in.pullMessage(); if (msg != null && msg instanceof RTMPMessage) { body = ((RTMPMessage) msg).getBody(); } else { break; } } } if (body != null) { // Adjust timestamp when playing lists body.setTimestamp(body.getTimestamp() + timestampOffset); } } return msg; }
Example 2
Source File: Packet.java From red5-server-common with Apache License 2.0 | 4 votes |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { header = (Header) in.readObject(); message = (IRTMPEvent) in.readObject(); message.setHeader(header); message.setTimestamp(header.getTimer()); }
Example 3
Source File: AxisTest.java From red5-rtsp-restreamer with Apache License 2.0 | 4 votes |
private void sendAVCDecoderConfig(int timecode) { IoBuffer buffV = IoBuffer.allocate(_pCodecSetup.length); buffV.setAutoExpand(true); for (int p = 0; p < _pCodecSetup.length; p++) buffV.put((byte) _pCodecSetup[p]); buffV.flip(); buffV.position(0); IRTMPEvent video = new VideoData(buffV); video.setTimestamp(timecode); video.setHeader(new Header()); if (output != null) output.dispatchEvent(video); }