Public Member Functions | Package Functions | Private Attributes

protocol.VoicePDUSender Class Reference

Takes captured audio and sends it to the remote peer via UDP channel. More...

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

List of all members.

Public Member Functions

void send () throws IOException
 Sends audio as payload encapsulated in VoicePDU.

Package Functions

 VoicePDUSender (AudioInterface audioInterface, CallContext call)
 Constructor for the VoicePDUSender object.

Private Attributes

AudioInterface audio
CallContext call
int voicePduSubclass
byte[] audioBuffer
long callStartTimestamp
long nextDueTimestamp
int timestamp

Detailed Description

Takes captured audio and sends it to the remote peer via UDP channel.

Author:
Mikica B Kocic

Definition at line 15 of file VoicePDUSender.java.


Constructor & Destructor Documentation

protocol.VoicePDUSender.VoicePDUSender ( AudioInterface  audioInterface,
CallContext  call 
) [package]

Constructor for the VoicePDUSender object.

Parameters:
audioInterfaceThe audio interface
callThe call object

Definition at line 32 of file VoicePDUSender.java.

References protocol.VoicePDUSender.audio, protocol.VoicePDUSender.audioBuffer, protocol.VoicePDUSender.call, protocol.VoicePDUSender.callStartTimestamp, audio.AudioInterface.getSampleSize(), protocol.CallContext.getTimestamp(), audio.AudioInterface.getVoicePduSubclass(), protocol.VoicePDUSender.nextDueTimestamp, and protocol.VoicePDUSender.voicePduSubclass.

    {
        this.audio = audioInterface;
        this.call = call;
        
        this.voicePduSubclass = audioInterface.getVoicePduSubclass ();
        this.audioBuffer = new byte[ this.audio.getSampleSize () ];

        this.callStartTimestamp = this.call.getTimestamp ();
        this.nextDueTimestamp = this.callStartTimestamp;
    }

Member Function Documentation

void protocol.VoicePDUSender.send (  ) throws IOException [virtual]

Sends audio as payload encapsulated in VoicePDU.

Implements audio.AudioInterface.Packetizer.

Definition at line 47 of file VoicePDUSender.java.

References protocol.VoicePDUSender.audio, protocol.VoicePDUSender.audioBuffer, protocol.VoicePDUSender.call, protocol.ProtocolDataUnit.dump(), protocol.VoicePDUSender.nextDueTimestamp, audio.AudioInterface.readWithTimestamp(), protocol.ProtocolDataUnit.sendPayload(), protocol.ProtocolDataUnit.setTimestamp(), protocol.VoicePDUSender.timestamp, and protocol.VoicePDUSender.voicePduSubclass.

    {
        this.audio.readWithTimestamp( this.audioBuffer );
        this.timestamp = (int) this.nextDueTimestamp;
        
        VoicePDU vf = new VoicePDU( this.call, this.voicePduSubclass );
        vf.setTimestamp( this.timestamp );
        vf.sendPayload( this.audioBuffer );
        
        vf.dump( "Outbound Voice" );
        Log.audio( "Sent voice PDU" );
        
        /* Now work out how long to wait...
         */
        this.nextDueTimestamp += 20;
    }

Member Data Documentation

Definition at line 22 of file VoicePDUSender.java.

Referenced by protocol.VoicePDUSender.VoicePDUSender().

Definition at line 24 of file VoicePDUSender.java.

Referenced by protocol.VoicePDUSender.send().


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