當前位置: 首頁>>代碼示例>>Java>>正文


Java Ping.setEventType方法代碼示例

本文整理匯總了Java中org.red5.server.net.rtmp.event.Ping.setEventType方法的典型用法代碼示例。如果您正苦於以下問題:Java Ping.setEventType方法的具體用法?Java Ping.setEventType怎麽用?Java Ping.setEventType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.red5.server.net.rtmp.event.Ping的用法示例。


在下文中一共展示了Ping.setEventType方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sendReset

import org.red5.server.net.rtmp.event.Ping; //導入方法依賴的package包/類
/**
 * Send reset message
 */
private void sendReset() {
    if (pullMode) {
        Ping recorded = new Ping();
        recorded.setEventType(Ping.RECORDED_STREAM);
        recorded.setValue2(streamId);
        // recorded 
        RTMPMessage recordedMsg = RTMPMessage.build(recorded);
        doPushMessage(recordedMsg);
    }
    Ping begin = new Ping();
    begin.setEventType(Ping.STREAM_BEGIN);
    begin.setValue2(streamId);
    // begin 
    RTMPMessage beginMsg = RTMPMessage.build(begin);
    doPushMessage(beginMsg);
    // reset
    ResetMessage reset = new ResetMessage();
    doPushMessage(reset);
}
 
開發者ID:Red5,項目名稱:red5-server-common,代碼行數:23,代碼來源:PlayEngine.java

示例2: ping

import org.red5.server.net.rtmp.event.Ping; //導入方法依賴的package包/類
/** {@inheritDoc} */
public void ping() {
    long newPingTime = System.currentTimeMillis();
    if (log.isDebugEnabled()) {
        log.debug("Send Ping: session=[{}], currentTime=[{}], lastPingTime=[{}]", new Object[] { getSessionId(), newPingTime, lastPingSentOn.get() });
    }
    if (lastPingSentOn.get() == 0) {
        lastPongReceivedOn.set(newPingTime);
    }
    Ping pingRequest = new Ping();
    pingRequest.setEventType(Ping.PING_CLIENT);
    lastPingSentOn.set(newPingTime);
    int now = (int) (newPingTime & 0xffffffffL);
    pingRequest.setValue2(now);
    ping(pingRequest);
}
 
開發者ID:Red5,項目名稱:red5-server-common,代碼行數:17,代碼來源:RTMPConnection.java

示例3: sendReset

import org.red5.server.net.rtmp.event.Ping; //導入方法依賴的package包/類
/**
 * Send reset message
 */
private void sendReset() {
	if (pullMode) {
		Ping recorded = new Ping();
		recorded.setEventType(Ping.RECORDED_STREAM);
		recorded.setValue2(streamId);
		// recorded 
		RTMPMessage recordedMsg = RTMPMessage.build(recorded);
		doPushMessage(recordedMsg);
	}

	Ping begin = new Ping();
	begin.setEventType(Ping.STREAM_BEGIN);
	begin.setValue2(streamId);
	// begin 
	RTMPMessage beginMsg = RTMPMessage.build(begin);
	doPushMessage(beginMsg);
	// reset
	ResetMessage reset = new ResetMessage();
	doPushMessage(reset);
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:24,代碼來源:PlayEngine.java

示例4: sendClearPing

import org.red5.server.net.rtmp.event.Ping; //導入方法依賴的package包/類
/**
 * Send clear ping. Lets client know that stream has no more data to send.
 */
private void sendClearPing() {
    Ping eof = new Ping();
    eof.setEventType(Ping.STREAM_PLAYBUFFER_CLEAR);
    eof.setValue2(streamId);
    // eos 
    RTMPMessage eofMsg = RTMPMessage.build(eof);
    doPushMessage(eofMsg);
}
 
開發者ID:Red5,項目名稱:red5-server-common,代碼行數:12,代碼來源:PlayEngine.java

示例5: sendClearPing

import org.red5.server.net.rtmp.event.Ping; //導入方法依賴的package包/類
/**
 * Send clear ping. Lets client know that stream has no more data to
 * send.
 */
private void sendClearPing() {
	Ping eof = new Ping();
	eof.setEventType(Ping.STREAM_PLAYBUFFER_CLEAR);
	eof.setValue2(streamId);
	// eos 
	RTMPMessage eofMsg = RTMPMessage.build(eof);
	doPushMessage(eofMsg);
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:13,代碼來源:PlayEngine.java

示例6: ping

import org.red5.server.net.rtmp.event.Ping; //導入方法依賴的package包/類
/** {@inheritDoc} */
public void ping() {
	long newPingTime = System.currentTimeMillis();
	log.debug("Pinging client with id {} at {}, last ping sent at {}", new Object[] { getId(), newPingTime, lastPingSent.get() });
	if (lastPingSent.get() == 0) {
		lastPongReceived.set(newPingTime);
	}
	Ping pingRequest = new Ping();
	pingRequest.setEventType(Ping.PING_CLIENT);
	lastPingSent.set(newPingTime);
	int now = (int) (newPingTime & 0xffffffff);
	pingRequest.setValue2(now);
	ping(pingRequest);
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:15,代碼來源:RTMPConnection.java

示例7: onPing

import org.red5.server.net.rtmp.event.Ping; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
protected void onPing(RTMPConnection conn, Channel channel, Header source, Ping ping) {
    log.trace("onPing");
    switch (ping.getEventType()) {
        case Ping.PING_CLIENT:
        case Ping.STREAM_BEGIN:
        case Ping.RECORDED_STREAM:
        case Ping.STREAM_PLAYBUFFER_CLEAR:
            // the server wants to measure the RTT
            Ping pong = new Ping();
            pong.setEventType(Ping.PONG_SERVER);
            pong.setValue2((int) (System.currentTimeMillis() & 0xffffffff));
            conn.ping(pong);
            break;
        case Ping.STREAM_DRY:
            log.debug("Stream indicates there is no data available");
            break;
        case Ping.CLIENT_BUFFER:
            // set the client buffer
            IClientStream stream = null;
            // get the stream id
            Number streamId = ping.getValue2();
            // get requested buffer size in milliseconds
            int buffer = ping.getValue3();
            log.debug("Client sent a buffer size: {} ms for stream id: {}", buffer, streamId);
            // the client wants to set the buffer time
            stream = conn.getStreamById(streamId);
            if (stream != null) {
                stream.setClientBufferDuration(buffer);
                log.info("Setting client buffer on stream: {}", buffer);
            }
            // catch-all to make sure buffer size is set
            if (stream == null) {
                // remember buffer time until stream is created
                conn.rememberStreamBufferDuration(streamId.intValue(), buffer);
                log.info("Remembering client buffer on stream: {}", buffer);
            }
            break;
        case Ping.PING_SWF_VERIFY:
            log.debug("SWF verification ping");
            // TODO get the swf verification bytes from the handshake
            SWFResponse swfPong = new SWFResponse(new byte[42]);
            conn.ping(swfPong);
            break;
        case Ping.BUFFER_EMPTY:
            log.debug("Buffer empty ping");

            break;
        case Ping.BUFFER_FULL:
            log.debug("Buffer full ping");

            break;
        default:
            log.warn("Unhandled ping: {}", ping);
    }
}
 
開發者ID:Red5,項目名稱:red5-client,代碼行數:58,代碼來源:BaseRTMPClientHandler.java


注:本文中的org.red5.server.net.rtmp.event.Ping.setEventType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。