idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
37,300
public void bind ( boolean isLocal , boolean rtcpMux ) throws IOException , IllegalStateException { this . rtpChannel . bind ( isLocal , rtcpMux ) ; if ( ! rtcpMux ) { this . rtcpChannel . bind ( isLocal , this . rtpChannel . getLocalPort ( ) + 1 ) ; } this . rtcpMux = rtcpMux ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " RTP channel " + this . ssrc + " is bound to " + this . rtpChannel . getLocalHost ( ) + ":" + this . rtpChannel . getLocalPort ( ) ) ; if ( rtcpMux ) { logger . debug ( this . mediaType + " is multiplexing RTCP" ) ; } else { logger . debug ( this . mediaType + " RTCP channel " + this . ssrc + " is bound to " + this . rtcpChannel . getLocalHost ( ) + ":" + this . rtcpChannel . getLocalPort ( ) ) ; } } }
Binds the RTP and RTCP components to a suitable address and port .
37,301
public void connectRtp ( SocketAddress address ) { this . rtpChannel . setRemotePeer ( address ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " RTP channel " + this . ssrc + " connected to remote peer " + address . toString ( ) ) ; } }
Connected the RTP component to the remote peer .
37,302
public void bindRtcp ( boolean isLocal , int port ) throws IOException , IllegalStateException { if ( this . ice ) { throw new IllegalStateException ( "Cannot bind when ICE is enabled" ) ; } this . rtcpChannel . bind ( isLocal , port ) ; this . rtcpMux = ( port == this . rtpChannel . getLocalPort ( ) ) ; }
Binds the RTCP component to a suitable address and port .
37,303
public void connectRtcp ( SocketAddress remoteAddress ) { this . rtcpChannel . setRemotePeer ( remoteAddress ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " RTCP channel " + this . ssrc + " has connected to remote peer " + remoteAddress . toString ( ) ) ; } }
Connects the RTCP component to the remote peer .
37,304
protected RTPFormats buildRTPMap ( RTPFormats profile ) { RTPFormats list = new RTPFormats ( ) ; Formats fmts = new Formats ( ) ; if ( this . rtpChannel . getOutputDsp ( ) != null ) { Codec [ ] currCodecs = this . rtpChannel . getOutputDsp ( ) . getCodecs ( ) ; for ( int i = 0 ; i < currCodecs . length ; i ++ ) { if ( currCodecs [ i ] . getSupportedInputFormat ( ) . matches ( LINEAR_FORMAT ) ) { fmts . add ( currCodecs [ i ] . getSupportedOutputFormat ( ) ) ; } } } fmts . add ( DTMF_FORMAT ) ; if ( fmts != null ) { for ( int i = 0 ; i < fmts . size ( ) ; i ++ ) { RTPFormat f = profile . find ( fmts . get ( i ) ) ; if ( f != null ) { list . add ( f . clone ( ) ) ; } } } return list ; }
Constructs RTP payloads for given channel .
37,305
public void negotiateFormats ( MediaDescriptionField media ) { this . offeredFormats . clean ( ) ; for ( String payloadType : media . getPayloadTypes ( ) ) { RTPFormat format ; try { int payloadTypeInt = Integer . parseInt ( payloadType ) ; if ( payloadTypeInt < AVProfile . DYNAMIC_PT_MIN || payloadTypeInt > AVProfile . DYNAMIC_PT_MAX ) { format = AVProfile . getFormat ( payloadTypeInt , AVProfile . AUDIO ) ; } else { final RtpMapAttribute codecSdp = media . getFormat ( payloadTypeInt ) ; final String codecName = codecSdp . getCodec ( ) ; final RTPFormat staticFormat = AVProfile . getFormat ( codecName ) ; final boolean supported = staticFormat != null && staticFormat . getClockRate ( ) == codecSdp . getClockRate ( ) ; if ( supported ) { format = new RTPFormat ( payloadTypeInt , staticFormat . getFormat ( ) , staticFormat . getClockRate ( ) ) ; } else { format = null ; } } } catch ( NumberFormatException e ) { format = null ; } if ( format != null ) { this . offeredFormats . add ( format ) ; } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " channel " + this . ssrc + " dropped unsupported RTP payload type " + payloadType ) ; } } } this . negotiatedFormats . clean ( ) ; this . supportedFormats . intersection ( this . offeredFormats , this . negotiatedFormats ) ; setFormats ( this . negotiatedFormats ) ; this . negotiated = true ; }
Negotiates the list of supported codecs with the remote peer over SDP .
37,306
public void enableICE ( String externalAddress , boolean rtcpMux ) { if ( ! this . ice ) { this . ice = true ; this . rtcpMux = rtcpMux ; this . iceAuthenticator . generateIceCredentials ( ) ; this . rtpChannel . enableIce ( this . iceAuthenticator ) ; if ( ! rtcpMux ) { this . rtcpChannel . enableIce ( this . iceAuthenticator ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " channel " + this . ssrc + " enabled ICE" ) ; } } }
Enables ICE on the channel .
37,307
public void disableICE ( ) { if ( this . ice ) { this . ice = false ; this . iceAuthenticator . reset ( ) ; this . rtpChannel . disableIce ( ) ; if ( ! rtcpMux ) { this . rtcpChannel . disableIce ( ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " channel " + this . ssrc + " disabled ICE" ) ; } } }
Disables ICE and closes ICE - related resources
37,308
public void disableDTLS ( ) { if ( this . dtls ) { this . rtpChannel . disableSRTP ( ) ; if ( ! this . rtcpMux ) { this . rtcpChannel . disableSRTCP ( ) ; } this . dtls = false ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " channel " + this . ssrc + " disabled DTLS" ) ; } } }
Disables DTLS and closes related resources .
37,309
public static long calculateLastSrTimestamp ( long ntp1 , long ntp2 ) { byte [ ] high = uIntLongToByteWord ( ntp1 ) ; byte [ ] low = uIntLongToByteWord ( ntp2 ) ; low [ 3 ] = low [ 1 ] ; low [ 2 ] = low [ 0 ] ; low [ 1 ] = high [ 3 ] ; low [ 0 ] = high [ 2 ] ; return bytesToUIntLong ( low , 0 ) ; }
Calculates the time stamp of the last received SR .
37,310
private static byte [ ] uIntLongToByteWord ( long j ) { int i = ( int ) j ; byte [ ] byteWord = new byte [ 4 ] ; byteWord [ 0 ] = ( byte ) ( ( i >>> 24 ) & 0x000000FF ) ; byteWord [ 1 ] = ( byte ) ( ( i >> 16 ) & 0x000000FF ) ; byteWord [ 2 ] = ( byte ) ( ( i >> 8 ) & 0x000000FF ) ; byteWord [ 3 ] = ( byte ) ( i & 0x00FF ) ; return byteWord ; }
Converts an unsigned 32 bit integer stored in a long into an array of bytes .
37,311
public void commit ( ) throws IOException { if ( open . compareAndSet ( true , false ) ) { fout . force ( true ) ; fout . close ( ) ; boolean exists = Files . exists ( target ) ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "Finishing recording ...... append: " + append + " exists: " + exists + " target:" + target ) ; } if ( append && exists ) { appendSamples ( target , temp ) ; writeHeader ( target ) ; Files . delete ( temp ) ; } else { writeHeader ( temp ) ; Files . move ( temp , target , StandardCopyOption . REPLACE_EXISTING ) ; } } }
Commit this sink . Causes to prevent any further write operations and commits temporary file to target . When this returns Sink is done and cannot be used again .
37,312
protected void release ( ) { stack . getLocalTransactions ( ) . remove ( Integer . valueOf ( localTID ) ) ; stack . getRemoteTxToLocalTxMap ( ) . remove ( Integer . valueOf ( remoteTID ) ) ; cancelTHISTTimerTask ( ) ; cancelLongtranTimer ( ) ; cancelReTransmissionTimer ( ) ; if ( originalPacket != null ) stack . releasePacket ( originalPacket ) ; originalPacket = null ; }
Release this transaction and frees all allocated resources .
37,313
private void send ( JainMgcpCommandEvent event ) { sent = true ; String host = "" ; int port = 0 ; switch ( event . getObjectIdentifier ( ) ) { case Constants . CMD_NOTIFY : Notify notifyCommand = ( Notify ) event ; NotifiedEntity notifiedEntity = notifyCommand . getNotifiedEntity ( ) ; if ( notifiedEntity == null ) { notifiedEntity = this . stack . provider . getNotifiedEntity ( ) ; } port = notifiedEntity . getPortNumber ( ) ; host += notifiedEntity . getDomainName ( ) ; break ; case Constants . CMD_DELETE_CONNECTION : case Constants . CMD_RESTART_IN_PROGRESS : if ( remoteAddress != null ) { host = remoteAddress . getHostAddress ( ) ; port = remotePort ; break ; } default : String domainName = event . getEndpointIdentifier ( ) . getDomainName ( ) ; int pos = domainName . indexOf ( ':' ) ; if ( pos > 0 ) { port = Integer . parseInt ( domainName . substring ( pos + 1 ) ) ; host = domainName . substring ( 0 , pos ) ; } else { port = 2427 ; host = domainName ; } break ; } InetAddress address = null ; try { address = InetAddress . getByName ( host ) ; } catch ( UnknownHostException e ) { throw new IllegalArgumentException ( "Unknown endpoint " + host ) ; } remoteTID = event . getTransactionHandle ( ) ; source = event . getSource ( ) ; event . setTransactionHandle ( localTID ) ; if ( originalPacket == null ) originalPacket = stack . allocatePacket ( ) ; originalPacket . setLength ( encode ( event , originalPacket . getRawData ( ) ) ) ; InetSocketAddress inetSocketAddress = new InetSocketAddress ( address , port ) ; originalPacket . setRemoteAddress ( inetSocketAddress ) ; resetReTransmissionTimer ( ) ; resetTHISTTimerTask ( false ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( "Send command event to " + address + "remote TX ID:" + remoteTID + ", message\n" + new String ( originalPacket . getRawData ( ) , 0 , originalPacket . getLength ( ) ) ) ; countOfCommandRetransmitted ++ ; stack . send ( originalPacket ) ; }
Sends MGCP command from the application to the endpoint specified in the message .
37,314
private void send ( JainMgcpResponseEvent event ) { cancelLongtranTimer ( ) ; if ( remoteAddress == null ) { throw new IllegalArgumentException ( "Unknown orinator address" ) ; } event . setTransactionHandle ( remoteTID ) ; if ( originalPacket == null ) originalPacket = stack . allocatePacket ( ) ; originalPacket . setLength ( encode ( event , originalPacket . getRawData ( ) ) ) ; InetSocketAddress inetSocketAddress = new InetSocketAddress ( remoteAddress , remotePort ) ; originalPacket . setRemoteAddress ( inetSocketAddress ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "--- TransactionHandler:" + this + " :LocalID=" + localTID + ", Send response event to " + remoteAddress + ":" + remotePort + ", message\n" + new String ( originalPacket . getRawData ( ) , 0 , originalPacket . getLength ( ) ) ) ; } stack . send ( originalPacket ) ; if ( isProvisional ( event . getReturnCode ( ) ) ) { resetLongtranTimer ( ) ; } else { release ( ) ; stack . getCompletedTransactions ( ) . put ( Integer . valueOf ( event . getTransactionHandle ( ) ) , this ) ; resetTHISTTimerTask ( true ) ; } }
Sends MGCP response message from the application to the host from wich origination command was received .
37,315
public void receiveResponse ( byte [ ] data , SplitDetails [ ] msg , Integer txID , ReturnCode returnCode ) { cancelReTransmissionTimer ( ) ; cancelLongtranTimer ( ) ; JainMgcpResponseEvent event = null ; try { event = decodeResponse ( data , msg , txID , returnCode ) ; } catch ( Exception e ) { logger . error ( "Could not decode message: " , e ) ; } event . setTransactionHandle ( remoteTID ) ; if ( this . isProvisional ( event . getReturnCode ( ) ) ) resetLongtranTimer ( ) ; stack . provider . processMgcpResponseEvent ( event , commandEvent ) ; if ( ! this . isProvisional ( event . getReturnCode ( ) ) ) this . release ( ) ; }
Used by stack for relaying received MGCP response messages to the application .
37,316
private void fireEvent ( RecorderEventImpl event ) { eventSender . event = event ; scheduler . submit ( eventSender , PriorityQueueScheduler . INPUT_QUEUE ) ; }
Fires specified event
37,317
public void accept ( Task task ) { if ( ( activeIndex + 1 ) % 2 == 0 ) { if ( ! task . isInQueue0 ( ) ) { taskList [ 0 ] . offer ( task ) ; task . storedInQueue0 ( ) ; } } else { if ( ! task . isInQueue1 ( ) ) { taskList [ 1 ] . offer ( task ) ; task . storedInQueue1 ( ) ; } } }
Queues specified task using tasks dead line time .
37,318
public boolean reverseTransformPacket ( RawPacket pkt ) { boolean decrypt = false ; int tagLength = policy . getAuthTagLength ( ) ; int indexEflag = pkt . getSRTCPIndex ( tagLength ) ; if ( ( indexEflag & 0x80000000 ) == 0x80000000 ) { decrypt = true ; } int index = indexEflag & ~ 0x80000000 ; if ( ! checkReplay ( index ) ) { return false ; } if ( policy . getAuthType ( ) != SRTPPolicy . NULL_AUTHENTICATION ) { pkt . readRegionToBuff ( pkt . getLength ( ) - tagLength , tagLength , tempStore ) ; pkt . shrink ( tagLength + 4 ) ; authenticatePacket ( pkt , indexEflag ) ; for ( int i = 0 ; i < tagLength ; i ++ ) { if ( ( tempStore [ i ] & 0xff ) == ( tagStore [ i ] & 0xff ) ) { continue ; } else { return false ; } } } if ( decrypt ) { if ( policy . getEncType ( ) == SRTPPolicy . AESCM_ENCRYPTION || policy . getEncType ( ) == SRTPPolicy . TWOFISH_ENCRYPTION ) { processPacketAESCM ( pkt , index ) ; } else if ( policy . getEncType ( ) == SRTPPolicy . AESF8_ENCRYPTION || policy . getEncType ( ) == SRTPPolicy . TWOFISHF8_ENCRYPTION ) { processPacketAESF8 ( pkt , index ) ; } } update ( index ) ; return true ; }
Transform a SRTCP packet into a RTCP packet . This method is called when a SRTCP packet was received .
37,319
private void computeIv ( byte label ) { for ( int i = 0 ; i < 14 ; i ++ ) { ivStore [ i ] = masterSalt [ i ] ; } ivStore [ 7 ] ^= label ; ivStore [ 14 ] = ivStore [ 15 ] = 0 ; }
Compute the initialization vector used later by encryption algorithms based on the label .
37,320
public void deriveSrtcpKeys ( ) { byte label = 3 ; computeIv ( label ) ; KeyParameter encryptionKey = new KeyParameter ( masterKey ) ; cipher . init ( true , encryptionKey ) ; Arrays . fill ( masterKey , ( byte ) 0 ) ; cipherCtr . getCipherStream ( cipher , encKey , policy . getEncKeyLength ( ) , ivStore ) ; if ( authKey != null ) { label = 4 ; computeIv ( label ) ; cipherCtr . getCipherStream ( cipher , authKey , policy . getAuthKeyLength ( ) , ivStore ) ; switch ( ( policy . getAuthType ( ) ) ) { case SRTPPolicy . HMACSHA1_AUTHENTICATION : KeyParameter key = new KeyParameter ( authKey ) ; mac . init ( key ) ; break ; default : break ; } } Arrays . fill ( authKey , ( byte ) 0 ) ; label = 5 ; computeIv ( label ) ; cipherCtr . getCipherStream ( cipher , saltKey , policy . getSaltKeyLength ( ) , ivStore ) ; Arrays . fill ( masterSalt , ( byte ) 0 ) ; if ( cipherF8 != null ) { SRTPCipherF8 . deriveForIV ( cipherF8 , encKey , saltKey ) ; } encryptionKey = new KeyParameter ( encKey ) ; cipher . init ( true , encryptionKey ) ; Arrays . fill ( encKey , ( byte ) 0 ) ; }
Derives the srtcp session keys from the master key .
37,321
public static TransportAddress applyXor ( TransportAddress address , byte [ ] transactionID ) { byte [ ] addressBytes = address . getAddressBytes ( ) ; char port = ( char ) address . getPort ( ) ; char portModifier = ( char ) ( ( transactionID [ 0 ] << 8 & 0x0000FF00 ) | ( transactionID [ 1 ] & 0x000000FF ) ) ; port ^= portModifier ; for ( int i = 0 ; i < addressBytes . length ; i ++ ) { addressBytes [ i ] ^= transactionID [ i ] ; } try { TransportAddress xoredAdd = new TransportAddress ( InetAddress . getByAddress ( addressBytes ) , port , TransportProtocol . UDP ) ; return xoredAdd ; } catch ( UnknownHostException e ) { throw new IllegalArgumentException ( e ) ; } }
Returns the result of applying XOR on the specified attribute s address . The method may be used for both encoding and decoding XorMappedAddresses .
37,322
public TransportAddress getAddress ( byte [ ] transactionID ) { byte [ ] xorMask = new byte [ 16 ] ; System . arraycopy ( StunMessage . MAGIC_COOKIE , 0 , xorMask , 0 , 4 ) ; System . arraycopy ( transactionID , 0 , xorMask , 4 , 12 ) ; return applyXor ( xorMask ) ; }
Returns the result of applying XOR on this attribute s address using the specified transaction ID when converting IPv6 addresses .
37,323
public void setAddress ( TransportAddress address , byte [ ] transactionID ) { byte [ ] xorMask = new byte [ 16 ] ; System . arraycopy ( StunMessage . MAGIC_COOKIE , 0 , xorMask , 0 , 4 ) ; System . arraycopy ( transactionID , 0 , xorMask , 4 , 12 ) ; TransportAddress xorAddress = applyXor ( address , xorMask ) ; super . setAddress ( xorAddress ) ; }
Applies a XOR mask to the specified address and then sets it as the value transported by this attribute .
37,324
public void setErrorClass ( byte errorClass ) throws IllegalArgumentException { if ( errorClass < 0 || errorClass > 99 ) { throw new IllegalArgumentException ( errorClass + "Only error classes between 0 and 99 are valid. Current class: " + errorClass ) ; } this . errorClass = errorClass ; }
Sets the class of the error .
37,325
public static String getDefaultReasonPhrase ( char errorCode ) { switch ( errorCode ) { case BAD_REQUEST : return "(Bad Request): The request was malformed. The client should not " + "retry the request without modification from the previous attempt." ; case UNAUTHORIZED : return "(Unauthorized): The Binding Request did not contain a MESSAGE-" + "INTEGRITY attribute." ; case UNKNOWN_ATTRIBUTE : return "(Unknown Attribute): The server did not understand a mandatory " + "attribute in the request." ; case STALE_CREDENTIALS : return "(Stale Credentials): The Binding Request did contain a MESSAGE-" + "INTEGRITY attribute, but it used a shared secret that has " + "expired. The client should obtain a new shared secret and try" + "again" ; case INTEGRITY_CHECK_FAILURE : return "(Integrity Check Failure): The Binding Request contained a " + "MESSAGE-INTEGRITY attribute, but the HMAC failed verification. " + "This could be a sign of a potential attack, or client " + "implementation error." ; case MISSING_USERNAME : return "(Missing Username): The Binding Request contained a MESSAGE-" + "INTEGRITY attribute, but not a USERNAME attribute. Both must be" + "present for integrity checks." ; case USE_TLS : return "(Use TLS): The Shared Secret request has to be sent over TLS, but" + "was not received over TLS." ; case SERVER_ERROR : return "(Server Error): The server has suffered a temporary error. The" + "client should try again." ; case GLOBAL_FAILURE : return "(Global Failure:) The server is refusing to fulfill the request." + "The client should not retry." ; default : return "Unknown Error" ; } }
Returns a default reason phrase corresponding to the specified error code as described by rfc 3489 .
37,326
public void write ( RtpPacket packet , RTPFormat format ) { if ( format == null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "No format specified. Packet dropped!" ) ; } return ; } boolean locked = false ; try { locked = this . lock . tryLock ( ) || this . lock . tryLock ( 5 , TimeUnit . MILLISECONDS ) ; if ( locked ) { safeWrite ( packet , format ) ; } } catch ( InterruptedException e ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Could not aquire write lock for jitter buffer. Dropped packet." ) ; } } finally { if ( locked ) { this . lock . unlock ( ) ; } } }
Accepts specified packet
37,327
public Frame read ( long timestamp ) { Frame frame = null ; boolean locked = false ; try { locked = this . lock . tryLock ( ) || this . lock . tryLock ( 5 , TimeUnit . MILLISECONDS ) ; if ( locked ) { frame = safeRead ( ) ; } else { this . ready . set ( false ) ; } } catch ( InterruptedException e ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Could not acquire reading lock for jitter buffer." ) ; } this . ready . set ( false ) ; } finally { if ( locked ) { lock . unlock ( ) ; } } return frame ; }
Polls packet from buffer s head .
37,328
public void reset ( ) { boolean locked = false ; try { locked = lock . tryLock ( ) || lock . tryLock ( 5 , TimeUnit . MILLISECONDS ) ; if ( locked ) { while ( queue . size ( ) > 0 ) { queue . remove ( 0 ) . recycle ( ) ; } } } catch ( InterruptedException e ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Could not acquire lock to reset jitter buffer." ) ; } } finally { if ( locked ) { lock . unlock ( ) ; } } }
Resets buffer .
37,329
public void addFieldParser ( char type , SdpParser < ? extends SdpField > parser ) { synchronized ( this . fieldParsers ) { this . fieldParsers . put ( type , parser ) ; } }
Adds a parser to the pipeline .
37,330
public void addAttributeParser ( String type , SdpParser < ? extends AttributeField > parser ) { synchronized ( this . attributeParsers ) { this . attributeParsers . put ( type , parser ) ; } }
Adds an attribute parser to the pipeline .
37,331
private Transition find ( String name ) { for ( Transition t : transitions ) { if ( t . getName ( ) . matches ( name ) ) { return t ; } } return null ; }
Searches transition with specified name .
37,332
public void joinRtpSession ( ) { if ( ! this . joined . get ( ) ) { long t = this . statistics . rtcpInterval ( this . initial . get ( ) ) ; this . tn = this . statistics . getCurrentTime ( ) + t ; scheduleRtcp ( this . tn , RtcpPacketType . RTCP_REPORT ) ; this . ssrcTaskFuture = this . scheduler . scheduleWithFixedDelay ( ssrcTask , SSRC_TASK_DELAY , SSRC_TASK_DELAY , TimeUnit . MILLISECONDS ) ; this . joined . set ( true ) ; } }
Upon joining the session the participant initializes tp to 0 tc to 0 senders to 0 pmembers to 1 members to 1 we_sent to false rtcp_bw to the specified fraction of the session bandwidth initial to true and avg_rtcp_size to the probable size of the first RTCP packet that the application will later construct .
37,333
private void scheduleRtcp ( long timestamp , RtcpPacketType packetType ) { long interval = resolveInterval ( timestamp ) ; this . scheduledTask = new TxTask ( packetType ) ; try { this . reportTaskFuture = this . scheduler . schedule ( this . scheduledTask , interval , TimeUnit . MILLISECONDS ) ; this . statistics . setRtcpPacketType ( packetType ) ; } catch ( IllegalStateException e ) { logger . warn ( "RTCP timer already canceled. No more reports will be scheduled." ) ; } }
Schedules an event to occur at a certain time .
37,334
private void rescheduleRtcp ( TxTask task , long timestamp ) { this . reportTaskFuture . cancel ( true ) ; long interval = resolveInterval ( timestamp ) ; try { this . reportTaskFuture = this . scheduler . schedule ( task , interval , TimeUnit . MILLISECONDS ) ; } catch ( IllegalStateException e ) { logger . warn ( "RTCP timer already canceled. Scheduled report was canceled and cannot be re-scheduled." ) ; } }
Re - schedules a previously scheduled event .
37,335
private void closeChannel ( ) { if ( this . channel != null ) { if ( this . channel . isConnected ( ) ) { try { this . channel . disconnect ( ) ; } catch ( IOException e ) { logger . warn ( e . getMessage ( ) , e ) ; } } if ( this . channel . isOpen ( ) ) { try { this . channel . close ( ) ; } catch ( IOException e ) { logger . warn ( e . getMessage ( ) , e ) ; } } } }
Disconnects and closes the datagram channel used to send and receive RTCP traffic .
37,336
private boolean decode_WSP ( ) { boolean decoded = false ; if ( index < totalChars && ( chars [ index ] == 0x20 || chars [ index ] == 0x09 ) ) { index ++ ; decoded = true ; } return decoded ; }
Decode Space or HTAB
37,337
public double [ ] perform ( double [ ] buffer , int len ) { int size = ( int ) ( ( double ) F / f * len ) ; double signal [ ] = new double [ size ] ; double dx = 1. / ( double ) f ; double dX = 1. / ( double ) F ; signal [ 0 ] = buffer [ 0 ] ; double k = 0 ; for ( int i = 1 ; i < size - 1 ; i ++ ) { double X = i * dX ; int p = ( int ) ( X / dx ) ; int q = p + 1 ; k = ( buffer [ q ] - buffer [ p ] ) / dx ; double x = p * dx ; signal [ i ] = buffer [ p ] + ( X - x ) * k ; } signal [ size - 1 ] = buffer [ len - 1 ] + ( ( size - 1 ) * dX - ( len - 1 ) * dx ) * k ; return signal ; }
Performs resampling of the given signal .
37,338
public void strain ( byte [ ] data , int pos , int len ) { this . chars = data ; this . pos = pos ; this . len = len ; this . linePointer = 0 ; }
Strains this object into the memory area .
37,339
public void duplicate ( Text destination ) { System . arraycopy ( chars , pos , destination . chars , destination . pos , len ) ; destination . len = len ; }
Copies data from this buffer to another buffer .
37,340
public int divide ( char separator , Text [ ] parts ) { int pointer = pos ; int limit = pos + len ; int mark = pointer ; int count = 0 ; while ( pointer < limit ) { if ( chars [ pointer ] == separator ) { parts [ count ] . strain ( chars , mark , pointer - mark ) ; mark = pointer + 1 ; count ++ ; if ( count == parts . length - 1 ) { break ; } } pointer ++ ; } if ( limit > mark ) { parts [ count ] . strain ( chars , mark , limit - mark ) ; count ++ ; } return count ; }
Divides text into parts using given separator and writes results into the parts array .
37,341
public void trim ( ) { try { while ( len > 0 && chars [ pos ] == ' ' ) { pos ++ ; len -- ; } while ( len > 0 && ( chars [ pos + len - 1 ] == ' ' || chars [ pos + len - 1 ] == '\n' || chars [ pos + len - 1 ] == '\r' ) ) { len -- ; } } catch ( Exception e ) { System . out . println ( "len:" + len + ",pos:" + pos ) ; } }
Removes whitespace from the head and tail of the string .
37,342
public Text nextLine ( ) { if ( linePointer == 0 ) { linePointer = pos ; } else { linePointer ++ ; } int mark = linePointer ; int limit = pos + len ; while ( linePointer < limit && chars [ linePointer ] != '\n' ) { linePointer ++ ; } return new Text ( chars , mark , linePointer - mark ) ; }
Extracts next line from this text .
37,343
private boolean compareChars ( byte [ ] chars , int pos ) { for ( int i = 0 ; i < len ; i ++ ) { if ( differentChars ( ( char ) this . chars [ i + this . pos ] , ( char ) chars [ i + pos ] ) ) return false ; } return true ; }
Compares specified character string with current string . The upper and lower case characters are considered as equals .
37,344
public boolean startsWith ( Text pattern ) { if ( pattern == null ) { return false ; } return this . subSequence ( 0 , pattern . len ) . equals ( pattern ) ; }
Indicates whether the text starts with a certain pattern .
37,345
private boolean differentChars ( char c1 , char c2 ) { if ( 65 <= c1 && c1 < 97 ) { c1 += 32 ; } if ( 65 <= c2 && c2 < 97 ) { c2 += 32 ; } return c1 != c2 ; }
Compares two chars .
37,346
public int toInteger ( ) throws NumberFormatException { int res = 0 ; byte currChar ; int i = 1 ; currChar = chars [ pos ] ; boolean isMinus = false ; if ( currChar == minus_byte ) isMinus = true ; else if ( currChar >= zero_byte && currChar <= nine_byte ) res += currChar - zero_byte ; else throw new NumberFormatException ( "value is not numeric" ) ; for ( ; i < len ; i ++ ) { currChar = chars [ pos + i ] ; if ( currChar >= zero_byte && currChar <= nine_byte ) { res *= 10 ; res += currChar - zero_byte ; } else throw new NumberFormatException ( "value is not numeric" ) ; } if ( isMinus ) return 0 - res ; else return res ; }
Converts string value to integer
37,347
public void copyRemainder ( Text other ) { other . chars = this . chars ; other . pos = this . linePointer + 1 ; other . len = this . len - this . linePointer - 1 ; }
Copies substring from the current line upto the end to the specified destination .
37,348
public boolean contains ( char c ) { for ( int k = pos ; k < len ; k ++ ) { if ( chars [ k ] == c ) return true ; } return false ; }
Checks does specified symbol is present in this text .
37,349
public void attach ( RequestIdentifier reqID , JainMgcpListener listener ) { this . requestListeners . put ( reqID . toString ( ) . trim ( ) , listener ) ; }
Attaches listener to the specific request .
37,350
public void deattach ( JainMgcpListener listener ) { int identifier = - 1 ; Set < Integer > IDs = txListeners . keySet ( ) ; for ( Integer id : IDs ) { if ( txListeners . get ( id ) == listener ) { identifier = id ; break ; } } if ( identifier != - 1 ) { txListeners . remove ( identifier ) ; } }
Deattaches transaction listener upon user request .
37,351
public boolean isSenderTimeout ( ) { long t = rtcpReceiverInterval ( false ) ; long minTime = getCurrentTime ( ) - ( 2 * t ) ; if ( this . rtpSentOn < minTime ) { removeSender ( this . ssrc ) ; } return this . weSent ; }
Checks whether this SSRC is still a sender .
37,352
public void strain ( Text line ) throws ParseException { try { Iterator < Text > it = line . split ( '=' ) . iterator ( ) ; it . next ( ) ; Text token = it . next ( ) ; it = token . split ( ' ' ) . iterator ( ) ; name = it . next ( ) ; name . trim ( ) ; sessionID = it . next ( ) ; sessionID . trim ( ) ; sessionVersion = it . next ( ) ; sessionVersion . trim ( ) ; networkType = it . next ( ) ; networkType . trim ( ) ; addressType = it . next ( ) ; addressType . trim ( ) ; address = it . next ( ) ; address . trim ( ) ; } catch ( Exception e ) { throw new ParseException ( "Could not parse origin" , 0 ) ; } }
Reads attribute from text .
37,353
private void setupAudioChannelInbound ( MediaDescriptionField remoteAudio ) throws IOException { this . audioChannel . negotiateFormats ( remoteAudio ) ; if ( ! this . audioChannel . containsNegotiatedFormats ( ) ) { throw new IOException ( "Audio codecs were not supported" ) ; } this . audioChannel . bind ( false , remoteAudio . isRtcpMux ( ) ) ; boolean enableIce = remoteAudio . containsIce ( ) ; if ( enableIce ) { this . audioChannel . enableICE ( this . externalAddress , remoteAudio . isRtcpMux ( ) ) ; } else { String remoteAddr = remoteAudio . getConnection ( ) . getAddress ( ) ; this . audioChannel . connectRtp ( remoteAddr , remoteAudio . getPort ( ) ) ; this . audioChannel . connectRtcp ( remoteAddr , remoteAudio . getRtcpPort ( ) ) ; } boolean enableDtls = this . remoteSdp . containsDtls ( ) ; if ( enableDtls ) { FingerprintAttribute fingerprint = this . remoteSdp . getFingerprint ( audioChannel . getMediaType ( ) ) ; this . audioChannel . enableDTLS ( fingerprint . getHashFunction ( ) , fingerprint . getFingerprint ( ) ) ; } }
Reads the remote SDP offer and sets up the available resources according to the call type .
37,354
private void setupAudioChannelOutbound ( MediaDescriptionField remoteAudio ) throws IOException { this . audioChannel . negotiateFormats ( remoteAudio ) ; if ( ! this . audioChannel . containsNegotiatedFormats ( ) ) { throw new IOException ( "Audio codecs were not supported" ) ; } String remoteRtpAddress = remoteAudio . getConnection ( ) . getAddress ( ) ; int remoteRtpPort = remoteAudio . getPort ( ) ; boolean connectNow = ! ( this . outbound && audioChannel . isIceEnabled ( ) ) ; if ( connectNow ) { this . audioChannel . connectRtp ( remoteRtpAddress , remoteRtpPort ) ; boolean remoteRtcpMux = remoteAudio . isRtcpMux ( ) ; if ( remoteRtcpMux ) { this . audioChannel . connectRtcp ( remoteRtpAddress , remoteRtpPort ) ; } else { RtcpAttribute remoteRtcp = remoteAudio . getRtcp ( ) ; if ( remoteRtcp == null ) { this . audioChannel . connectRtcp ( remoteRtpAddress , remoteRtpPort + 1 ) ; } else { String remoteRtcpAddress = remoteRtcp . getAddress ( ) ; if ( remoteRtcpAddress == null ) { remoteRtcpAddress = remoteRtpAddress ; } int remoteRtcpPort = remoteRtcp . getPort ( ) ; this . audioChannel . connectRtcp ( remoteRtcpAddress , remoteRtcpPort ) ; } } } }
Reads the remote SDP answer and sets up the proper media channels .
37,355
public boolean removeHandler ( PacketHandler handler ) { synchronized ( this . handlers ) { boolean removed = this . handlers . remove ( handler ) ; if ( removed ) { this . count . decrementAndGet ( ) ; } return removed ; } }
Removes an existing packet handler from the pipeline .
37,356
public PacketHandler getHandler ( byte [ ] packet ) { synchronized ( this . handlers ) { for ( PacketHandler protocolHandler : this . handlers ) { if ( protocolHandler . canHandle ( packet ) ) { return protocolHandler ; } } return null ; } }
Gets the protocol handler capable of processing the packet .
37,357
public void close ( ) { stopped = true ; try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Closing socket" ) ; } socket . close ( ) ; if ( this . channel != null ) { this . channel . close ( ) ; } for ( int i = 0 ; i < decodingThreads . length ; i ++ ) { decodingThreads [ i ] . shutdown ( ) ; } } catch ( Exception e ) { if ( logger . isErrorEnabled ( ) ) { logger . error ( "Could not gracefully close socket" , e ) ; } } }
Closes the stack and it s underlying resources .
37,358
public boolean reverseTransformPacket ( RawPacket pkt ) { int seqNo = pkt . getSequenceNumber ( ) ; if ( ! seqNumSet ) { seqNumSet = true ; seqNum = seqNo ; } long guessedIndex = guessIndex ( seqNo ) ; if ( ! checkReplay ( seqNo , guessedIndex ) ) { return false ; } if ( policy . getAuthType ( ) != SRTPPolicy . NULL_AUTHENTICATION ) { int tagLength = policy . getAuthTagLength ( ) ; pkt . readRegionToBuff ( pkt . getLength ( ) - tagLength , tagLength , tempStore ) ; pkt . shrink ( tagLength ) ; authenticatePacketHMCSHA1 ( pkt , guessedROC ) ; for ( int i = 0 ; i < tagLength ; i ++ ) { if ( ( tempStore [ i ] & 0xff ) != ( tagStore [ i ] & 0xff ) ) { return false ; } } } switch ( policy . getEncType ( ) ) { case SRTPPolicy . AESCM_ENCRYPTION : case SRTPPolicy . TWOFISH_ENCRYPTION : processPacketAESCM ( pkt ) ; break ; case SRTPPolicy . AESF8_ENCRYPTION : case SRTPPolicy . TWOFISHF8_ENCRYPTION : processPacketAESF8 ( pkt ) ; break ; default : return false ; } update ( seqNo , guessedIndex ) ; return true ; }
Transform a SRTP packet into a RTP packet . This method is called when a SRTP packet is received .
37,359
private void authenticatePacketHMCSHA1 ( RawPacket pkt , int rocIn ) { ByteBuffer buf = pkt . getBuffer ( ) ; buf . rewind ( ) ; int len = buf . remaining ( ) ; buf . get ( tempBuffer , 0 , len ) ; mac . update ( tempBuffer , 0 , len ) ; rbStore [ 0 ] = ( byte ) ( rocIn >> 24 ) ; rbStore [ 1 ] = ( byte ) ( rocIn >> 16 ) ; rbStore [ 2 ] = ( byte ) ( rocIn >> 8 ) ; rbStore [ 3 ] = ( byte ) rocIn ; mac . update ( rbStore , 0 , rbStore . length ) ; mac . doFinal ( tagStore , 0 ) ; }
Authenticate a packet . Calculated authentication tag is returned .
37,360
private void computeIv ( long label , long index ) { long key_id ; if ( keyDerivationRate == 0 ) { key_id = label << 48 ; } else { key_id = ( ( label << 48 ) | ( index / keyDerivationRate ) ) ; } for ( int i = 0 ; i < 7 ; i ++ ) { ivStore [ i ] = masterSalt [ i ] ; } for ( int i = 7 ; i < 14 ; i ++ ) { ivStore [ i ] = ( byte ) ( ( byte ) ( 0xFF & ( key_id >> ( 8 * ( 13 - i ) ) ) ) ^ masterSalt [ i ] ) ; } ivStore [ 14 ] = ivStore [ 15 ] = 0 ; }
Compute the initialization vector used later by encryption algorithms based on the lable the packet index key derivation rate and master salt key .
37,361
public Dsp newProcessor ( ) throws InstantiationException , ClassNotFoundException , IllegalAccessException { int numClasses = this . classes . size ( ) ; Codec [ ] codecs = new Codec [ numClasses ] ; for ( int i = 0 ; i < numClasses ; i ++ ) { String fqn = this . classes . get ( i ) ; Class < ? > codecClass = DspFactoryImpl . class . getClassLoader ( ) . loadClass ( fqn ) ; codecs [ i ] = ( Codec ) codecClass . newInstance ( ) ; } return new Dsp ( codecs ) ; }
Creates new DSP .
37,362
private Node < E > extract ( ) { Node < E > current = head ; head = head . next ; current . item = head . item ; head . item = null ; return current ; }
Removes a node from head of queue
37,363
private void estimateJitter ( RtpPacket packet ) { long transit = rtpClock . getLocalRtpTime ( ) - packet . getTimestamp ( ) ; long d = transit - this . currentTransit ; this . currentTransit = transit ; if ( d < 0 ) { d = - d ; } this . jitter += d - ( ( this . jitter + 8 ) >> 4 ) ; }
Calculates interarrival jitter interval .
37,364
public static AudioFormat createAudioFormat ( EncodingName name ) { if ( name . equals ( DTMF ) ) { return new DTMFFormat ( ) ; } return new AudioFormat ( name ) ; }
Creates new audio format descriptor .
37,365
public static ChangeRequestAttribute createChangeRequestAttribute ( boolean changeIP , boolean changePort ) { ChangeRequestAttribute attribute = new ChangeRequestAttribute ( ) ; attribute . setAddressChanging ( changeIP ) ; attribute . setPortChanging ( changePort ) ; return attribute ; }
Creates a ChangeRequestAttribute with the specified flag values .
37,366
public static ChangedAddressAttribute createChangedAddressAttribute ( TransportAddress address ) { ChangedAddressAttribute attribute = new ChangedAddressAttribute ( ) ; attribute . setAddress ( address ) ; return attribute ; }
Creates a changedAddressAttribute of the specified type and with the specified address and port
37,367
public static ErrorCodeAttribute createErrorCodeAttribute ( byte errorClass , byte errorNumber , String reasonPhrase ) throws StunException { ErrorCodeAttribute attribute = new ErrorCodeAttribute ( ) ; attribute . setErrorClass ( errorClass ) ; attribute . setErrorNumber ( errorNumber ) ; attribute . setReasonPhrase ( reasonPhrase == null ? ErrorCodeAttribute . getDefaultReasonPhrase ( attribute . getErrorCode ( ) ) : reasonPhrase ) ; return attribute ; }
Creates an ErrorCodeAttribute with the specified error class number and reason phrase .
37,368
public static ErrorCodeAttribute createErrorCodeAttribute ( char errorCode , String reasonPhrase ) throws IllegalArgumentException { ErrorCodeAttribute attribute = new ErrorCodeAttribute ( ) ; attribute . setErrorCode ( errorCode ) ; attribute . setReasonPhrase ( reasonPhrase == null ? ErrorCodeAttribute . getDefaultReasonPhrase ( attribute . getErrorCode ( ) ) : reasonPhrase ) ; return attribute ; }
Creates an ErrorCodeAttribute with the specified error code and reason phrase .
37,369
public static MappedAddressAttribute createMappedAddressAttribute ( TransportAddress address ) { MappedAddressAttribute attribute = new MappedAddressAttribute ( ) ; attribute . setAddress ( address ) ; return attribute ; }
Creates a MappedAddressAttribute of the specified type and with the specified address and port
37,370
public static ReflectedFromAttribute createReflectedFromAttribute ( TransportAddress address ) { ReflectedFromAttribute attribute = new ReflectedFromAttribute ( ) ; attribute . setAddress ( address ) ; return attribute ; }
Creates a ReflectedFromAddressAttribute of the specified type and with the specified address and port
37,371
public static ResponseAddressAttribute createResponseAddressAttribute ( TransportAddress address ) { ResponseAddressAttribute attribute = new ResponseAddressAttribute ( ) ; attribute . setAddress ( address ) ; return attribute ; }
Creates a ResponseFromAddressAttribute of the specified type and with the specified address and port
37,372
public static SourceAddressAttribute createSourceAddressAttribute ( TransportAddress address ) { SourceAddressAttribute attribute = new SourceAddressAttribute ( ) ; attribute . setAddress ( address ) ; return attribute ; }
Creates a SourceFromAddressAttribute of the specified type and with the specified address and port
37,373
public static XorRelayedAddressAttribute createXorRelayedAddressAttribute ( TransportAddress address , byte [ ] tranID ) { XorRelayedAddressAttribute attribute = new XorRelayedAddressAttribute ( ) ; attribute . setAddress ( address , tranID ) ; return attribute ; }
Creates a XorRelayedAddressAttribute of the specified type and with the specified address and port .
37,374
public static XorPeerAddressAttribute createXorPeerAddressAttribute ( TransportAddress address , byte [ ] tranID ) { XorPeerAddressAttribute attribute = new XorPeerAddressAttribute ( ) ; attribute . setAddress ( address , tranID ) ; return attribute ; }
Creates a XorPeerAddressAttribute of the specified type and with the specified address and port
37,375
public static UsernameAttribute createUsernameAttribute ( byte username [ ] ) { UsernameAttribute attribute = new UsernameAttribute ( ) ; attribute . setUsername ( username ) ; return attribute ; }
Create a UsernameAttribute .
37,376
public static ChannelNumberAttribute createChannelNumberAttribute ( char channelNumber ) { ChannelNumberAttribute attribute = new ChannelNumberAttribute ( ) ; attribute . setChannelNumber ( channelNumber ) ; return attribute ; }
Create a ChannelNumberAttribute .
37,377
public static RealmAttribute createRealmAttribute ( byte realm [ ] ) { RealmAttribute attribute = new RealmAttribute ( ) ; attribute . setRealm ( realm ) ; return attribute ; }
Create a RealmAttribute .
37,378
public static NonceAttribute createNonceAttribute ( byte nonce [ ] ) { NonceAttribute attribute = new NonceAttribute ( ) ; attribute . setNonce ( nonce ) ; return attribute ; }
Create a NonceAttribute .
37,379
public static SoftwareAttribute createSoftwareAttribute ( byte software [ ] ) { SoftwareAttribute attribute = new SoftwareAttribute ( ) ; attribute . setSoftware ( software ) ; return attribute ; }
Create a SoftwareAttribute .
37,380
public static EvenPortAttribute createEvenPortAttribute ( boolean rFlag ) { EvenPortAttribute attribute = new EvenPortAttribute ( ) ; attribute . setRFlag ( rFlag ) ; return attribute ; }
Create a EventAttribute .
37,381
public static LifetimeAttribute createLifetimeAttribute ( int lifetime ) { LifetimeAttribute attribute = new LifetimeAttribute ( ) ; attribute . setLifetime ( lifetime ) ; return attribute ; }
Create a LifetimeAttribute .
37,382
public static RequestedTransportAttribute createRequestedTransportAttribute ( byte protocol ) { RequestedTransportAttribute attribute = new RequestedTransportAttribute ( ) ; attribute . setRequestedTransport ( protocol ) ; return attribute ; }
Create a RequestedTransportAttribute .
37,383
public static ReservationTokenAttribute createReservationTokenAttribute ( byte token [ ] ) { ReservationTokenAttribute attribute = new ReservationTokenAttribute ( ) ; attribute . setReservationToken ( token ) ; return attribute ; }
Create a ReservationTokenAttribute .
37,384
public static ControlledAttribute createIceControlledAttribute ( long tieBreaker ) { ControlledAttribute attribute = new ControlledAttribute ( ) ; attribute . setTieBreaker ( tieBreaker ) ; return attribute ; }
Creates an Controlled Attribute object with the specified tie - breaker value
37,385
public static PriorityAttribute createPriorityAttribute ( long priority ) throws IllegalArgumentException { PriorityAttribute attribute = new PriorityAttribute ( ) ; attribute . setPriority ( priority ) ; return attribute ; }
Creates a Priority attribute with the specified priority value
37,386
public static ControllingAttribute createIceControllingAttribute ( long tieBreaker ) { ControllingAttribute attribute = new ControllingAttribute ( ) ; attribute . setTieBreaker ( tieBreaker ) ; return attribute ; }
Creates an Controlling Attribute with the specified tie - breaker value
37,387
public static DestinationAddressAttribute createDestinationAddressAttribute ( TransportAddress address ) { DestinationAddressAttribute attribute = new DestinationAddressAttribute ( ) ; attribute . setAddress ( address ) ; return attribute ; }
Creates a DestinationFromAddressAttribute of the specified type and with the specified address and port
37,388
public void bind ( boolean isLocal , int port ) throws IOException { try { this . selectionKey = udpManager . open ( this ) ; this . dataChannel = ( DatagramChannel ) this . selectionKey . channel ( ) ; } catch ( IOException e ) { throw new SocketException ( e . getMessage ( ) ) ; } onBinding ( ) ; this . udpManager . bind ( this . dataChannel , port , isLocal ) ; this . bound = true ; }
Binds the channel to an address and port
37,389
public void parse ( byte [ ] data ) throws ParseException { Text text = new Text ( ) ; text . strain ( data , 0 , data . length ) ; init ( text ) ; }
Reads descriptor from binary data
37,390
public Set < Integer > getConnections ( String endpointId ) { return Collections . unmodifiableSet ( this . entries . get ( endpointId ) ) ; }
Gets the list of currently registered connections in the Call .
37,391
public boolean addConnection ( String endpointId , int connectionId ) { boolean added = this . entries . put ( endpointId , connectionId ) ; if ( added && log . isDebugEnabled ( ) ) { int left = this . entries . get ( endpointId ) . size ( ) ; log . debug ( "Call " + getCallIdHex ( ) + " registered connection " + Integer . toHexString ( connectionId ) + " at endpoint " + endpointId + ". Connection count: " + left ) ; } return added ; }
Registers a connection in the call .
37,392
public boolean removeConnection ( String endpointId , int connectionId ) { boolean removed = this . entries . remove ( endpointId , connectionId ) ; if ( removed && log . isDebugEnabled ( ) ) { int left = this . entries . get ( endpointId ) . size ( ) ; log . debug ( "Call " + getCallIdHex ( ) + " unregistered connection " + Integer . toHexString ( connectionId ) + " from endpoint " + endpointId + ". Connection count: " + left ) ; } return removed ; }
Unregisters a connection from the call .
37,393
public Set < Integer > removeConnections ( String endpointId ) { Set < Integer > removed = this . entries . removeAll ( endpointId ) ; if ( ! removed . isEmpty ( ) && log . isDebugEnabled ( ) ) { log . debug ( "Call " + getCallIdHex ( ) + " unregistered connections " + Arrays . toString ( convertToHex ( removed ) ) + " from endpoint " + endpointId ) ; } return removed ; }
Unregisters all connections that belong to an endpoint .
37,394
private MgcpConnection createRemoteConnection ( int callId , ConnectionMode mode , MgcpEndpoint endpoint , CrcxContext context ) throws MgcpConnectionException { MgcpConnection connection = endpoint . createConnection ( callId , false ) ; String localDescription = connection . halfOpen ( context . getLocalConnectionOptions ( ) ) ; context . setLocalDescription ( localDescription ) ; connection . setMode ( mode ) ; return connection ; }
Creates a new Remote Connection .
37,395
private MgcpConnection createLocalConnection ( int callId , MgcpEndpoint endpoint ) throws MgcpConnectionException { MgcpConnection connection = endpoint . createConnection ( callId , true ) ; connection . open ( null ) ; return connection ; }
Creates a new Local Connection .
37,396
public RTPFormats negotiateAudio ( SessionDescription sdp , RTPFormats formats ) { this . audio . clean ( ) ; MediaDescriptorField descriptor = sdp . getAudioDescriptor ( ) ; descriptor . getFormats ( ) . intersection ( formats , this . audio ) ; return this . audio ; }
Negotiates the audio formats to be used in the call .
37,397
public RTPFormats negotiateVideo ( SessionDescription sdp , RTPFormats formats ) { this . video . clean ( ) ; MediaDescriptorField descriptor = sdp . getVideoDescriptor ( ) ; descriptor . getFormats ( ) . intersection ( formats , this . video ) ; return this . video ; }
Negotiates the video formats to be used in the call .
37,398
public RTPFormats negotiateApplication ( SessionDescription sdp , RTPFormats formats ) { this . application . clean ( ) ; MediaDescriptorField descriptor = sdp . getApplicationDescriptor ( ) ; descriptor . getFormats ( ) . intersection ( formats , this . application ) ; return this . application ; }
Negotiates the application formats to be used in the call .
37,399
private static RtcpSenderReport buildSenderReport ( RtpStatistics statistics , boolean padding ) { long ssrc = statistics . getSsrc ( ) ; long currentTime = statistics . getCurrentTime ( ) ; TimeStamp ntpTs = new TimeStamp ( new Date ( currentTime ) ) ; long ntpSec = ntpTs . getSeconds ( ) ; long ntpFrac = ntpTs . getFraction ( ) ; long elapsedTime = statistics . getCurrentTime ( ) - statistics . getRtpSentOn ( ) ; long rtpTs = statistics . getRtpTimestamp ( ) + statistics . getRtpTime ( elapsedTime ) ; long psent = statistics . getRtpPacketsSent ( ) ; long osent = statistics . getRtpOctetsSent ( ) ; RtcpSenderReport senderReport = new RtcpSenderReport ( padding , ssrc , ntpSec , ntpFrac , rtpTs , psent , osent ) ; List < Long > members = statistics . getMembersList ( ) ; for ( Long memberSsrc : members ) { if ( ssrc != memberSsrc ) { RtpMember memberStats = statistics . getMember ( memberSsrc . longValue ( ) ) ; RtcpReportBlock rcvrReport = buildSubReceiverReport ( memberStats ) ; senderReport . addReceiverReport ( rcvrReport ) ; } } return senderReport ; }
Builds a packet containing an RTCP Sender Report .