INET Framework for OMNeT++/OMNEST
voice Class Reference

#include <App_voice.h>

Inheritance diagram for voice:
ITrafGenApplication

List of all members.

Public Member Functions

 voice ()
virtual bool loadConfig (const cXMLElement &appConfig)
virtual int getDefaultPort ()
virtual double getNextPacketTime ()
virtual int getPacketSize ()
virtual int anotherEncapsulationOverhead ()

Private Attributes

double pps
int codecRate
bool vad

Detailed Description

Definition at line 26 of file App_voice.h.


Constructor & Destructor Documentation

voice::voice ( ) [inline]

Definition at line 34 of file App_voice.h.

{pps = 0.0; codecRate = 0; vad = false;}

Member Function Documentation

Implements ITrafGenApplication.

Definition at line 91 of file App_voice.cc.

{
  return 12;  // rtp hlavicka
}
int voice::getDefaultPort ( ) [virtual]

Implements ITrafGenApplication.

Definition at line 80 of file App_voice.cc.

{
  return 16384;
}
double voice::getNextPacketTime ( ) [virtual]

Implements ITrafGenApplication.

Definition at line 102 of file App_voice.cc.

{
  if(vad)
  { // VAD sposobi, ze je generovanych len 70% paketov 
    double time = 1.0/pps;
    while(intuniform(0, 10) > 7)
      time += 1.0/pps;
    
    return time;
  }
  return 1.0/pps; 
}
int voice::getPacketSize ( ) [virtual]

Implements ITrafGenApplication.

Definition at line 121 of file App_voice.cc.

{
  return  codecRate/(8 * pps);
}
bool voice::loadConfig ( const cXMLElement &  appConfig) [virtual]

Implements ITrafGenApplication.

Definition at line 32 of file App_voice.cc.

{
  
  cXMLElement* element;

  element = appConfig.getFirstChildWithTag("codec");
  if(element != NULL)
  {// pouzity kodek
    std::string codec = element->getNodeValue();
    if(codec == "g711" || codec == "G.711")
      codecRate = 64000;
    else if(codec == "g729" || codec == "G.729")
      codecRate = 8000;
  }
  
  element = appConfig.getFirstChildWithTag("codec_rate");
  if(element != NULL) // explicitne definavana bitova rychlost
    codecRate =  atoi(element->getNodeValue());
    
  element = appConfig.getFirstChildWithTag("packets_per_second");
  if(element != NULL)
  {
    std::string ppsString = element->getNodeValue();
    if(ppsString == "default")
      pps = 50.0;
    else
      pps = atof(element->getNodeValue());
  }
    
  element = appConfig.getFirstChildWithTag("vad");
  if(element != NULL)
  { // technologia VAD bude pouzita
    std::string vadString = element->getNodeValue();
    if(vadString == "true" || vadString == "True" || vadString == "TRUE")
      vad = true;
  }
  
  if(pps == 0.0 || codecRate == 0)
    return false; // chyba nacitania
  
  return true;
}

Member Data Documentation

int voice::codecRate [private]

Definition at line 30 of file App_voice.h.

Referenced by getPacketSize(), and loadConfig().

double voice::pps [private]

Definition at line 29 of file App_voice.h.

Referenced by getNextPacketTime(), getPacketSize(), and loadConfig().

bool voice::vad [private]

Definition at line 31 of file App_voice.h.

Referenced by getNextPacketTime(), and loadConfig().


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