sipxmediaadapterlib  Version 3.3
Public Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes | List of all members
sipXmediaFactoryImpl Class Reference

#include <sipXmediaFactoryImpl.h>

Inheritance diagram for sipXmediaFactoryImpl:
Inheritance graph
[legend]
Collaboration diagram for sipXmediaFactoryImpl:
Collaboration graph
[legend]

Public Member Functions

 sipXmediaFactoryImpl (OsConfigDb *pConfigDb, uint32_t frameSizeMs, uint32_t maxSamplesPerSec, uint32_t defaultSamplesPerSec, UtlBoolean enableLocalAudio, const UtlString &inputDeviceName, const UtlString &outputDeviceName)
 Default constructor. More...
 
virtual ~sipXmediaFactoryImpl ()
 
virtual CpMediaInterfacecreateMediaInterface (const char *publicAddress, const char *localAddress, int numCodecs, SdpCodec *sdpCodecArray[], const char *locale, int expeditedIpTos, const char *szStunServer, int stunOptions, int iStunKeepAliveSecs, const char *szTurnServer, int iTurnPort, const char *szTurnUsername, const char *szTurnPassword, int iTurnKeepAlivePeriodSecs, UtlBoolean bEnableICE, uint32_t samplesPerSec, OsMsgDispatcher *pDispatcher)
 Create a media interface given the designated parameters. More...
 
virtual OsStatus setSpeakerVolume (int iVolume)
 Set the speaker volume. Valid range includes 0 to 50. More...
 
virtual OsStatus setSpeakerDevice (const UtlString &device)
 Set the speaker device. More...
 
virtual OsStatus setMicrophoneGain (int iGain)
 Set the microphone gain. Valid range includes 0 to 10. More...
 
virtual OsStatus setMicrophoneDevice (const UtlString &device)
 Set the Microphone device. More...
 
virtual OsStatus muteMicrophone (UtlBoolean bMute)
 Mute the microphone. More...
 
virtual OsStatus setAudioAECMode (const MEDIA_AEC_MODE mode)
 Enable/Disable echo cancellation. More...
 
virtual OsStatus enableAGC (UtlBoolean bEnable)
 Enable AGC Status. More...
 
virtual OsStatus setAudioNoiseReductionMode (const MEDIA_NOISE_REDUCTION_MODE mode)
 Enable/Disable Noise Reduction. More...
 
virtual OsStatus buildCodecFactory (SdpCodecList *pFactory, const UtlString &sPreferences, const UtlString &sVideoPreferences, int videoFormat, int *iRejected)
 Populate the codec factory, return number of rejected codecs. More...
 
virtual OsStatus updateVideoPreviewWindow (void *displayContext)
 Update the video preview window given the specified display context. More...
 
virtual OsStatus setVideoPreviewDisplay (void *pDisplay)
 
virtual OsStatus setVideoQuality (int quality)
 Set the global video quality. More...
 
virtual OsStatus setVideoParameters (int bitRate, int frameRate)
 Set the global video parameters. More...
 
virtual OsStatus getSpeakerVolume (int &iVolume) const
 Get the speaker volume. More...
 
virtual OsStatus getSpeakerDevice (UtlString &device) const
 Get the speaker device. More...
 
virtual OsStatus getMicrophoneGain (int &iVolume) const
 Get the microphone gain. More...
 
virtual OsStatus getMicrophoneDevice (UtlString &device) const
 Get the microphone device. More...
 
virtual OsStatus getLocalAudioConnectionId (int &connectionId) const
 Get the connection id for the local audio connection. More...
 
virtual OsStatus getVideoQuality (int &quality) const
 
virtual OsStatus getVideoBitRate (int &bitRate) const
 
virtual OsStatus getVideoFrameRate (int &frameRate) const
 
- Public Member Functions inherited from CpMediaInterfaceFactoryImpl
 CpMediaInterfaceFactoryImpl ()
 Default constructor. More...
 
virtual void release ()
 Public interface for destroying this media interface. More...
 
virtual OsStatus enableOutOfBandDTMF (UtlBoolean enable)
 Enable/Disable sending DTMF tones inband. More...
 
virtual OsStatus enableInBandDTMF (UtlBoolean enable)
 Enable/Disable sending DTMF tones inband. More...
 
virtual OsStatus enableRTCP (UtlBoolean bEnable)
 Enable/Disable RTCP reports. More...
 
virtual OsStatus setRTCPName (const char *szName)
 Set name send as part of RTCP reports. More...
 
virtual OsStatus setVideoBitrate (int bitrate)
 
virtual OsStatus setVideoFramerate (int framerate)
 
virtual OsStatus setVideoCpuValue (int cpuValue)
 Set the global CPU usage. More...
 
virtual void setRtpPortRange (int startRtpPort, int lastRtpPort)
 Sets the RTP port range for this factory. More...
 
virtual OsStatus getNextRtpPort (const char *bindAddress, int &rtpPort)
 Gets the next available rtp port. More...
 
virtual OsStatus releaseRtpPort (const int rtpPort)
 Release the rtp port back to the pool of available RTP ports. More...
 
virtual OsStatus setConnectionIdleTimeout (const int idleTimeout)
 Set the connection idle timeout. More...
 
virtual void setDispatcher (OsMsgDispatcher *dispatcher)=0
 Set the dispatcher for flowgraph independent media events/messages. More...
 
virtual OsStatus getConnectionIdleTimeout (int &idleTimeout) const
 Get the connection idle timeout. More...
 
virtual void setConfiguredIpAddress (const UtlString &configuredIpAddress)
 Set IP address to use in SDP (spoofed address) More...
 
virtual OsStatus getAudioAECMode (MEDIA_AEC_MODE &mode) const
 Return status of echo cancellation. More...
 
virtual OsStatus getAudioNoiseReductionMode (MEDIA_NOISE_REDUCTION_MODE &mode) const
 Return status of noise reduction. More...
 
virtual OsStatus isAGCEnabled (UtlBoolean &bEnable) const
 Return status of AGC. More...
 
virtual OsStatus isOutOfBandDTMFEnabled (UtlBoolean &enabled) const
 Return status of out-of-band DTMF. More...
 
virtual OsStatus isInBandDTMFEnabled (UtlBoolean &enabled) const
 Return status of in band DTMF. More...
 

Protected Attributes

MpMediaTask * mpMediaTask
 
uint32_t mFrameSizeMs
 
uint32_t mMaxSamplesPerSec
 
uint32_t mDefaultSamplesPerSec
 
- Protected Attributes inherited from CpMediaInterfaceFactoryImpl
int miInterfaceId
 
int miGain
 
int miStartRtpPort
 
int miLastRtpPort
 
int miNextRtpPort
 
UtlSList mlistFreePorts
 
UtlSList mlistBusyPorts
 
OsMutex mlockList
 
UtlString mConfiguredIpAddress
 

Private Member Functions

 sipXmediaFactoryImpl (const sipXmediaFactoryImpl &refFactoryImpl)
 Diabled. More...
 
sipXmediaFactoryImploperator= (const sipXmediaFactoryImpl &refFactoryImpl)
 Diabled. More...
 

Static Private Attributes

static int miInstanceCount =0
 

Additional Inherited Members

- Static Public Member Functions inherited from CpMediaInterfaceFactoryImpl
static OsStatus addCodecPaths (const size_t nCodecPaths, const UtlString codecPaths[])
 Add directory paths to the codec search path. More...
 
static void clearCodecPaths ()
 Clear the static codec path list. More...
 
- Protected Member Functions inherited from CpMediaInterfaceFactoryImpl
virtual ~CpMediaInterfaceFactoryImpl ()
 Destructor. More...
 
UtlBoolean isAddressPortBusy (const char *bindAddress, int iPort, int checkTimeMS)
 Bind the the specified port and see if any data is ready to read for the designated check time. More...
 
- Static Protected Member Functions inherited from CpMediaInterfaceFactoryImpl
static OsStatus ensureCapacityCodecPaths (size_t newSize)
 Ensure that there is enough capacity in our codec paths array. More...
 
- Static Protected Attributes inherited from CpMediaInterfaceFactoryImpl
static size_t mnAllocCodecPaths = 0
 Number of slots allocated in codec path array. More...
 
static size_t mnCodecPaths = 0
 Number of codec paths stored. More...
 
static UtlString * mpCodecPaths = NULL
 dynamic array of paths to use when loading codecs. More...
 

Constructor & Destructor Documentation

sipXmediaFactoryImpl ( OsConfigDb *  pConfigDb,
uint32_t  frameSizeMs,
uint32_t  maxSamplesPerSec,
uint32_t  defaultSamplesPerSec,
UtlBoolean  enableLocalAudio,
const UtlString &  inputDeviceName,
const UtlString &  outputDeviceName 
)

Default constructor.

Parameters
pConfigDb- a configuration database to pass user-settable config parameters to sipXmediaLib. TODO: Someone that knows more, document this better!
frameSizeMs- This parameter is used for determining the frame size (in milliseconds) that the media subsystem will use. It is used for initializing the size of audio buffers, and for configuring a default value for samples per frame in device managers (so that when devices are enabled without specifying samples per frame, the value configured here will be used).
maxSamplesPerSec- This is used for initializing audio buffers. Lower sample rates can indeed be used for individual media interfaces (set later), since a lesser amount of these buffers can be used (i.e. not fully utilized). Higher sample rates can be used by passing params here, but this will result in more memory being used. For low-memory environments that do not require wideband support, one may wish to pass 8000kHz here, as the default is 16000kHz.
defaultSamplesPerSec- The sample rate that device managers and flowgraphs will use when no sample rate is specified.
enableLocalAudio- If TRUE, local sound card will be used to play audio and provide heartbeat for media processing. If FALSE, local sound card will not be used and high-res timer will be used for media processing heartbeat. Setting to FALSE is useful for server use case.
inputDeviceName- Name of the audio device to use as input device during a call. Use empty string to select default (OS-dependent) device.
outputDeviceName- Name of the audio device to use as output device during a call. Use empty string to select default (OS-dependent) device.
~sipXmediaFactoryImpl ( )
virtual

Destructor

sipXmediaFactoryImpl ( const sipXmediaFactoryImpl refFactoryImpl)
private

Diabled.

Member Function Documentation

CpMediaInterface * createMediaInterface ( const char *  publicAddress,
const char *  localAddress,
int  numCodecs,
SdpCodec *  sdpCodecArray[],
const char *  locale,
int  expeditedIpTos,
const char *  szStunServer,
int  iStunPort,
int  iStunKeepAliveSecs,
const char *  szTurnServer,
int  iTurnPort,
const char *  szTurnUsername,
const char *  szTurnPassword,
int  iTurnKeepAliveSecs,
UtlBoolean  bEnableICE,
uint32_t  samplesPerSec,
OsMsgDispatcher *  pDispatcher 
)
virtual

Create a media interface given the designated parameters.

Implements CpMediaInterfaceFactoryImpl.

Reimplemented in CpTopologyGraphFactoryImpl.

OsStatus setSpeakerVolume ( int  iVolume)
virtual

Set the speaker volume. Valid range includes 0 to 50.

Implements CpMediaInterfaceFactoryImpl.

OsStatus setSpeakerDevice ( const UtlString &  device)
virtual

Set the speaker device.

Implements CpMediaInterfaceFactoryImpl.

Reimplemented in CpTopologyGraphFactoryImpl.

OsStatus setMicrophoneGain ( int  iGain)
virtual

Set the microphone gain. Valid range includes 0 to 10.

Implements CpMediaInterfaceFactoryImpl.

OsStatus setMicrophoneDevice ( const UtlString &  device)
virtual

Set the Microphone device.

Implements CpMediaInterfaceFactoryImpl.

Reimplemented in CpTopologyGraphFactoryImpl.

OsStatus muteMicrophone ( UtlBoolean  bMute)
virtual

Mute the microphone.

Implements CpMediaInterfaceFactoryImpl.

OsStatus setAudioAECMode ( const MEDIA_AEC_MODE  mode)
virtual

Enable/Disable echo cancellation.

Reimplemented from CpMediaInterfaceFactoryImpl.

Reimplemented in CpTopologyGraphFactoryImpl.

OsStatus enableAGC ( UtlBoolean  bEnable)
virtual

Enable AGC Status.

Reimplemented from CpMediaInterfaceFactoryImpl.

Reimplemented in CpTopologyGraphFactoryImpl.

OsStatus setAudioNoiseReductionMode ( const MEDIA_NOISE_REDUCTION_MODE  mode)
virtual

Enable/Disable Noise Reduction.

Reimplemented from CpMediaInterfaceFactoryImpl.

Reimplemented in CpTopologyGraphFactoryImpl.

OsStatus buildCodecFactory ( SdpCodecList *  pFactory,
const UtlString &  sPreferences,
const UtlString &  sVideoPreferences,
int  videoFormat,
int *  iRejected 
)
virtual

Populate the codec factory, return number of rejected codecs.

Note, that current implementation ignore videoFormat parameter.

Implements CpMediaInterfaceFactoryImpl.

OsStatus updateVideoPreviewWindow ( void *  displayContext)
virtual

Update the video preview window given the specified display context.

Reimplemented from CpMediaInterfaceFactoryImpl.

OsStatus setVideoPreviewDisplay ( void *  pDisplay)
virtual

Set the global video preview window

Reimplemented from CpMediaInterfaceFactoryImpl.

OsStatus setVideoQuality ( int  quality)
virtual

Set the global video quality.

Reimplemented from CpMediaInterfaceFactoryImpl.

OsStatus setVideoParameters ( int  bitRate,
int  frameRate 
)
virtual

Set the global video parameters.

Reimplemented from CpMediaInterfaceFactoryImpl.

OsStatus getSpeakerVolume ( int &  iVolume) const
virtual

Get the speaker volume.

Implements CpMediaInterfaceFactoryImpl.

OsStatus getSpeakerDevice ( UtlString &  device) const
virtual

Get the speaker device.

Implements CpMediaInterfaceFactoryImpl.

Reimplemented in CpTopologyGraphFactoryImpl.

OsStatus getMicrophoneGain ( int &  iVolume) const
virtual

Get the microphone gain.

Implements CpMediaInterfaceFactoryImpl.

OsStatus getMicrophoneDevice ( UtlString &  device) const
virtual

Get the microphone device.

Implements CpMediaInterfaceFactoryImpl.

Reimplemented in CpTopologyGraphFactoryImpl.

OsStatus getLocalAudioConnectionId ( int &  connectionId) const
virtual

Get the connection id for the local audio connection.

Implements CpMediaInterfaceFactoryImpl.

OsStatus getVideoQuality ( int &  quality) const
virtual
OsStatus getVideoBitRate ( int &  bitRate) const
virtual
OsStatus getVideoFrameRate ( int &  frameRate) const
virtual
sipXmediaFactoryImpl& operator= ( const sipXmediaFactoryImpl refFactoryImpl)
private

Diabled.

Member Data Documentation

MpMediaTask* mpMediaTask
protected

Media task instance

uint32_t mFrameSizeMs
protected
uint32_t mMaxSamplesPerSec
protected
uint32_t mDefaultSamplesPerSec
protected
int miInstanceCount =0
staticprivate