Class BaseRTMPTConnection

  • All Implemented Interfaces:
    org.red5.server.api.event.IEventDispatcher, org.red5.server.api.event.IEventHandler, org.red5.server.api.event.IEventListener, org.red5.server.api.IAttributeStore, org.red5.server.api.ICastingAttributeStore, org.red5.server.api.IConnection, org.red5.server.api.ICoreObject, org.red5.server.api.service.IServiceCapableConnection, org.red5.server.api.stream.IStreamCapableConnection, org.red5.server.jmx.mxbeans.AttributeStoreMXBean, org.red5.server.net.rtmp.IReceivedMessageTaskQueueListener
    Direct Known Subclasses:
    RTMPTConnection

    public abstract class BaseRTMPTConnection
    extends org.red5.server.net.rtmp.RTMPConnection
    Base RTMPT client / session.
    Author:
    The Red5 Project, Paul Gregoire ([email protected])
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.red5.server.api.IConnection

        org.red5.server.api.IConnection.Duty, org.red5.server.api.IConnection.Encoding, org.red5.server.api.IConnection.Type
    • Field Summary

      Fields 
      Modifier and Type Field Description
      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<org.red5.server.net.rtmpt.BaseRTMPTConnection.PendingData> pendingOutMessages
      List of pending outgoing messages.
      • Fields inherited from class org.red5.server.net.rtmp.RTMPConnection

        bytesReadInterval, channels, clientBytesRead, deadlockGuardScheduler, decoderLock, decoderState, deferredResults, encoderLock, executor, handler, keepAliveTask, lastPingRoundTripTime, lastPingSentOn, lastPongReceivedOn, limitType, MAX_RESERVED_STREAMS, maxHandlingTimeout, maxInactivity, nextBytesRead, packetSequence, pendingCalls, pendingVideos, pingInterval, receivedPacketExecutor, receivedPacketFuture, receivedPacketQueue, reservedStreams, RTMP_BUFFER, RTMP_CONN_MANAGER, RTMP_ENCRYPTED, RTMP_ENCRYPTED_BLOWFISH, RTMP_ENCRYPTED_UNK, RTMP_ENCRYPTED_XTEA, RTMP_HANDLER, RTMP_HANDSHAKE, RTMP_NON_ENCRYPTED, RTMP_SESSION_ID, RTMPE_CIPHER_IN, RTMPE_CIPHER_OUT, running, scheduler, state, streams, tasksByStreams, timer, transactionId, waitForHandshakeTask
      • Fields inherited from class org.red5.server.BaseConnection

        basicScopes, client, connectionListeners, droppedMessages, duty, host, params, path, readMessages, remoteAddress, remoteAddresses, remotePort, scope, sessionId, type, writtenMessages
      • Fields inherited from class org.red5.server.AttributeStore

        attributes
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      List<?> decode​(org.apache.mina.core.buffer.IoBuffer data)
      Decode data sent by the client.
      protected org.apache.mina.core.buffer.IoBuffer foldPendingMessages​(int targetSize)  
      long getPendingMessages()
      abstract org.apache.mina.core.buffer.IoBuffer getPendingMessages​(int targetSize)
      Return any pending messages up to a given size.
      long getReadBytes()
      long getWrittenBytes()
      boolean isClosing()
      Getter for property 'closing'.
      void setDecoder​(org.red5.server.net.rtmp.codec.RTMPProtocolDecoder decoder)  
      void setEncoder​(org.red5.server.net.rtmp.codec.RTMPProtocolEncoder encoder)  
      void setMaxInMessagesPerProcess​(int maxInMessagesPerProcess)  
      void setMaxQueueOfferAttempts​(int maxQueueOfferAttempts)  
      void setMaxQueueOfferTime​(long maxQueueOfferTime)  
      void updateReadBytes​(int read)  
      void updateWrittenBytes​(int wrote)  
      void write​(org.red5.server.net.rtmp.message.Packet packet)
      Send RTMP packet down the connection.
      void writeRaw​(org.apache.mina.core.buffer.IoBuffer packet)
      Send raw data down the connection.
      • Methods inherited from class org.red5.server.net.rtmp.RTMPConnection

        addClientStream, closeChannel, connect, createOutputStream, createStreamName, currentQueueSize, deleteStreamById, dispatchEvent, getChannel, getChannelIdForStreamId, getChannelsConcurrencyLevel, getChannelsInitalCapacity, getClientBytesRead, getDeadlockGuardScheduler, getDecoderLock, getDecoderState, getEncoderLock, getEncoding, getExecutor, getHandler, getId, getIoSession, getLastPingSentAndLastPongReceivedInterval, getLastPingTime, getMaxHandlingTimeout, getNextAvailableChannelId, getPendingCall, getPendingCallsConcurrencyLevel, getPendingCallsInitalCapacity, getPendingVideoMessages, getProtocol, getReservedStreamsConcurrencyLevel, getReservedStreamsInitalCapacity, getScheduler, getState, getStateCode, getStreamByChannelId, getStreamById, getStreamIdForChannelId, getStreams, getStreamsConcurrencyLevel, getStreamsInitalCapacity, getStreamsMap, getTimer, getTransactionId, getUsedStreamCount, handleMessageReceived, invoke, invoke, invoke, invoke, invoke, invoke, isChannelUsed, isDisconnected, isEncrypted, isIdle, isValidStreamId, messageDropped, messageReceived, messageSent, messageTypeToName, newBroadcastStream, newPlaylistSubscriberStream, newSingleItemSubscriberStream, notify, notify, notify, notify, onInactive, onTaskAdded, onTaskRemoved, open, ping, ping, pingReceived, receivedBytesRead, registerDeferredResult, registerPendingCall, rememberStreamBufferDuration, removeClientStream, reserveStreamId, reserveStreamId, retrievePendingCall, sendPendingServiceCallsCloseError, sendSharedObjectMessage, setBandwidth, setChannelsConcurrencyLevel, setChannelsInitalCapacity, setDeadlockGuardScheduler, setEncrypted, setExecutor, setExecutorQueueSizeToDropAudioPackets, setHandler, setId, setMaxHandlingTimeout, setMaxHandshakeTimeout, setMaxInactivity, setPendingCallsConcurrencyLevel, setPendingCallsInitalCapacity, setPingInterval, setReservedStreamsConcurrencyLevel, setReservedStreamsInitalCapacity, setScheduler, setStateCode, setStreamsConcurrencyLevel, setStreamsInitalCapacity, setup, startWaitForHandshake, status, status, toString, unregisterDeferredResult, unreserveStreamId, updateBytesRead, writingMessage
      • Methods inherited from class org.red5.server.BaseConnection

        addListener, connect, equals, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getDuty, getHost, getLock, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getStreamId, getType, getWrittenMessages, handleEvent, hashCode, initialize, isClosed, isConnected, isReaderIdle, isWriterIdle, notifyEvent, notifyPropertyChanged, registerBasicScope, registerBasicScope, removeListener, setClient, setDuty, setStreamId, unregisterBasicScope
      • Methods inherited from class org.red5.server.AttributeStore

        filterNull, from, getAttribute, getAttribute, getAttribute, getAttributeNames, getAttributes, getBoolAttribute, getByteAttribute, getDoubleAttribute, getIntAttribute, getListAttribute, getLongAttribute, getMapAttribute, getSetAttribute, getShortAttribute, getStringAttribute, hasAttribute, hasAttribute, removeAttribute, removeAttribute, removeAttributes, setAttribute, setAttribute, setAttributes, setAttributes, size
      • Methods inherited from interface org.red5.server.api.IAttributeStore

        getAttribute, getAttribute, getAttribute, getAttributeNames, getAttributes, hasAttribute, hasAttribute, removeAttribute, removeAttribute, removeAttributes, setAttribute, setAttribute, setAttributes, setAttributes, size
      • 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.IConnection

        addListener, connect, getBasicScopes, getClient, getConnectParams, getDroppedMessages, getDuty, getHost, getPath, getReadMessages, getRemoteAddress, getRemoteAddresses, getRemotePort, getScope, getSessionId, getStreamId, getType, getWrittenMessages, initialize, isConnected, removeListener, setClient, setStreamId
      • Methods inherited from interface org.red5.server.api.event.IEventHandler

        handleEvent
      • Methods inherited from interface org.red5.server.api.event.IEventListener

        notifyEvent
    • Field Detail

      • pendingOutMessages

        protected transient volatile LinkedBlockingQueue<org.red5.server.net.rtmpt.BaseRTMPTConnection.PendingData> pendingOutMessages
        List of pending outgoing messages. Default size is 8192.
      • 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 org.apache.mina.core.buffer.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()
        Specified by:
        close in interface org.red5.server.api.IConnection
        Overrides:
        close in class org.red5.server.net.rtmp.RTMPConnection
      • isClosing

        public boolean isClosing()
        Getter for property 'closing'.
        Returns:
        Value for property 'closing'.
      • getReadBytes

        public long getReadBytes()
        Specified by:
        getReadBytes in interface org.red5.server.api.IConnection
        Overrides:
        getReadBytes in class org.red5.server.net.rtmp.RTMPConnection
      • updateReadBytes

        public void updateReadBytes​(int read)
      • getWrittenBytes

        public long getWrittenBytes()
        Specified by:
        getWrittenBytes in interface org.red5.server.api.IConnection
        Overrides:
        getWrittenBytes in class org.red5.server.net.rtmp.RTMPConnection
      • updateWrittenBytes

        public void updateWrittenBytes​(int wrote)
      • getPendingMessages

        public long getPendingMessages()
        Specified by:
        getPendingMessages in interface org.red5.server.api.IConnection
        Overrides:
        getPendingMessages in class org.red5.server.BaseConnection
      • decode

        public List<?> decode​(org.apache.mina.core.buffer.IoBuffer data)
        Decode data sent by the client.
        Parameters:
        data - the data to decode
        Returns:
        a list of decoded objects
      • write

        public void write​(org.red5.server.net.rtmp.message.Packet packet)
        Send RTMP packet down the connection.
        Specified by:
        write in class org.red5.server.net.rtmp.RTMPConnection
        Parameters:
        packet - the packet to send
      • writeRaw

        public void writeRaw​(org.apache.mina.core.buffer.IoBuffer packet)
        Send raw data down the connection.
        Specified by:
        writeRaw in class org.red5.server.net.rtmp.RTMPConnection
        Parameters:
        packet - the buffer containing the raw data
      • foldPendingMessages

        protected org.apache.mina.core.buffer.IoBuffer foldPendingMessages​(int targetSize)
      • setDecoder

        public void setDecoder​(org.red5.server.net.rtmp.codec.RTMPProtocolDecoder decoder)
      • setEncoder

        public void setEncoder​(org.red5.server.net.rtmp.codec.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