Public Member Functions | Static Public Attributes | Protected Member Functions | Package Functions

protocol.VoicePDU Class Reference

VoicePDU - The PDU that carries voice payload. More...

Inheritance diagram for protocol.VoicePDU:
Inheritance graph
[legend]
Collaboration diagram for protocol.VoicePDU:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 VoicePDU (CallContext c, int subClass)
 The constructor for outbound Voice PDUs.
 VoicePDU (CallContext c, byte[] pduOctets)
 The constructor for inbound Voice PDUs.

Static Public Attributes

static final int LIN16 = 0x01
 Voice PDU Subclass: 16-bit linear little-endian.
static final int ALAW = 0x02
 Voice PDU Subclass: G.711 a-Law.
static final int ULAW = 0x03
 Voice PDU Subclass: G.711 u-Law.

Protected Member Functions

void log (String prefix)
 Logs this frame.

Package Functions

void onArrivedPDU ()
 Handles arrived PDUs: writes those to audio buffer.

Detailed Description

VoicePDU - The PDU that carries voice payload.

Author:
Mikica B Kocic

Definition at line 9 of file VoicePDU.java.


Constructor & Destructor Documentation

protocol.VoicePDU.VoicePDU ( CallContext  c,
int  subClass 
)

The constructor for outbound Voice PDUs.

Definition at line 29 of file VoicePDU.java.

References protocol.ProtocolDataUnit.pduSubclass, protocol.ProtocolDataUnit.pduType, and protocol.ProtocolDataUnit.VOICE.

    {
        super( c );
        this.pduType = ProtocolDataUnit.VOICE;
        this.pduSubclass = subClass;
    }
protocol.VoicePDU.VoicePDU ( CallContext  c,
byte[]  pduOctets 
)

The constructor for inbound Voice PDUs.

Definition at line 39 of file VoicePDU.java.

    {
        super( c, pduOctets );
    }

Member Function Documentation

void protocol.VoicePDU.log ( String  prefix ) [protected]

Logs this frame.

Reimplemented from protocol.ProtocolDataUnit.

Definition at line 47 of file VoicePDU.java.

    {
        super.log( prefix + " voice frame" );
    }
void protocol.VoicePDU.onArrivedPDU (  ) [package]

Handles arrived PDUs: writes those to audio buffer.

Reimplemented from protocol.ProtocolDataUnit.

Definition at line 56 of file VoicePDU.java.

References protocol.ProtocolDataUnit.call, protocol.ProtocolDataUnit.dump(), utils.OctetBuffer.get(), protocol.CallContext.getAudioSampleSize(), protocol.ProtocolDataUnit.getTimestamp(), protocol.CallContext.onReceivedVoicePDU(), and protocol.ProtocolDataUnit.payload.

    {
        dump( "Inbound Voice" );
        
        int audioSampleSize = this.call.getAudioSampleSize ();
        
        byte[] audioSample = new byte[ audioSampleSize ];
        payload.get( audioSample );

        long ts = this.getTimestamp ();
        
        if ( this.call != null ) {
            this.call.onReceivedVoicePDU( ts, audioSample );
        }
    }

Member Data Documentation

final int protocol.VoicePDU.ALAW = 0x02 [static]

Voice PDU Subclass: G.711 a-Law.

Definition at line 19 of file VoicePDU.java.

Referenced by CryptoPhoneApp.acceptIncomingCall(), CryptoPhoneApp.deferredOnAccept(), and audio.AudioInterfacePCM.getByFormat().

final int protocol.VoicePDU.LIN16 = 0x01 [static]

Voice PDU Subclass: 16-bit linear little-endian.

Definition at line 14 of file VoicePDU.java.

Referenced by audio.AudioInterfacePCM.getByFormat().

final int protocol.VoicePDU.ULAW = 0x03 [static]

Voice PDU Subclass: G.711 u-Law.

Definition at line 24 of file VoicePDU.java.

Referenced by audio.AudioInterfacePCM.getByFormat().


The documentation for this class was generated from the following file: