idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
6,400 | private void addClient ( String id , IClient client ) { if ( ! hasClient ( id ) ) { clients . put ( id , client ) ; } else { log . debug ( "Client id: {} already registered" , id ) ; } } | Add the client to the registry |
6,401 | public ClientList < Client > getClientList ( ) { ClientList < Client > list = new ClientList < Client > ( ) ; for ( IClient c : clients . values ( ) ) { list . add ( ( Client ) c ) ; } return list ; } | Returns a list of Clients . |
6,402 | @ SuppressWarnings ( "unchecked" ) protected Collection < IClient > getClients ( ) { if ( ! hasClients ( ) ) { return Collections . EMPTY_SET ; } return Collections . unmodifiableCollection ( clients . values ( ) ) ; } | Return collection of clients |
6,403 | public IClient newClient ( Object [ ] params ) throws ClientNotFoundException , ClientRejectedException { String id = nextId ( ) ; IClient client = new Client ( id , this ) ; addClient ( id , client ) ; return client ; } | Return client from next id with given params |
6,404 | public String nextId ( ) { String id = "-1" ; do { if ( nextId . get ( ) == Integer . MAX_VALUE ) { nextId . set ( 0 ) ; } id = String . format ( "%d" , nextId . getAndIncrement ( ) ) ; } while ( hasClient ( id ) ) ; return id ; } | Return next client id |
6,405 | private IPersistenceStore getStore ( IScope scope , boolean persistent ) { IPersistenceStore store ; if ( ! persistent ) { if ( ! scope . hasAttribute ( SO_TRANSIENT_STORE ) ) { store = new RamPersistence ( scope ) ; scope . setAttribute ( SO_TRANSIENT_STORE , store ) ; return store ; } return ( IPersistenceStore ) sco... | Return scope store |
6,406 | private static Constructor < ? > getPersistenceStoreConstructor ( Class < ? > theClass , Class < ? > [ ] interfaces ) throws Exception { Constructor < ? > constructor = null ; for ( Class < ? > interfaceClass : interfaces ) { try { constructor = theClass . getConstructor ( new Class [ ] { interfaceClass } ) ; } catch (... | Returns persistence store object class constructor |
6,407 | public static ChunkHeader read ( IoBuffer in ) { int remaining = in . remaining ( ) ; if ( remaining > 0 ) { byte headerByte = in . get ( ) ; ChunkHeader h = new ChunkHeader ( ) ; h . format = ( byte ) ( ( 0b11000000 & headerByte ) >> 6 ) ; int fmt = headerByte & 0x3f ; switch ( fmt ) { case 0 : h . size = 2 ; if ( rem... | Read chunk header from the buffer . |
6,408 | private boolean acquireWriteFuture ( int sliceLength ) { if ( sliceLength > 0 ) { Object writeResult = null ; int timeout = sliceLength * 500 ; if ( writerFuture != null ) { try { writeResult = writerFuture . get ( timeout , TimeUnit . MILLISECONDS ) ; } catch ( Exception e ) { log . warn ( "Exception waiting for write... | Get the WriteFuture with a timeout based on the length of the slice to write . |
6,409 | public void uninit ( ) { if ( initialized . get ( ) ) { log . debug ( "Uninit" ) ; if ( writer != null ) { if ( writerFuture != null ) { try { writerFuture . get ( ) ; } catch ( Exception e ) { log . warn ( "Exception waiting for write result on uninit" , e ) ; } if ( writerFuture . cancel ( false ) ) { log . debug ( "... | Reset or uninitialize |
6,410 | public final void doWrites ( ) { QueuedMediaData [ ] slice = null ; writeLock . lock ( ) ; try { slice = queue . toArray ( new QueuedMediaData [ 0 ] ) ; if ( queue . removeAll ( Arrays . asList ( slice ) ) ) { log . debug ( "Queued writes transfered, count: {}" , slice . length ) ; } } finally { writeLock . unlock ( ) ... | Write all the queued items to the writer . |
6,411 | public final void doWrites ( QueuedMediaData [ ] slice ) { for ( QueuedMediaData queued : slice ) { int tmpTs = queued . getTimestamp ( ) ; if ( lastWrittenTs <= tmpTs ) { if ( queued . hasData ( ) ) { write ( queued ) ; lastWrittenTs = tmpTs ; queued . dispose ( ) ; } else { if ( log . isTraceEnabled ( ) ) { log . tra... | Write a slice of the queued items to the writer . |
6,412 | public void setupOutputPath ( String name ) { IStreamFilenameGenerator generator = ( IStreamFilenameGenerator ) ScopeUtils . getScopeService ( scope , IStreamFilenameGenerator . class , DefaultStreamFilenameGenerator . class ) ; String filePath = generator . generateFilename ( scope , name , ".flv" , GenerationType . R... | Sets up the output file path for writing . |
6,413 | public void setVideoDecoderConfiguration ( IRTMPEvent decoderConfig ) { if ( decoderConfig instanceof IStreamData ) { IoBuffer data = ( ( IStreamData < ? > ) decoderConfig ) . getData ( ) . asReadOnlyBuffer ( ) ; videoConfigurationTag = ImmutableTag . build ( decoderConfig . getDataType ( ) , 0 , data , 0 ) ; } } | Sets a video decoder configuration ; some codecs require this such as AVC . |
6,414 | public void setAudioDecoderConfiguration ( IRTMPEvent decoderConfig ) { if ( decoderConfig instanceof IStreamData ) { IoBuffer data = ( ( IStreamData < ? > ) decoderConfig ) . getData ( ) . asReadOnlyBuffer ( ) ; audioConfigurationTag = ImmutableTag . build ( decoderConfig . getDataType ( ) , 0 , data , 0 ) ; } } | Sets a audio decoder configuration ; some codecs require this such as AAC . |
6,415 | public void disconnect ( ) { if ( disconnected . compareAndSet ( false , true ) ) { log . debug ( "Disconnect - id: {}" , id ) ; if ( connections != null && ! connections . isEmpty ( ) ) { log . debug ( "Closing {} scope connections" , connections . size ( ) ) ; for ( IConnection con : getConnections ( ) ) { try { con ... | Disconnects client from Red5 application |
6,416 | public Set < IConnection > getConnections ( IScope scope ) { if ( scope == null ) { return getConnections ( ) ; } Set < IClient > scopeClients = scope . getClients ( ) ; if ( scopeClients . contains ( this ) ) { for ( IClient cli : scopeClients ) { if ( this . equals ( cli ) ) { return cli . getConnections ( ) ; } } } ... | Return client connections to given scope |
6,417 | public List < String > iterateScopeNameList ( ) { log . debug ( "iterateScopeNameList called" ) ; Collection < IScope > scopes = getScopes ( ) ; log . debug ( "Scopes: {}" , scopes . size ( ) ) ; List < String > scopeNames = new ArrayList < String > ( scopes . size ( ) ) ; for ( IScope scope : scopes ) { log . debug ( ... | Iterate through the scopes and their attributes . Used by JMX |
6,418 | protected void register ( IConnection conn ) { if ( log . isDebugEnabled ( ) ) { if ( conn == null ) { log . debug ( "Register null connection, client id: {}" , id ) ; } else { log . debug ( "Register connection ({}:{}) client id: {}" , conn . getRemoteAddress ( ) , conn . getRemotePort ( ) , id ) ; } } if ( conn != nu... | Associate connection with client |
6,419 | protected void unregister ( IConnection conn , boolean deleteIfNoConns ) { log . debug ( "Unregister connection ({}:{}) client id: {}" , conn . getRemoteAddress ( ) , conn . getRemotePort ( ) , id ) ; connections . remove ( conn ) ; if ( deleteIfNoConns && connections . isEmpty ( ) ) { removeInstance ( ) ; } } | Removes client - connection association for given connection |
6,420 | private void removeInstance ( ) { ClientRegistry ref = registry . get ( ) ; if ( ref != null ) { ref . removeClient ( this ) ; } else { log . warn ( "Client registry reference was not accessable, removal failed" ) ; } } | Removes this instance from the client registry . |
6,421 | public boolean addChildScope ( IBasicScope scope ) { log . debug ( "Add child: {}" , scope ) ; boolean added = false ; if ( scope . isValid ( ) ) { try { if ( ! children . containsKey ( scope ) ) { log . debug ( "Adding child scope: {} to {}" , scope , this ) ; added = children . add ( scope ) ; } else { log . warn ( "... | Add child scope to this scope |
6,422 | public boolean connect ( IConnection conn , Object [ ] params ) { log . debug ( "Connect - scope: {} connection: {}" , this , conn ) ; if ( enabled ) { if ( hasParent ( ) && ! parent . connect ( conn , params ) ) { log . debug ( "Connection to parent failed" ) ; return false ; } if ( hasHandler ( ) && ! getHandler ( ) ... | Connect to scope with parameters . To successfully connect to scope it must have handler that will accept this connection with given set of parameters . Client associated with connection is added to scope clients set connection is registered as scope event listener . |
6,423 | public boolean createChildScope ( String name ) { log . debug ( "createChildScope: {}" , name ) ; if ( children . hasName ( name ) ) { log . debug ( "Scope: {} already exists, children: {}" , name , children . getNames ( ) ) ; } else { return addChildScope ( new Builder ( this , ScopeType . ROOM , name , false ) . buil... | Create child scope of room type with the given name . |
6,424 | public void disconnect ( IConnection conn ) { log . debug ( "Disconnect: {}" , conn ) ; final IClient client = conn . getClient ( ) ; if ( client == null ) { removeEventListener ( conn ) ; connectionStats . decrement ( ) ; if ( hasParent ( ) ) { parent . disconnect ( conn ) ; } return ; } if ( clients . remove ( client... | Disconnect connection from scope |
6,425 | public IBroadcastScope getBroadcastScope ( String name ) { return ( IBroadcastScope ) children . getBasicScope ( ScopeType . BROADCAST , name ) ; } | Return the broadcast scope for a given name |
6,426 | public IBasicScope getBasicScope ( ScopeType type , String name ) { return children . getBasicScope ( type , name ) ; } | Return base scope of given type with given name |
6,427 | public Set < String > getBasicScopeNames ( ScopeType type ) { if ( type != null ) { Set < String > names = new HashSet < String > ( ) ; for ( IBasicScope child : children . keySet ( ) ) { if ( child . getType ( ) . equals ( type ) ) { names . add ( child . getName ( ) ) ; } } return names ; } return getScopeNames ( ) ;... | Return basic scope names matching given type |
6,428 | public int getDepth ( ) { if ( depth == UNSET ) { if ( hasParent ( ) ) { depth = parent . getDepth ( ) + 1 ; } else { depth = 0 ; } } return depth ; } | return scope depth |
6,429 | public IScopeHandler getHandler ( ) { log . trace ( "getHandler from {}" , name ) ; if ( handler != null ) { return handler ; } else if ( hasParent ( ) ) { return getParent ( ) . getHandler ( ) ; } else { return null ; } } | Return scope handler or parent s scope handler if this scope doesn t have one . |
6,430 | public Resource getResource ( String path ) { if ( hasContext ( ) ) { return context . getResource ( path ) ; } return getContext ( ) . getResource ( getContextPath ( ) + '/' + path ) ; } | Return resource located at given path |
6,431 | public Resource [ ] getResources ( String path ) throws IOException { if ( hasContext ( ) ) { return context . getResources ( path ) ; } return getContext ( ) . getResources ( getContextPath ( ) + '/' + path ) ; } | Return array of resources from path string usually used with pattern path |
6,432 | public IScope getScope ( String name ) { IBasicScope child = children . getBasicScope ( ScopeType . UNDEFINED , name ) ; log . debug ( "Child of {}: {}" , this . name , child ) ; if ( child != null ) { if ( child instanceof IScope ) { return ( IScope ) child ; } log . warn ( "Requested scope: {} is not of IScope type: ... | Return child scope by name |
6,433 | public Object getServiceHandler ( String name ) { Map < String , Object > serviceHandlers = getServiceHandlers ( false ) ; if ( serviceHandlers == null ) { return null ; } return serviceHandlers . get ( name ) ; } | Return service handler by name |
6,434 | @ SuppressWarnings ( "unchecked" ) public Set < String > getServiceHandlerNames ( ) { Map < String , Object > serviceHandlers = getServiceHandlers ( false ) ; if ( serviceHandlers == null ) { return Collections . EMPTY_SET ; } return serviceHandlers . keySet ( ) ; } | Return set of service handler names . Removing entries from the set unregisters the corresponding service handler . |
6,435 | protected Map < String , Object > getServiceHandlers ( boolean allowCreate ) { if ( serviceHandlers == null ) { if ( allowCreate ) { serviceHandlers = new ConcurrentHashMap < String , Object > ( 3 , 0.9f , 1 ) ; } } return serviceHandlers ; } | Return map of service handlers and optionally created it if it doesn t exist . |
6,436 | public boolean hasChildScope ( ScopeType type , String name ) { log . debug ( "Has child scope? {} in {}" , name , this ) ; return children . getBasicScope ( type , name ) != null ; } | Check whether scope has child scope with given name and type |
6,437 | public void init ( ) { log . debug ( "Init scope: {} parent: {}" , name , parent ) ; if ( hasParent ( ) ) { if ( ! parent . hasChildScope ( name ) ) { if ( parent . addChildScope ( this ) ) { log . debug ( "Scope added to parent" ) ; } else { log . warn ( "Scope not added to parent" ) ; return ; } } else { throw new Sc... | Initialization actions start if autostart is set to true . |
6,438 | public void uninit ( ) { log . debug ( "Un-init scope" ) ; for ( IBasicScope child : children . keySet ( ) ) { if ( child instanceof Scope ) { ( ( Scope ) child ) . uninit ( ) ; } } stop ( ) ; setEnabled ( false ) ; if ( hasParent ( ) ) { if ( parent . hasChildScope ( name ) ) { parent . removeChildScope ( this ) ; } }... | Uninitialize scope and unregister from parent . |
6,439 | public void registerServiceHandler ( String name , Object handler ) { Map < String , Object > serviceHandlers = getServiceHandlers ( ) ; serviceHandlers . put ( name , handler ) ; } | Register service handler by name |
6,440 | public void removeChildScope ( IBasicScope scope ) { log . debug ( "removeChildScope: {}" , scope ) ; if ( children . containsKey ( scope ) ) { children . remove ( scope ) ; if ( scope instanceof Scope ) { unregisterJMX ( ) ; } } } | Removes child scope |
6,441 | public void removeChildren ( ) { log . trace ( "removeChildren of {}" , name ) ; for ( IBasicScope child : children . keySet ( ) ) { removeChildScope ( child ) ; } } | Removes all the child scopes |
6,442 | public void setHandler ( IScopeHandler handler ) { log . debug ( "setHandler: {} on {}" , handler , name ) ; this . handler = handler ; if ( handler instanceof IScopeAware ) { ( ( IScopeAware ) handler ) . setScope ( this ) ; } } | Setter for scope event handler |
6,443 | public final void setName ( String name ) { log . debug ( "Set name: {}" , name ) ; if ( this . name == null && StringUtils . isNotBlank ( name ) ) { this . name = name ; if ( oName != null ) { unregisterJMX ( ) ; } registerJMX ( ) ; } else { log . info ( "Scope {} name reset to: {} disallowed" , this . name , name ) ;... | Setter for scope name |
6,444 | public void setPersistenceClass ( String persistenceClass ) throws Exception { this . persistenceClass = persistenceClass ; if ( persistenceClass != null ) { store = PersistenceUtils . getPersistenceStore ( this , persistenceClass ) ; } } | Set scope persistence class |
6,445 | public void unregisterServiceHandler ( String name ) { Map < String , Object > serviceHandlers = getServiceHandlers ( false ) ; if ( serviceHandlers != null ) { serviceHandlers . remove ( name ) ; } } | Unregisters service handler by name |
6,446 | public IServer getServer ( ) { if ( hasParent ( ) ) { final IScope parent = getParent ( ) ; if ( parent instanceof Scope ) { return ( ( Scope ) parent ) . getServer ( ) ; } else if ( parent instanceof IGlobalScope ) { return ( ( IGlobalScope ) parent ) . getServer ( ) ; } } return null ; } | Return the server instance connected to this scope . |
6,447 | public void setParamMap ( Map < String , Object > paramMap ) { if ( paramMap != null && ! paramMap . isEmpty ( ) ) { this . paramMap . putAll ( paramMap ) ; } } | Setter for event parameters map |
6,448 | public final static PipeConnectionEvent build ( AbstractPipe source , EventType type , IConsumer consumer , Map < String , Object > paramMap ) { return new PipeConnectionEvent ( source , type , consumer , paramMap ) ; } | Builds a PipeConnectionEvent with a source pipe and consumer . |
6,449 | public final static PipeConnectionEvent build ( AbstractPipe source , EventType type , IProvider provider , Map < String , Object > paramMap ) { return new PipeConnectionEvent ( source , type , provider , paramMap ) ; } | Builds a PipeConnectionEvent with a source pipe and provider . |
6,450 | public void setCredentials ( String userid , String password ) { Map < String , String > data = new HashMap < String , String > ( ) ; data . put ( "userid" , userid ) ; data . put ( "password" , password ) ; RemotingHeader header = new RemotingHeader ( RemotingHeader . CREDENTIALS , true , data ) ; headers . put ( Remo... | Send authentication data with each remoting request . |
6,451 | public void addHeader ( String name , boolean required , Object value ) { RemotingHeader header = new RemotingHeader ( name , required , value ) ; headers . put ( name , header ) ; } | Send an additional header to the server . |
6,452 | public Object invokeMethod ( String method , Object [ ] params ) { log . debug ( "invokeMethod url: {}" , ( url + appendToUrl ) ) ; IoBuffer resultBuffer = null ; IoBuffer data = encodeInvoke ( method , params ) ; HttpPost post = null ; try { post = new HttpPost ( url + appendToUrl ) ; post . addHeader ( "Content-Type"... | Invoke a method synchronously on the remoting server . |
6,453 | public void invokeMethod ( String method , Object [ ] methodParams , IRemotingCallback callback ) { try { RemotingWorker worker = new RemotingWorker ( this , method , methodParams , callback ) ; executor . execute ( worker ) ; } catch ( Exception err ) { log . warn ( "Exception invoking method: {}" , method , err ) ; }... | Invoke a method asynchronously on the remoting server . |
6,454 | public List < Object > decodeBuffer ( RTMPConnection conn , IoBuffer buffer ) { final int position = buffer . position ( ) ; List < Object > result = null ; if ( conn != null ) { try { result = new LinkedList < > ( ) ; RTMPDecodeState state = conn . getDecoderState ( ) ; if ( ! conn . getSessionId ( ) . equals ( state ... | Decode all available objects in buffer . |
6,455 | public Object decode ( RTMPConnection conn , RTMPDecodeState state , IoBuffer in ) throws ProtocolException { try { final byte connectionState = conn . getStateCode ( ) ; switch ( connectionState ) { case RTMP . STATE_CONNECTED : return decodePacket ( conn , state , in ) ; case RTMP . STATE_ERROR : case RTMP . STATE_DI... | Decodes the buffer data . |
6,456 | public IRTMPEvent decodeMessage ( RTMPConnection conn , Header header , IoBuffer in ) { IRTMPEvent message ; byte dataType = header . getDataType ( ) ; switch ( dataType ) { case TYPE_AUDIO_DATA : message = decodeAudioData ( in ) ; message . setSourceType ( Constants . SOURCE_TYPE_LIVE ) ; break ; case TYPE_VIDEO_DATA ... | Decodes RTMP message event . |
6,457 | protected void doDecodeSharedObject ( SharedObjectMessage so , IoBuffer in , Input input ) { Input amf3Input = new org . red5 . io . amf3 . Input ( in ) ; while ( in . hasRemaining ( ) ) { final ISharedObjectEvent . Type type = SharedObjectTypeMapping . toType ( in . get ( ) ) ; if ( type == null ) { in . skip ( in . r... | Perform the actual decoding of the shared object contents . |
6,458 | private Invoke decodeAction ( Encoding encoding , IoBuffer in , Header header ) { in . mark ( ) ; byte tmp = in . get ( ) ; in . reset ( ) ; Input input ; if ( encoding == Encoding . AMF3 && tmp == AMF . TYPE_AMF3_OBJECT ) { input = new org . red5 . io . amf3 . Input ( in ) ; ( ( org . red5 . io . amf3 . Input ) input ... | Decode the action for a supplied an Invoke . |
6,459 | public Ping decodePing ( IoBuffer in ) { Ping ping = null ; if ( log . isTraceEnabled ( ) ) { String hexDump = in . getHexDump ( ) ; log . trace ( "Ping dump: {}" , hexDump ) ; } short type = in . getShort ( ) ; switch ( type ) { case Ping . CLIENT_BUFFER : ping = new SetBuffer ( in . getInt ( ) , in . getInt ( ) ) ; b... | Decodes ping event . |
6,460 | @ SuppressWarnings ( "unused" ) private boolean isStreamCommand ( String action ) { switch ( StreamAction . getEnum ( action ) ) { case CREATE_STREAM : case DELETE_STREAM : case RELEASE_STREAM : case PUBLISH : case PLAY : case PLAY2 : case SEEK : case PAUSE : case PAUSE_RAW : case CLOSE_STREAM : case RECEIVE_VIDEO : ca... | Checks if the passed action is a reserved stream method . |
6,461 | public void write ( IRTMPEvent event ) { if ( ! connection . isClosed ( ) ) { final IClientStream stream = connection . getStreamByChannelId ( id ) ; if ( id > 3 && stream == null ) { log . warn ( "Non-existant stream for channel id: {}, session: {} discarding: {}" , id , connection . getSessionId ( ) , event ) ; } fin... | Writes packet from event data to RTMP connection . |
6,462 | private void write ( IRTMPEvent event , Number streamId ) { log . trace ( "write to stream id: {} channel: {}" , streamId , id ) ; final Header header = new Header ( ) ; final Packet packet = new Packet ( header , event ) ; header . setChannelId ( id ) ; int ts = event . getTimestamp ( ) ; if ( ts != 0 ) { header . set... | Writes packet from event data to RTMP connection and stream id . |
6,463 | @ SuppressWarnings ( "unused" ) private void discard ( IRTMPEvent event ) { if ( event instanceof IStreamData < ? > ) { log . debug ( "Discarding: {}" , ( ( IStreamData < ? > ) event ) . toString ( ) ) ; IoBuffer data = ( ( IStreamData < ? > ) event ) . getData ( ) ; if ( data != null ) { log . trace ( "Freeing discard... | Discard an event routed to this channel . |
6,464 | public void sendStatus ( Status status ) { if ( connection != null ) { final boolean andReturn = ! status . getCode ( ) . equals ( StatusCodes . NS_DATA_START ) ; final Invoke event = new Invoke ( ) ; if ( andReturn ) { final PendingCall call = new PendingCall ( null , CALL_ON_STATUS , new Object [ ] { status } ) ; if ... | Sends status notification . |
6,465 | public void pause ( Boolean pausePlayback , int position ) { IConnection conn = Red5 . getConnectionLocal ( ) ; if ( conn instanceof IStreamCapableConnection ) { IStreamCapableConnection streamConn = ( IStreamCapableConnection ) conn ; Number streamId = conn . getStreamId ( ) ; IClientStream stream = streamConn . getSt... | Pause at given position . Required as pausePlayback can be null if no flag is passed by the client |
6,466 | public void play ( String name , int start , int length , Object reset ) { if ( reset instanceof Boolean ) { play ( name , start , length , ( ( Boolean ) reset ) . booleanValue ( ) ) ; } else { if ( reset instanceof Integer ) { int value = ( Integer ) reset ; switch ( value ) { case 0 : IStreamCapableConnection streamC... | Plays back a stream based on the supplied name from the specified position for the given length of time . |
6,467 | private void sendNSFailed ( IConnection conn , String errorCode , String description , String name , Number streamId ) { StreamService . sendNetStreamStatus ( conn , errorCode , description , name , Status . ERROR , streamId ) ; } | Send NetStream . Play . Failed to the client . |
6,468 | protected void initRC4Encryption ( byte [ ] sharedSecret ) { log . debug ( "Shared secret: {}" , Hex . encodeHexString ( sharedSecret ) ) ; log . debug ( "Outgoing public key [{}]: {}" , outgoingPublicKey . length , Hex . encodeHexString ( outgoingPublicKey ) ) ; byte [ ] rc4keyOut = new byte [ 32 ] ; calculateHMAC_SHA... | Prepare the ciphers . |
6,469 | protected KeyPair generateKeyPair ( ) { KeyPair keyPair = null ; DHParameterSpec keySpec = new DHParameterSpec ( DH_MODULUS , DH_BASE ) ; try { KeyPairGenerator keyGen = KeyPairGenerator . getInstance ( "DH" ) ; keyGen . initialize ( keySpec ) ; keyPair = keyGen . generateKeyPair ( ) ; keyAgreement = KeyAgreement . get... | Creates a Diffie - Hellman key pair . |
6,470 | protected byte [ ] getPublicKey ( KeyPair keyPair ) { DHPublicKey incomingPublicKey = ( DHPublicKey ) keyPair . getPublic ( ) ; BigInteger dhY = incomingPublicKey . getY ( ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Public key: {}" , Hex . encodeHexString ( BigIntegers . asUnsignedByteArray ( dhY ) ) ) ; } ret... | Returns the public key for a given key pair . |
6,471 | public void calculateDigest ( int digestPos , byte [ ] handshakeMessage , int handshakeOffset , byte [ ] key , int keyLen , byte [ ] digest , int digestOffset ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "calculateDigest - digestPos: {} handshakeOffset: {} keyLen: {} digestOffset: {}" , digestPos , handshakeOffs... | Calculates the digest given the its offset in the handshake data . |
6,472 | public boolean verifyDigest ( int digestPos , byte [ ] handshakeMessage , byte [ ] key , int keyLen ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "verifyDigest - digestPos: {} keyLen: {} handshake size: {} " , digestPos , keyLen , handshakeMessage . length ) ; } byte [ ] calcDigest = new byte [ DIGEST_LENGTH ] ; ... | Verifies the digest . |
6,473 | public void calculateHMAC_SHA256 ( byte [ ] message , int messageOffset , int messageLen , byte [ ] key , int keyLen , byte [ ] digest , int digestOffset ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "calculateHMAC_SHA256 - messageOffset: {} messageLen: {}" , messageOffset , messageLen ) ; log . trace ( "calculat... | Calculates an HMAC SHA256 hash into the digest at the given offset . |
6,474 | public void calculateSwfVerification ( byte [ ] handshakeMessage , byte [ ] swfHash , int swfSize ) { byte [ ] swfHashKey = new byte [ DIGEST_LENGTH ] ; System . arraycopy ( handshakeMessage , Constants . HANDSHAKE_SIZE - DIGEST_LENGTH , swfHashKey , 0 , DIGEST_LENGTH ) ; byte [ ] bytesFromServerHash = new byte [ DIGES... | Calculates the swf verification token . |
6,475 | public int getDHOffset ( int algorithm , byte [ ] handshake , int bufferOffset ) { switch ( algorithm ) { case 1 : return getDHOffset2 ( handshake , bufferOffset ) ; default : case 0 : return getDHOffset1 ( handshake , bufferOffset ) ; } } | Returns the DH offset from an array of bytes . |
6,476 | public int getDigestOffset ( int algorithm , byte [ ] handshake , int bufferOffset ) { switch ( algorithm ) { case 1 : return getDigestOffset2 ( handshake , bufferOffset ) ; default : case 0 : return getDigestOffset1 ( handshake , bufferOffset ) ; } } | Returns the digest offset using current validation scheme . |
6,477 | public final static boolean validHandshakeType ( byte handshakeType ) { switch ( handshakeType ) { case RTMPConnection . RTMP_NON_ENCRYPTED : case RTMPConnection . RTMP_ENCRYPTED : case RTMPConnection . RTMP_ENCRYPTED_XTEA : case RTMPConnection . RTMP_ENCRYPTED_BLOWFISH : case RTMPConnection . RTMP_ENCRYPTED_UNK : retu... | Returns whether or not a given handshake type is valid . |
6,478 | public boolean useEncryption ( ) { switch ( handshakeType ) { case RTMPConnection . RTMP_ENCRYPTED : case RTMPConnection . RTMP_ENCRYPTED_XTEA : case RTMPConnection . RTMP_ENCRYPTED_BLOWFISH : return true ; } return false ; } | Whether or not encryptions is in use . |
6,479 | public void setHandshakeType ( byte handshakeType ) { if ( log . isTraceEnabled ( ) ) { if ( handshakeType < HANDSHAKE_TYPES . length ) { log . trace ( "Setting handshake type: {}" , HANDSHAKE_TYPES [ handshakeType ] ) ; } else { log . trace ( "Invalid handshake type: {}" , handshakeType ) ; } } this . handshakeType = ... | Sets the handshake type . Currently only two types are supported plain and encrypted . |
6,480 | public void addBuffer ( IoBuffer in ) { byte [ ] tmp = new byte [ in . remaining ( ) ] ; in . get ( tmp ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "addBuffer - pos: {} limit: {} remain: {}" , buffer . position ( ) , buffer . limit ( ) , buffer . remaining ( ) ) ; } if ( buffer . remaining ( ) == 0 ) { buffer .... | Add a IoBuffer to the buffer . |
6,481 | public byte [ ] getBuffer ( ) { buffer . flip ( ) ; byte [ ] tmp = new byte [ buffer . remaining ( ) ] ; buffer . get ( tmp ) ; buffer . clear ( ) ; return tmp ; } | Returns buffered byte array . |
6,482 | private void moveToNext ( ) { if ( controller != null ) { currentItemIndex = controller . nextItem ( this , currentItemIndex ) ; } else { currentItemIndex = defaultController . nextItem ( this , currentItemIndex ) ; } } | Move the current item to the next in list . |
6,483 | private void moveToPrevious ( ) { if ( controller != null ) { currentItemIndex = controller . previousItem ( this , currentItemIndex ) ; } else { currentItemIndex = defaultController . previousItem ( this , currentItemIndex ) ; } } | Move the current item to the previous in list . |
6,484 | public static IVideoStreamCodec getVideoCodec ( IoBuffer data ) { IVideoStreamCodec result = null ; int codecId = data . get ( ) & 0x0f ; try { switch ( codecId ) { case 2 : result = ( IVideoStreamCodec ) Class . forName ( "org.red5.codec.SorensonVideo" ) . newInstance ( ) ; break ; case 3 : result = ( IVideoStreamCode... | Create and return new video codec applicable for byte buffer data |
6,485 | private String getStreamDirectory ( IScope scope ) { final StringBuilder result = new StringBuilder ( ) ; final IScope app = ScopeUtils . findApplication ( scope ) ; final String prefix = "streams/" ; while ( scope != null && scope != app ) { result . insert ( 0 , scope . getName ( ) + "/" ) ; scope = scope . getParent... | Generate stream directory based on relative scope path . The base directory is |
6,486 | public void cacheStatusObjects ( ) { cachedStatusObjects = new HashMap < String , byte [ ] > ( ) ; String statusCode ; IoBuffer out = IoBuffer . allocate ( 256 ) ; out . setAutoExpand ( true ) ; for ( String s : statusObjects . keySet ( ) ) { statusCode = s ; StatusObject statusObject = statusObjects . get ( statusCode... | Cache status objects |
6,487 | public void serializeStatusObject ( IoBuffer out , StatusObject statusObject ) { Map < ? , ? > statusMap = new BeanMap ( statusObject ) ; Output output = new Output ( out ) ; Serializer . serialize ( output , statusMap ) ; } | Serializes status object |
6,488 | @ SuppressWarnings ( "unchecked" ) public void runDeadlockFuture ( Runnable deadlockGuardTask ) { if ( deadlockFuture == null ) { ThreadPoolTaskScheduler deadlockGuard = conn . getDeadlockGuardScheduler ( ) ; if ( deadlockGuard != null ) { try { deadlockFuture = ( ScheduledFuture < Runnable > ) deadlockGuard . schedule... | Runs deadlock guard task |
6,489 | public static DynamicPlayItem build ( String name , long start , long length ) { DynamicPlayItem playItem = new DynamicPlayItem ( name , start , length ) ; return playItem ; } | Builder for DynamicPlayItem |
6,490 | public Notify getMetaData ( ) { Notify md = metaData . get ( ) ; if ( md != null ) { try { return md . duplicate ( ) ; } catch ( Exception e ) { } } return md ; } | Returns a copy of the metadata for the associated stream if it exists . |
6,491 | public void setState ( StreamState newState ) { StreamState oldState = state . get ( ) ; if ( ! oldState . equals ( newState ) && state . compareAndSet ( oldState , newState ) ) { fireStateChange ( oldState , newState ) ; } } | Sets the stream state . |
6,492 | protected IStreamAwareScopeHandler getStreamAwareHandler ( ) { if ( scope != null ) { IScopeHandler handler = scope . getHandler ( ) ; if ( handler instanceof IStreamAwareScopeHandler ) { return ( IStreamAwareScopeHandler ) handler ; } } return null ; } | Return stream aware scope handler or null if scope is null . |
6,493 | public IoBuffer encode ( Object message ) throws Exception { if ( message != null ) { try { return encodePacket ( ( Packet ) message ) ; } catch ( Exception e ) { log . error ( "Error encoding" , e ) ; } } else if ( log . isDebugEnabled ( ) ) { try { String callingMethod = Thread . currentThread ( ) . getStackTrace ( )... | Encodes object with given protocol state to byte buffer |
6,494 | public IoBuffer encodePacket ( Packet packet ) { IoBuffer out = null ; Header header = packet . getHeader ( ) ; int channelId = header . getChannelId ( ) ; IRTMPEvent message = packet . getMessage ( ) ; if ( message instanceof ChunkSize ) { ChunkSize chunkSizeMsg = ( ChunkSize ) message ; ( ( RTMPConnection ) Red5 . ge... | Encode packet . |
6,495 | private byte getHeaderType ( final Header header , final Header lastHeader ) { if ( lastHeader == null || header . getStreamId ( ) != lastHeader . getStreamId ( ) || header . getTimer ( ) < lastHeader . getTimer ( ) ) { return HEADER_NEW ; } else if ( header . getSize ( ) != lastHeader . getSize ( ) || header . getData... | Determine type of header to use . |
6,496 | private int calculateHeaderSize ( final Header header , final Header lastHeader ) { final byte headerType = getHeaderType ( header , lastHeader ) ; int channelIdAdd = 0 ; int channelId = header . getChannelId ( ) ; if ( channelId > 320 ) { channelIdAdd = 2 ; } else if ( channelId > 63 ) { channelIdAdd = 1 ; } return RT... | Calculate number of bytes necessary to encode the header . |
6,497 | public IoBuffer encodeHeader ( Header header , Header lastHeader ) { final IoBuffer result = IoBuffer . allocate ( calculateHeaderSize ( header , lastHeader ) ) ; encodeHeader ( header , lastHeader , result ) ; return result ; } | Encode RTMP header . |
6,498 | public void encodeHeader ( Header header , Header lastHeader , IoBuffer buf ) { byte headerType = getHeaderType ( header , lastHeader ) ; RTMPUtils . encodeHeaderByte ( buf , headerType , header . getChannelId ( ) ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "{} lastHeader: {}" , Header . HeaderType . values ( )... | Encode RTMP header into given IoBuffer . |
6,499 | private IoBuffer encodeServerBW ( ServerBW serverBW ) { final IoBuffer out = IoBuffer . allocate ( 4 ) ; out . putInt ( serverBW . getBandwidth ( ) ) ; return out ; } | Encode server - side bandwidth event . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.