|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.red5.server.AttributeStore
org.red5.server.BaseConnection
org.red5.server.net.rtmp.RTMPConnection
public abstract class RTMPConnection
RTMP connection. Stores information about client streams, data transfer channels, pending RPC calls, bandwidth configuration, used encoding (AMF0/AMF3), connection state (is alive, last ping time and ping result) and session.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.red5.server.api.IConnection |
|---|
IConnection.Encoding |
| Field Summary | |
|---|---|
protected int |
clientId
|
static String |
RTMP_CONNECTION_KEY
|
protected RTMP |
state
protocol state |
| Fields inherited from class org.red5.server.BaseConnection |
|---|
basicScopes, client, closed, 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 | |
|---|---|
RTMPConnection(String type)
Creates anonymous RTMP connection without scope. |
|
| Method Summary | |
|---|---|
void |
addClientStream(IClientStream stream)
|
void |
close()
Closes connection |
void |
closeChannel(int channelId)
Closes channel. |
boolean |
connect(IScope newScope,
Object[] params)
Connect to another scope on server with given parameters |
OutputStream |
createOutputStream(int streamId)
Creates output stream object from stream id. |
protected String |
createStreamName()
Generates new stream name. |
void |
deleteStreamById(int streamId)
Deletes the stream with the given id. |
IBandwidthConfigure |
getBandwidthConfigure()
Return bandwidth configuration object. |
Channel |
getChannel(int channelId)
Return channel by id. |
long |
getClientBytesRead()
Get number of bytes the client reported to have received. |
IConnection.Encoding |
getEncoding()
Return AMF protocol encoding used by this connection. |
int |
getId()
|
int |
getInvokeId()
Generate next invoke id. |
int |
getLastPingTime()
Return roundtrip time of last ping command. |
int |
getNextAvailableChannelId()
Getter for next available channel id. |
IBWControllable |
getParentBWControllable()
Return parent IFlowControllable object |
protected IPendingServiceCall |
getPendingCall(int invokeId)
Get pending call service by id. |
long |
getPendingVideoMessages(int streamId)
Total number of video messages that are pending to be sent to a stream. |
long |
getReadBytes()
Total number of bytes read from the connection. |
RTMP |
getState()
|
byte |
getStateCode()
|
IClientStream |
getStreamByChannelId(int channelId)
Return stream by given channel id. |
IClientStream |
getStreamById(int id)
Get a stream by its id. |
int |
getStreamIdForChannel(int channelId)
Return stream id for given channel id. |
protected Collection<IClientStream> |
getStreams()
Getter for client streams. |
protected int |
getUsedStreamCount()
Getter for used stream count. |
VideoCodecFactory |
getVideoCodecFactory()
Getter for video codec factory. |
long |
getWrittenBytes()
Total number of bytes written to the connection. |
void |
invoke(IServiceCall call)
Invokes service using remoting call object |
void |
invoke(IServiceCall call,
int channel)
Invoke service using call and channel |
void |
invoke(String method)
Invoke method by name |
void |
invoke(String method,
IPendingServiceCallback callback)
Invoke method by name with callback |
void |
invoke(String method,
Object[] params)
Invoke method with parameters |
void |
invoke(String method,
Object[] params,
IPendingServiceCallback callback)
|
boolean |
isChannelUsed(int channelId)
Checks whether channel is used. |
protected void |
messageDropped()
Increases number of dropped messages. |
protected void |
messageReceived()
Increases number of read messages by one. |
protected void |
messageSent(Packet message)
Mark message as sent. |
IClientBroadcastStream |
newBroadcastStream(int streamId)
Create a broadcast stream. |
IPlaylistSubscriberStream |
newPlaylistSubscriberStream(int streamId)
Create a stream that can play a list. |
ISingleItemSubscriberStream |
newSingleItemSubscriberStream(int streamId)
Create a stream that can play only one item. |
void |
notify(IServiceCall call)
|
void |
notify(IServiceCall call,
int channel)
|
void |
notify(String method)
|
void |
notify(String method,
Object[] params)
|
protected abstract void |
onInactive()
Inactive state event handler. |
void |
ping()
Start measuring the roundtrip time for a packet on the connection. |
void |
ping(Ping ping)
Handler for ping event. |
protected void |
pingReceived(Ping pong)
Marks that ping back was received. |
abstract void |
rawWrite(IoBuffer out)
Write raw byte buffer. |
void |
receivedBytesRead(int bytes)
Read number of received bytes. |
protected void |
registerDeferredResult(DeferredResult result)
Registers deferred result. |
void |
registerPendingCall(int invokeId,
IPendingServiceCall call)
Register pending call (remote function call that is yet to finish). |
protected void |
rememberStreamBufferDuration(int streamId,
int bufferDuration)
|
void |
removeClientStream(int streamId)
|
int |
reserveStreamId()
Return a reserved stream id for use. |
protected IPendingServiceCall |
retrievePendingCall(int invokeId)
Retrieve pending call service by id. |
void |
setBandwidthConfigure(IBandwidthConfigure config)
Setter for bandwidth configuration |
void |
setId(int clientId)
|
void |
setMaxHandshakeTimeout(int maxHandshakeTimeout)
Set maximum time to wait for valid handshake in milliseconds. |
void |
setMaxInactivity(int maxInactivity)
Setter for maximum inactivity. |
void |
setPingInterval(int pingInterval)
Setter for ping interval. |
void |
setSchedulingService(ISchedulingService schedulingService)
Sets the scheduling service. |
void |
setState(RTMP state)
|
void |
setStateCode(byte code)
|
void |
setup(String host,
String path,
String sessionId,
Map<String,Object> params)
Initialize connection. |
void |
startRoundTripMeasurement()
Starts measurement. |
protected void |
startWaitForHandshake(ISchedulingService service)
Start waiting for a valid handshake. |
String |
toString()
|
protected void |
unregisterDeferredResult(DeferredResult result)
Unregister deferred result |
void |
unreserveStreamId(int streamId)
Unreserve this id for future use. |
protected void |
updateBytesRead()
Update number of bytes to read next value. |
abstract void |
write(Packet out)
Write packet. |
protected void |
writingMessage(Packet message)
Mark message as being written. |
| Methods inherited from class org.red5.server.BaseConnection |
|---|
connect, dispatchEvent, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getHost, getPath, getPendingMessages, getReadLock, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getType, getWriteLock, getWrittenMessages, handleEvent, initialize, isConnected, notifyEvent, registerBasicScope, unregisterBasicScope |
| Methods inherited from class org.red5.server.AttributeStore |
|---|
filterNull, getAttribute, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute, removeAttribute, removeAttributes, setAttribute, setAttributes, setAttributes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.red5.server.api.IConnection |
|---|
connect, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getHost, getPath, getPendingMessages, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getType, getWrittenMessages, initialize, isConnected |
| 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 |
| 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 |
| Field Detail |
|---|
public static final String RTMP_CONNECTION_KEY
protected volatile int clientId
protected volatile RTMP state
| Constructor Detail |
|---|
public RTMPConnection(String type)
type - Connection type| Method Detail |
|---|
public int getId()
public void setId(int clientId)
public RTMP getState()
public byte getStateCode()
public void setStateCode(byte code)
public void setState(RTMP state)
public boolean connect(IScope newScope,
Object[] params)
BaseConnection
connect in interface ConnectionMBeanconnect in interface IConnectionconnect in class BaseConnectionnewScope - New scopeparams - Parameters to connect with
public void setup(String host,
String path,
String sessionId,
Map<String,Object> params)
host - Connection hostpath - Connection pathsessionId - Connection session idparams - Params passed from clientpublic IConnection.Encoding getEncoding()
getEncoding in interface IConnectionpublic int getNextAvailableChannelId()
public boolean isChannelUsed(int channelId)
channelId - Channel id
true if channel is in use, false
otherwisepublic Channel getChannel(int channelId)
channelId - Channel id
public void closeChannel(int channelId)
channelId - Channel idprotected Collection<IClientStream> getStreams()
public int reserveStreamId()
reserveStreamId in interface IStreamCapableConnectionpublic OutputStream createOutputStream(int streamId)
streamId - Stream id
OutputStreampublic VideoCodecFactory getVideoCodecFactory()
public IClientBroadcastStream newBroadcastStream(int streamId)
newBroadcastStream in interface IStreamCapableConnectionstreamId - Stream id
public ISingleItemSubscriberStream newSingleItemSubscriberStream(int streamId)
newSingleItemSubscriberStream in interface IStreamCapableConnectionstreamId - Stream id
public IPlaylistSubscriberStream newPlaylistSubscriberStream(int streamId)
newPlaylistSubscriberStream in interface IStreamCapableConnectionstreamId - Stream id
public void addClientStream(IClientStream stream)
public void removeClientStream(int streamId)
protected int getUsedStreamCount()
public IClientStream getStreamById(int id)
getStreamById in interface IStreamCapableConnectionid - Stream id
public int getStreamIdForChannel(int channelId)
channelId - Channel id
public IClientStream getStreamByChannelId(int channelId)
channelId - Channel id
public void close()
close in interface ConnectionMBeanclose in interface IConnectionclose in class BaseConnectionpublic void unreserveStreamId(int streamId)
unreserveStreamId in interface IStreamCapableConnectionstreamId - ID of stream to unreservepublic void deleteStreamById(int streamId)
deleteStreamById in interface IStreamCapableConnectionstreamId - ID of stream to deletepublic void ping(Ping ping)
ping - Ping event contextpublic abstract void rawWrite(IoBuffer out)
out - IoBufferpublic abstract void write(Packet out)
out - Packetprotected void updateBytesRead()
public void receivedBytesRead(int bytes)
bytes - Number of bytespublic long getClientBytesRead()
getClientBytesRead in interface IConnectiongetClientBytesRead in class BaseConnectionBytesReadpublic void invoke(IServiceCall call)
invoke in interface IServiceCapableConnectioncall - Service call objectpublic int getInvokeId()
public void registerPendingCall(int invokeId,
IPendingServiceCall call)
invokeId - Deferred operation idcall - Call service
public void invoke(IServiceCall call,
int channel)
invoke in interface IServiceCapableConnectioncall - Service callchannel - Channel usedpublic void invoke(String method)
invoke in interface IServiceCapableConnectionmethod - Called method name
public void invoke(String method,
Object[] params)
invoke in interface IServiceCapableConnectionmethod - Method nameparams - Invocation parameters passed to method
public void invoke(String method,
IPendingServiceCallback callback)
invoke in interface IServiceCapableConnectionmethod - Called method namecallback - Callback
public void invoke(String method,
Object[] params,
IPendingServiceCallback callback)
invoke in interface IServiceCapableConnectionpublic void notify(IServiceCall call)
notify in interface IServiceCapableConnection
public void notify(IServiceCall call,
int channel)
notify in interface IServiceCapableConnectionpublic void notify(String method)
notify in interface IServiceCapableConnection
public void notify(String method,
Object[] params)
notify in interface IServiceCapableConnectionpublic IBandwidthConfigure getBandwidthConfigure()
getBandwidthConfigure in interface IBWControllablepublic IBWControllable getParentBWControllable()
getParentBWControllable in interface IBWControllablepublic void setBandwidthConfigure(IBandwidthConfigure config)
setBandwidthConfigure in interface IBWControllableconfig - Value to set for bandwidth configurationpublic long getReadBytes()
getReadBytes in interface ConnectionMBeangetReadBytes in interface IConnectiongetReadBytes in class BaseConnectionpublic long getWrittenBytes()
getWrittenBytes in interface ConnectionMBeangetWrittenBytes in interface IConnectiongetWrittenBytes in class BaseConnectionprotected IPendingServiceCall getPendingCall(int invokeId)
invokeId - Pending call service id
protected IPendingServiceCall retrievePendingCall(int invokeId)
invokeId - Pending call service id
protected String createStreamName()
protected void writingMessage(Packet message)
message - Message to markprotected void messageReceived()
protected void messageSent(Packet message)
message - Message to markprotected void messageDropped()
public long getPendingVideoMessages(int streamId)
getPendingVideoMessages in interface IStreamCapableConnectiongetPendingVideoMessages in class BaseConnectionstreamId - the id you want to know about
public void ping()
ping in interface ConnectionMBeanping in interface IConnectionprotected void pingReceived(Ping pong)
pong - Ping objectpublic int getLastPingTime()
getLastPingTime in interface ConnectionMBeangetLastPingTime in interface IConnectionpublic void setPingInterval(int pingInterval)
pingInterval - Interval in ms to ping clients. Set to 0 to
disable ghost detection code.public void setMaxInactivity(int maxInactivity)
maxInactivity - Maximum time in ms after which a client is disconnected in
case of inactivity.public void startRoundTripMeasurement()
public void setSchedulingService(ISchedulingService schedulingService)
schedulingService - scheduling serviceprotected abstract void onInactive()
public String toString()
toString in class Objectprotected void registerDeferredResult(DeferredResult result)
result - Result to registerprotected void unregisterDeferredResult(DeferredResult result)
result - Result to unregister
protected void rememberStreamBufferDuration(int streamId,
int bufferDuration)
public void setMaxHandshakeTimeout(int maxHandshakeTimeout)
maxHandshakeTimeout - Maximum time in millisecondsprotected void startWaitForHandshake(ISchedulingService service)
service - The scheduling service to use
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||