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


Java RTMPMessage.getBody方法代码示例

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


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

示例1: putMessage

import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/**
 * Put a message into this buffer.
 * 
 * @param message
 *            RTMP message
 * @return <tt>true</tt> indicates success and <tt>false</tt> indicates buffer is full.
 */
public boolean putMessage(RTMPMessage message) {
    IRTMPEvent body = message.getBody();
    if (!(body instanceof IStreamData)) {
        throw new RuntimeException("Expected IStreamData but got " + body);
    }
    int size = ((IStreamData<?>) body).getData().limit();
    if (messageSize + size > capacity) {
        return false;
    }
    messageSize += size;
    messageQueue.offer(message);
    return true;
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:21,代码来源:PlayBuffer.java

示例2: takeMessage

import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/**
 * Take a message from this buffer. The message count decreases.
 * 
 * @return <tt>null</tt> if buffer is empty.
 */
public RTMPMessage takeMessage() {
    RTMPMessage message = messageQueue.poll();
    if (message != null) {
        IRTMPEvent body = message.getBody();
        if (!(body instanceof IStreamData)) {
            throw new RuntimeException("Expected IStreamData but got " + body);
        }
        messageSize -= ((IStreamData<?>) body).getData().limit();
    }
    return message;
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:17,代码来源:PlayBuffer.java

示例3: putMessage

import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/**
 * Put a message into this buffer.
 * 
 * @param message          RTMP message
 * @return <tt>true</tt> indicates success and <tt>false</tt>
 * indicates buffer is full.
 */
public boolean putMessage(RTMPMessage message) {
	IRTMPEvent body = message.getBody();
	if (!(body instanceof IStreamData)) {
		throw new RuntimeException("Expected IStreamData but got " + body);
	}
	int size = ((IStreamData<?>) body).getData().limit();
	if (messageSize + size > capacity) {
		return false;
	}
	messageSize += size;
	messageQueue.offer(message);
	return true;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:21,代码来源:PlayBuffer.java

示例4: takeMessage

import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/**
 * Take a message from this buffer. The message count decreases.
 * 
 * @return <tt>null</tt> if buffer is empty.
 */
public RTMPMessage takeMessage() {
	RTMPMessage message = messageQueue.poll();
	if (message != null) {
		IRTMPEvent body = message.getBody();
		if (!(body instanceof IStreamData)) {
			throw new RuntimeException("Expected IStreamData but got " + body);
		}
		messageSize -= ((IStreamData<?>) body).getData().limit();
	}
	return message;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:17,代码来源:PlayBuffer.java

示例5: canSendPacket

import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/** {@inheritDoc} */
public boolean canSendPacket(RTMPMessage message, long pending) {
    IRTMPEvent packet = message.getBody();
    boolean result = true;
    // We currently only drop video packets.
    if (packet instanceof VideoData) {
        VideoData video = (VideoData) packet;
        FrameType type = video.getFrameType();
        switch (state) {
            case SEND_ALL:
                // All packets will be sent
                break;
            case SEND_INTERFRAMES:
                // Only keyframes and interframes will be sent.
                if (type == FrameType.KEYFRAME) {
                    if (pending == 0) {
                        // Send all frames from now on.
                        state = SEND_ALL;
                    }
                } else if (type == FrameType.INTERFRAME) {
                }
                break;
            case SEND_KEYFRAMES:
                // Only keyframes will be sent.
                result = (type == FrameType.KEYFRAME);
                if (result && pending == 0) {
                    // Maybe switch back to SEND_INTERFRAMES after the next keyframe
                    state = SEND_KEYFRAMES_CHECK;
                }
                break;
            case SEND_KEYFRAMES_CHECK:
                // Only keyframes will be sent.
                result = (type == FrameType.KEYFRAME);
                if (result && pending == 0) {
                    // Continue with sending interframes as well
                    state = SEND_INTERFRAMES;
                }
                break;
            default:
        }
    }
    return result;
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:44,代码来源:VideoFrameDropper.java

示例6: dropPacket

import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void dropPacket(RTMPMessage message) {
    IRTMPEvent packet = message.getBody();
    // Only check video packets.
    if (packet instanceof VideoData) {
        VideoData video = (VideoData) packet;
        FrameType type = video.getFrameType();
        switch (state) {
            case SEND_ALL:
                if (type == FrameType.DISPOSABLE_INTERFRAME) {
                    // Remain in state, packet is safe to drop.
                    return;
                } else if (type == FrameType.INTERFRAME) {
                    // Drop all frames until the next keyframe.
                    state = SEND_KEYFRAMES;
                    return;
                } else if (type == FrameType.KEYFRAME) {
                    // Drop all frames until the next keyframe.
                    state = SEND_KEYFRAMES;
                    return;
                }
                break;
            case SEND_INTERFRAMES:
                if (type == FrameType.INTERFRAME) {
                    // Drop all frames until the next keyframe.
                    state = SEND_KEYFRAMES_CHECK;
                    return;
                } else if (type == FrameType.KEYFRAME) {
                    // Drop all frames until the next keyframe.
                    state = SEND_KEYFRAMES;
                    return;
                }
                break;
            case SEND_KEYFRAMES:
                // Remain in state.
                break;
            case SEND_KEYFRAMES_CHECK:
                if (type == FrameType.KEYFRAME) {
                    // Switch back to sending keyframes, but don't move to
                    // SEND_INTERFRAMES afterwards.
                    state = SEND_KEYFRAMES;
                    return;
                }
                break;
            default:
        }
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:49,代码来源:VideoFrameDropper.java

示例7: canSendPacket

import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/** {@inheritDoc} */
public boolean canSendPacket(RTMPMessage message, long pending) {
	IRTMPEvent packet = message.getBody();
	boolean result = true;
	// We currently only drop video packets.
	if (packet instanceof VideoData) {
		VideoData video = (VideoData) packet;
		FrameType type = video.getFrameType();
		switch (state) {
			case SEND_ALL:
				// All packets will be sent
				break;
			case SEND_INTERFRAMES:
				// Only keyframes and interframes will be sent.
				if (type == FrameType.KEYFRAME) {
					if (pending == 0) {
						// Send all frames from now on.
						state = SEND_ALL;
					}
				} else if (type == FrameType.INTERFRAME) {
				}
				break;
			case SEND_KEYFRAMES:
				// Only keyframes will be sent.
				result = (type == FrameType.KEYFRAME);
				if (result && pending == 0) {
					// Maybe switch back to SEND_INTERFRAMES after the next keyframe
					state = SEND_KEYFRAMES_CHECK;
				}
				break;
			case SEND_KEYFRAMES_CHECK:
				// Only keyframes will be sent.
				result = (type == FrameType.KEYFRAME);
				if (result && pending == 0) {
					// Continue with sending interframes as well
					state = SEND_INTERFRAMES;
				}
				break;
			default:
		}
	}
	return result;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:44,代码来源:VideoFrameDropper.java

示例8: dropPacket

import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void dropPacket(RTMPMessage message) {
	IRTMPEvent packet = message.getBody();
	// Only check video packets.
	if (packet instanceof VideoData) {
		VideoData video = (VideoData) packet;
		FrameType type = video.getFrameType();
		switch (state) {
			case SEND_ALL:
				if (type == FrameType.DISPOSABLE_INTERFRAME) {
					// Remain in state, packet is safe to drop.
					return;
				} else if (type == FrameType.INTERFRAME) {
					// Drop all frames until the next keyframe.
					state = SEND_KEYFRAMES;
					return;
				} else if (type == FrameType.KEYFRAME) {
					// Drop all frames until the next keyframe.
					state = SEND_KEYFRAMES;
					return;
				}
				break;
			case SEND_INTERFRAMES:
				if (type == FrameType.INTERFRAME) {
					// Drop all frames until the next keyframe.
					state = SEND_KEYFRAMES_CHECK;
					return;
				} else if (type == FrameType.KEYFRAME) {
					// Drop all frames until the next keyframe.
					state = SEND_KEYFRAMES;
					return;
				}
				break;
			case SEND_KEYFRAMES:
				// Remain in state.
				break;
			case SEND_KEYFRAMES_CHECK:
				if (type == FrameType.KEYFRAME) {
					// Switch back to sending keyframes, but don't move to
					// SEND_INTERFRAMES afterwards.
					state = SEND_KEYFRAMES;
					return;
				}
				break;
			default:
		}
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:49,代码来源:VideoFrameDropper.java


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