org.red5.server.net.rtmpt
Class BaseRTMPTConnection

java.lang.Object
  extended by org.red5.server.AttributeStore
      extended by org.red5.server.BaseConnection
          extended by org.red5.server.net.rtmp.RTMPConnection
              extended by org.red5.server.net.rtmpt.BaseRTMPTConnection
All Implemented Interfaces:
IEventDispatcher, IEventHandler, IEventListener, IAttributeStore, ICastingAttributeStore, IConnection, ICoreObject, IServiceCapableConnection, IStreamCapableConnection, AttributeStoreMXBean
Direct Known Subclasses:
RTMPTConnection

public abstract class BaseRTMPTConnection
extends RTMPConnection

Base RTMPT client / session.

Author:
The Red5 Project ([email protected]), Paul Gregoire ([email protected])

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.red5.server.api.IConnection
IConnection.Encoding
 
Field Summary
protected  IRTMPHandler handler
          RTMP events handler
protected  int maxInMessagesPerProcess
          Maximum incoming messages to process at a time per client
protected  int maxQueueOfferAttempts
          Maximum offer attempts before failing on incoming or outgoing queues
protected  long maxQueueOfferTime
          Maximum amount of time in milliseconds to wait before allowing an offer to fail
protected  LinkedBlockingQueue<Object> pendingInMessages
          List of pending incoming messages
protected  LinkedBlockingQueue<org.red5.server.net.rtmpt.BaseRTMPTConnection.PendingData> pendingOutMessages
          List of pending outgoing messages
 
Fields inherited from class org.red5.server.net.rtmp.RTMPConnection
bytesReadInterval, clientId, limitType, nextBytesRead, RTMP_CONNECTION_KEY, RTMP_ENCRYPTED, RTMP_HANDSHAKE, RTMP_NON_ENCRYPTED, RTMPE_CIPHER_IN, RTMPE_CIPHER_OUT, schedulingService, state
 
Fields inherited from class org.red5.server.BaseConnection
basicScopes, client, closed, connectionListeners, droppedMessages, host, params, path, readMessages, remoteAddress, remoteAddresses, remotePort, scope, sessionId, type, writtenMessages
 
Fields inherited from class org.red5.server.AttributeStore
attributes
 
Fields inherited from interface org.red5.server.api.IConnection
PERSISTENT, POLLING, TRANSIENT
 
Constructor Summary
BaseRTMPTConnection(String type)
           
 
Method Summary
 void close()
          Closes connection
 List<?> decode(IoBuffer data)
          Decode data sent by the client.
protected  IoBuffer foldPendingMessages(int targetSize)
           
 long getPendingMessages()
          Count of outgoing messages not yet written.
abstract  IoBuffer getPendingMessages(int targetSize)
          Return any pending messages up to a given size.
 long getReadBytes()
          Total number of bytes read from the connection.
 long getWrittenBytes()
          Total number of bytes written to the connection.
 boolean isClosing()
          Getter for property 'closing'.
 void read(IoBuffer ioBuffer)
          Receive RTMP IoBuffer from the connection.
 void read(List<?> messages)
          Receive a collection of RTMP messages.
 void read(Packet packet)
          Receive RTMP packet from the connection.
 void realClose()
          Real close
 void setDecoder(RTMPProtocolDecoder decoder)
           
 void setEncoder(RTMPProtocolEncoder encoder)
           
 void setHandler(IRTMPHandler handler)
           
 void setMaxInMessagesPerProcess(int maxInMessagesPerProcess)
           
 void setMaxQueueOfferAttempts(int maxQueueOfferAttempts)
           
 void setMaxQueueOfferTime(long maxQueueOfferTime)
           
 void write(Packet packet)
          Send RTMP packet down the connection.
 void writeRaw(IoBuffer packet)
          Send raw data down the connection.
 
Methods inherited from class org.red5.server.net.rtmp.RTMPConnection
addClientStream, closeChannel, connect, createOutputStream, createStreamName, deleteStreamById, equals, getChannel, getClientBytesRead, getEncoding, getId, getInvokeId, getLastPingTime, getNextAvailableChannelId, getPendingCall, getPendingVideoMessages, getState, getStateCode, getStreamByChannelId, getStreamById, getStreamIdForChannel, getStreams, getTimer, getUsedStreamCount, hashCode, invoke, invoke, invoke, invoke, invoke, invoke, isChannelUsed, isValidStreamId, messageDropped, messageReceived, messageSent, newBroadcastStream, newPlaylistSubscriberStream, newSingleItemSubscriberStream, notify, notify, notify, notify, onInactive, ping, ping, pingReceived, receivedBytesRead, registerDeferredResult, registerPendingCall, rememberStreamBufferDuration, removeClientStream, reserveStreamId, reserveStreamId, retrievePendingCall, sendPendingServiceCallsCloseError, sendSharedObjectMessage, setBandwidth, setId, setMaxHandshakeTimeout, setMaxInactivity, setPingInterval, setSchedulingService, setState, setStateCode, setup, startRoundTripMeasurement, startWaitForHandshake, status, status, toString, unregisterDeferredResult, unreserveStreamId, updateBytesRead, writingMessage
 
Methods inherited from class org.red5.server.BaseConnection
addListener, connect, dispatchEvent, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getHost, getLock, getNextClientId, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getType, getWrittenMessages, handleEvent, initialize, isConnected, isReaderIdle, isWriterIdle, notifyEvent, registerBasicScope, removeListener, unregisterBasicScope
 
Methods inherited from class org.red5.server.AttributeStore
filterNull, from, getAttribute, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes, size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.red5.server.api.IConnection
addListener, connect, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getHost, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getType, getWrittenMessages, initialize, isConnected, removeListener
 
Methods inherited from interface org.red5.server.api.event.IEventDispatcher
dispatchEvent
 
Methods inherited from interface org.red5.server.api.event.IEventHandler
handleEvent
 
Methods inherited from interface org.red5.server.api.event.IEventListener
notifyEvent
 
Methods inherited from interface org.red5.server.api.ICastingAttributeStore
getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute
 
Methods inherited from interface org.red5.server.api.IAttributeStore
getAttribute, getAttribute, getAttributeNames, getAttributes, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes, size
 

Field Detail

handler

protected IRTMPHandler handler
RTMP events handler


pendingInMessages

protected volatile LinkedBlockingQueue<Object> pendingInMessages
List of pending incoming messages


pendingOutMessages

protected volatile LinkedBlockingQueue<org.red5.server.net.rtmpt.BaseRTMPTConnection.PendingData> pendingOutMessages
List of pending outgoing messages


maxInMessagesPerProcess

protected int maxInMessagesPerProcess
Maximum incoming messages to process at a time per client


maxQueueOfferTime

protected long maxQueueOfferTime
Maximum amount of time in milliseconds to wait before allowing an offer to fail


maxQueueOfferAttempts

protected int maxQueueOfferAttempts
Maximum offer attempts before failing on incoming or outgoing queues

Constructor Detail

BaseRTMPTConnection

public BaseRTMPTConnection(String type)
Method Detail

getPendingMessages

public abstract IoBuffer getPendingMessages(int targetSize)
Return any pending messages up to a given size.

Parameters:
targetSize - the size the resulting buffer should have
Returns:
a buffer containing the data to send or null if no messages are pending

close

public void close()
Closes connection

Specified by:
close in interface IConnection
Overrides:
close in class RTMPConnection

isClosing

public boolean isClosing()
Getter for property 'closing'.

Returns:
Value for property 'closing'.

realClose

public void realClose()
Real close


getReadBytes

public long getReadBytes()
Total number of bytes read from the connection.

Specified by:
getReadBytes in interface IConnection
Overrides:
getReadBytes in class RTMPConnection
Returns:
bytes read

getWrittenBytes

public long getWrittenBytes()
Total number of bytes written to the connection.

Specified by:
getWrittenBytes in interface IConnection
Overrides:
getWrittenBytes in class RTMPConnection
Returns:
bytes written

getPendingMessages

public long getPendingMessages()
Count of outgoing messages not yet written.

Specified by:
getPendingMessages in interface IConnection
Overrides:
getPendingMessages in class BaseConnection
Returns:
pending messages

decode

public List<?> decode(IoBuffer data)
Decode data sent by the client.

Parameters:
data - the data to decode
Returns:
a list of decoded objects

read

public void read(List<?> messages)
Receive a collection of RTMP messages.

Parameters:
messages -

read

public void read(IoBuffer ioBuffer)
Receive RTMP IoBuffer from the connection.

Parameters:
ioBuffer - the I/O buffer to receive

read

public void read(Packet packet)
Receive RTMP packet from the connection.

Parameters:
packet - the packet to receive

write

public void write(Packet packet)
Send RTMP packet down the connection.

Specified by:
write in class RTMPConnection
Parameters:
packet - the packet to send

writeRaw

public void writeRaw(IoBuffer packet)
Send raw data down the connection.

Specified by:
writeRaw in class RTMPConnection
Parameters:
packet - the buffer containing the raw data

foldPendingMessages

protected IoBuffer foldPendingMessages(int targetSize)

setHandler

public void setHandler(IRTMPHandler handler)

setDecoder

public void setDecoder(RTMPProtocolDecoder decoder)

setEncoder

public void setEncoder(RTMPProtocolEncoder encoder)

setMaxInMessagesPerProcess

public void setMaxInMessagesPerProcess(int maxInMessagesPerProcess)
Parameters:
maxInMessagesPerProcess - the maxInMessagesPerProcess to set

setMaxQueueOfferTime

public void setMaxQueueOfferTime(long maxQueueOfferTime)
Parameters:
maxQueueOfferTime - the maxQueueOfferTime to set

setMaxQueueOfferAttempts

public void setMaxQueueOfferAttempts(int maxQueueOfferAttempts)
Parameters:
maxQueueOfferAttempts - the maxQueueOfferAttempts to set


Copyright © 2006-2012 The Red5 Project