本文整理汇总了Java中org.red5.server.messaging.InMemoryPushPushPipe类的典型用法代码示例。如果您正苦于以下问题:Java InMemoryPushPushPipe类的具体用法?Java InMemoryPushPushPipe怎么用?Java InMemoryPushPushPipe使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InMemoryPushPushPipe类属于org.red5.server.messaging包,在下文中一共展示了InMemoryPushPushPipe类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.red5.server.messaging.InMemoryPushPushPipe; //导入依赖的package包/类
/**
* Start this server-side stream
*/
public void start() {
if (state != State.UNINIT) {
throw new IllegalStateException("State " + state + " not valid to start");
}
if (items.size() == 0) {
throw new IllegalStateException("At least one item should be specified to start");
}
if (publishedName == null) {
throw new IllegalStateException("A published name is needed to start");
}
// publish this server-side stream
IProviderService providerService = (IProviderService) getScope().getContext().getBean(IProviderService.BEAN_NAME);
providerService.registerBroadcastStream(getScope(), publishedName, this);
Map<String, Object> recordParamMap = new HashMap<String, Object>();
recordPipe = new InMemoryPushPushPipe();
recordParamMap.put("record", null);
recordPipe.subscribe((IProvider) this, recordParamMap);
recordingFilename = null;
scheduler = (ISchedulingService) getScope().getContext().getBean(ISchedulingService.BEAN_NAME);
state = State.STOPPED;
currentItemIndex = -1;
nextItem();
}
示例2: close
import org.red5.server.messaging.InMemoryPushPushPipe; //导入依赖的package包/类
/**
* Close stream
*/
public void close() {
if (log.isDebugEnabled()) {
log.debug("close");
}
if (!subscriberStream.getState().equals(StreamState.CLOSED)) {
IMessageInput in = msgInReference.get();
if (in != null) {
in.unsubscribe(this);
msgInReference.set(null);
}
subscriberStream.setState(StreamState.CLOSED);
clearWaitJobs();
releasePendingMessage();
lastMessageTs = 0;
// XXX is clear ping required?
//sendClearPing();
InMemoryPushPushPipe out = (InMemoryPushPushPipe) msgOutReference.get();
if (out != null) {
List<IConsumer> consumers = out.getConsumers();
// assume a list of 1 in most cases
if (log.isDebugEnabled()) {
log.debug("Message out consumers: {}", consumers.size());
}
if (!consumers.isEmpty()) {
for (IConsumer consumer : consumers) {
out.unsubscribe(consumer);
}
}
msgOutReference.set(null);
}
} else {
log.debug("Stream is already in closed state");
}
}
示例3: getConsumerOutput
import org.red5.server.messaging.InMemoryPushPushPipe; //导入依赖的package包/类
/** {@inheritDoc} */
public IMessageOutput getConsumerOutput(IClientStream stream) {
IStreamCapableConnection streamConn = stream.getConnection();
if (streamConn != null && streamConn instanceof RTMPConnection) {
RTMPConnection conn = (RTMPConnection) streamConn;
// TODO Better manage channels.
// now we use OutputStream as a channel wrapper.
OutputStream o = conn.createOutputStream(stream.getStreamId());
IPipe pipe = new InMemoryPushPushPipe();
pipe.subscribe(new ConnectionConsumer(conn, o.getVideo(), o.getAudio(), o.getData()), null);
return pipe;
}
return null;
}
示例4: getConsumerOutput
import org.red5.server.messaging.InMemoryPushPushPipe; //导入依赖的package包/类
/** {@inheritDoc} */
public IMessageOutput getConsumerOutput(IClientStream stream) {
IStreamCapableConnection streamConn = stream.getConnection();
if (streamConn == null || !(streamConn instanceof RTMPConnection)) {
return null;
}
RTMPConnection conn = (RTMPConnection) streamConn;
// TODO Better manage channels.
// now we use OutputStream as a channel wrapper.
OutputStream o = conn.createOutputStream(stream.getStreamId());
IPipe pipe = new InMemoryPushPushPipe();
pipe.subscribe(new ConnectionConsumer(conn, o.getVideo().getId(), o.getAudio().getId(), o.getData().getId()), null);
return pipe;
}
示例5: start
import org.red5.server.messaging.InMemoryPushPushPipe; //导入依赖的package包/类
/**
* Start this server-side stream
*/
public void start() {
if (state != StreamState.UNINIT) {
throw new IllegalStateException("State " + state + " not valid to start");
}
if (items.size() == 0) {
throw new IllegalStateException("At least one item should be specified to start");
}
if (publishedName == null) {
throw new IllegalStateException("A published name is needed to start");
}
try {
providerService = (IProviderService) getScope().getContext().getBean(IProviderService.BEAN_NAME);
// publish this server-side stream
providerService.registerBroadcastStream(getScope(), publishedName, this);
scheduler = (ISchedulingService) getScope().getContext().getBean(ISchedulingService.BEAN_NAME);
} catch (NullPointerException npe) {
log.warn("Context beans were not available; this is ok during unit testing", npe);
}
Map<String, Object> recordParamMap = new HashMap<String, Object>();
recordPipe = new InMemoryPushPushPipe();
recordParamMap.put("record", null);
recordPipe.subscribe((IProvider) this, recordParamMap);
recordingFilename = null;
setState(StreamState.STOPPED);
currentItemIndex = -1;
nextItem();
}
示例6: BroadcastScope
import org.red5.server.messaging.InMemoryPushPushPipe; //导入依赖的package包/类
/**
* Creates broadcast scope
* @param parent Parent scope
* @param name Scope name
*/
public BroadcastScope(IScope parent, String name) {
super(parent, ScopeType.BROADCAST, name, false);
pipe = new InMemoryPushPushPipe();
pipe.addPipeConnectionListener(this);
keepOnDisconnect = true;
}
示例7: BroadcastScope
import org.red5.server.messaging.InMemoryPushPushPipe; //导入依赖的package包/类
/**
* Creates broadcast scope
*
* @param parent
* Parent scope
* @param name
* Scope name
*/
public BroadcastScope(IScope parent, String name) {
super(parent, ScopeType.BROADCAST, name, false);
pipe = new InMemoryPushPushPipe(this);
keepOnDisconnect = true;
}