org.red5.server.messaging.PipeConnectionEvent Java Examples

The following examples show how to use org.red5.server.messaging.PipeConnectionEvent. 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: SlicedFileConsumer.java    From red5-server-common with Apache License 2.0 5 votes vote down vote up
/**
 * Pipe connection event handler
 * 
 * @param event
 *            Pipe connection event
 */
@SuppressWarnings("incomplete-switch")
public void onPipeConnectionEvent(PipeConnectionEvent event) {
    switch (event.getType()) {
        case CONSUMER_CONNECT_PUSH:
            if (event.getConsumer() == this) {
                Map<String, Object> paramMap = event.getParamMap();
                if (paramMap != null) {
                    mode = (String) paramMap.get("mode");
                }
            }
            break;
    }
}
 
Example #2
Source File: FileConsumer.java    From red5-server-common with Apache License 2.0 5 votes vote down vote up
/**
 * Pipe connection event handler
 *
 * @param event
 *            Pipe connection event
 */
@SuppressWarnings("incomplete-switch")
public void onPipeConnectionEvent(PipeConnectionEvent event) {
    switch (event.getType()) {
        case CONSUMER_CONNECT_PUSH:
            if (event.getConsumer() == this) {
                Map<String, Object> paramMap = event.getParamMap();
                if (paramMap != null) {
                    mode = (String) paramMap.get("mode");
                }
            }
            break;
    }
}
 
Example #3
Source File: PlayEngine.java    From red5-server-common with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
public void onPipeConnectionEvent(PipeConnectionEvent event) {
    switch (event.getType()) {
        case PROVIDER_CONNECT_PUSH:
            if (event.getProvider() != this) {
                if (waitLiveJob != null) {
                    schedulingService.removeScheduledJob(waitLiveJob);
                    waitLiveJob = null;
                }
                sendPublishedStatus(currentItem.get());
            }
            break;
        case PROVIDER_DISCONNECT:
            if (pullMode) {
                sendStopStatus(currentItem.get());
            } else {
                sendUnpublishedStatus(currentItem.get());
            }
            break;
        case CONSUMER_CONNECT_PULL:
            if (event.getConsumer() == this) {
                pullMode = true;
            }
            break;
        case CONSUMER_CONNECT_PUSH:
            if (event.getConsumer() == this) {
                pullMode = false;
            }
            break;
        default:
            if (log.isDebugEnabled()) {
                log.debug("Unhandled pipe event: {}", event);
            }
    }
}
 
Example #4
Source File: ICYStream.java    From red5-rtsp-restreamer with Apache License 2.0 5 votes vote down vote up
@Override
public void onPipeConnectionEvent(PipeConnectionEvent event) {
	switch (event.getType()) {
		case PipeConnectionEvent.PROVIDER_CONNECT_PUSH:
			if ((event.getProvider() == this) && (event.getParamMap() == null)) {
				mLivePipe = (IPipe) event.getSource();
				log.debug("mLivePipe {}", mLivePipe);
				for (@SuppressWarnings("unused")
				IConsumer consumer : mLivePipe.getConsumers()) {
					subscriberStats.increment();
				}
			}
			break;
		case PipeConnectionEvent.PROVIDER_DISCONNECT:
			if (mLivePipe == event.getSource()) {
				mLivePipe = null;
			}
			break;
		case PipeConnectionEvent.CONSUMER_CONNECT_PUSH:
			if (mLivePipe != null) {
				List<IConsumer> consumers = mLivePipe.getConsumers();
				int count = consumers.size();
				if (count > 0) {
					newComsumers.add(consumers.get(count - 1));
				}
				subscriberStats.increment();
			}
			break;

		case PipeConnectionEvent.CONSUMER_DISCONNECT:
			subscriberStats.decrement();
			break;
		default:
			break;
	}
}
 
Example #5
Source File: ConnectionConsumer.java    From red5-server-common with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
public void onPipeConnectionEvent(PipeConnectionEvent event) {
    if (event.getType().equals(PipeConnectionEvent.EventType.PROVIDER_DISCONNECT)) {
        closeChannels();
    }
}
 
Example #6
Source File: ClientBroadcastStream.java    From red5-server-common with Apache License 2.0 4 votes vote down vote up
/**
 * Pipe connection event handler
 * 
 * @param event
 *            Pipe connection event
 */
@SuppressWarnings("unused")
public void onPipeConnectionEvent(PipeConnectionEvent event) {
    switch (event.getType()) {
        case PROVIDER_CONNECT_PUSH:
            //log.debug("Provider connect");
            if (event.getProvider() == this && event.getSource() != connMsgOut && (event.getParamMap() == null || !event.getParamMap().containsKey("record"))) {
                livePipe = (IPipe) event.getSource();
                //log.debug("Provider: {}", livePipe.getClass().getName());
                for (IConsumer consumer : livePipe.getConsumers()) {
                    subscriberStats.increment();
                }
            }
            break;
        case PROVIDER_DISCONNECT:
            //log.debug("Provider disconnect");
            //if (log.isDebugEnabled() && livePipe != null) {
            //log.debug("Provider: {}", livePipe.getClass().getName());
            //}
            if (livePipe == event.getSource()) {
                livePipe = null;
            }
            break;
        case CONSUMER_CONNECT_PUSH:
            //log.debug("Consumer connect");
            IPipe pipe = (IPipe) event.getSource();
            //if (log.isDebugEnabled() && pipe != null) {
            //log.debug("Consumer: {}", pipe.getClass().getName());
            //}
            if (livePipe == pipe) {
                notifyChunkSize();
            }
            subscriberStats.increment();
            break;
        case CONSUMER_DISCONNECT:
            //log.debug("Consumer disconnect: {}", event.getSource().getClass().getName());
            subscriberStats.decrement();
            break;
        default:
    }
}
 
Example #7
Source File: StreamingProxy.java    From red5-client with Apache License 2.0 4 votes vote down vote up
@Override
public void onPipeConnectionEvent(PipeConnectionEvent event) {
    log.debug("onPipeConnectionEvent: {}", event);
}