org.red5.server.api.service.IServiceCapableConnection Java Examples

The following examples show how to use org.red5.server.api.service.IServiceCapableConnection. 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: ServerClientDetection.java    From red5-server-common with Apache License 2.0 6 votes vote down vote up
private void callBWCheck(Object payload) {
    if (log.isTraceEnabled()) {
        log.trace("callBWCheck: {}", payload);
    } else {
        log.debug("callBWCheck");
    }
    IConnection conn = Red5.getConnectionLocal();
    Map<String, Object> statsValues = new HashMap<String, Object>();
    statsValues.put("count", packetsReceived.get());
    statsValues.put("sent", packetsSent.get());
    statsValues.put("timePassed", timePassed);
    statsValues.put("latency", latency);
    statsValues.put("cumLatency", cumLatency);
    statsValues.put("payload", payload);
    if (conn instanceof IServiceCapableConnection) {
        log.debug("Invoking onBWCheck on the client");
        // increment sent counter
        packetsSent.incrementAndGet();
        // invoke on the client
        ((IServiceCapableConnection) conn).invoke("onBWCheck", new Object[] { statsValues }, this);
    }
}
 
Example #2
Source File: ServerClientDetection.java    From red5-server-common with Apache License 2.0 6 votes vote down vote up
private void callBWDone() {
    log.debug("callBWDone");
    IConnection conn = Red5.getConnectionLocal();
    Map<String, Object> statsValues = new HashMap<String, Object>();
    statsValues.put("kbitDown", kbitDown);
    statsValues.put("deltaDown", deltaDown);
    statsValues.put("deltaTime", deltaTime);
    statsValues.put("latency", latency);
    if (conn instanceof IServiceCapableConnection) {
        log.debug("Invoking onBWDone on the client");
        // invoke on the client
        ((IServiceCapableConnection) conn).invoke("onBWDone", new Object[] { statsValues });
        // adjust bandwidth to mbit/s
        int mbits = (int) ((kbitDown / 1000d) * 1000000);
        log.debug("Setting bandwidth to {} mbit/s", mbits);
        // tell the flash player how fast we want data and how fast we shall send it
        conn.setBandwidth(mbits);
    }
}
 
Example #3
Source File: ServerClientDetection.java    From red5-examples with Apache License 2.0 6 votes vote down vote up
private void callBWCheck(Object payload)
{
	IConnection conn = Red5.getConnectionLocal();
	

	Map<String, Object> statsValues = new HashMap<String, Object>();
	statsValues.put("count", this.count);
	statsValues.put("sent", this.sent);
	statsValues.put("timePassed", this.timePassed);
	statsValues.put("latency", this.latency);
	statsValues.put("cumLatency", this.cumLatency);
	statsValues.put("payload", payload);
	
	if (conn instanceof IServiceCapableConnection) {
		((IServiceCapableConnection) conn).invoke("onBWCheck", new Object[]{statsValues}, this);
	}
}
 
Example #4
Source File: ServerClientDetection.java    From red5-examples with Apache License 2.0 5 votes vote down vote up
private void callBWDone()
{
	IConnection conn = Red5.getConnectionLocal();
	
	Map<String, Object> statsValues = new HashMap<String, Object>();
	statsValues.put("kbitDown", this.kbitDown);
	statsValues.put("deltaDown", this.deltaDown);
	statsValues.put("deltaTime", this.deltaTime);
	statsValues.put("latency", this.latency);
	
	if (conn instanceof IServiceCapableConnection) {
		((IServiceCapableConnection) conn).invoke("onBWDone", new Object[]{statsValues});
	}
}
 
Example #5
Source File: BandwidthChecker.java    From red5-rtsp-restreamer with Apache License 2.0 4 votes vote down vote up
private IServiceCapableConnection endpoint() {
	return (IServiceCapableConnection) connection;
}