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

Subsystem manager and creator of CpTopologyGraphInterfaces specialization of CpMediaInterface. More...

#include <CpTopologyGraphFactoryImpl.h>

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

Static Protected Member Functions

static void addOutputConnectionTopology (MpResourceTopology *resourceTopology, int logicalPortNum)
 Add RTP output connection to topology. More...
 
static void addLocalConnectionTopology (MpResourceTopology *resourceTopology)
 Add local input and local output connections to topology. 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...
 

Protected Attributes

MpResourceTopology * mpInitialResourceTopology
 
MpResourceFactory * mpResourceFactory
 
MpResourceTopology * mpConnectionResourceTopology
 
MpResourceTopology * mpMcastConnectionResourceTopology
 
UtlBoolean mIsLocalAudioEnabled
 
MpInputDeviceManager * mpInputDeviceManager
 
MpOutputDeviceManager * mpOutputDeviceManager
 
MpMMTimer * mpMediaTaskTicker
 
MpOutputDeviceHandle mDefaultToOutputDevice
 
MpInputDeviceHandle mDefaultToInputDevice
 
int mNumMcastStreams
 
MaNotfTranslatorDispatcher mTranslatorDispatcher
 
- Protected Attributes inherited from sipXmediaFactoryImpl
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

 CpTopologyGraphFactoryImpl (const CpTopologyGraphFactoryImpl *refFactoryImpl)
 Disabled. More...
 
CpTopologyGraphFactoryImploperator= (const CpTopologyGraphFactoryImpl *refFactoryImpl)
 Disabled. More...
 

Creators

 CpTopologyGraphFactoryImpl (OsConfigDb *pConfigDb, uint32_t frameSizeMs, uint32_t maxSamplesPerSec, uint32_t defaultDeviceSamplesPerSec, UtlBoolean enableLocalAudio, const UtlString &inputDeviceName, const UtlString &outputDeviceName)
 Default constructor. More...
 
virtual ~CpTopologyGraphFactoryImpl ()
 Destructor. More...
 

Manipulators

virtual CpMediaInterfacecreateMediaInterface (const char *publicAddress, const char *localAddress, int numCodecs, SdpCodec *sdpCodecArray[], const char *locale, int expeditedIpTos, const char *stunServer, int stunOptions, int stunKeepAliveSecs, const char *turnServer, int turnPort, const char *turnUserName, const char *turnPassword, int turnKeepAlivePeriodSecs, UtlBoolean enableIce, uint32_t samplesPerSec, OsMsgDispatcher *pDispatcher)
 Factory method to construct new flowgraph and media interface using CpTopologyFlowgraph. More...
 
virtual OsStatus setSpeakerDevice (const UtlString &device)
 Set the speaker device. More...
 
virtual OsStatus setMicrophoneDevice (const UtlString &device)
 Set the Microphone device. More...
 
virtual OsStatus setAudioAECMode (const MEDIA_AEC_MODE mode)
 Enable/Disable echo cancellation. More...
 
virtual OsStatus getAudioAECMode (MEDIA_AEC_MODE &mode) const
 Return status of 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...
 

Accessors

virtual OsStatus getSpeakerDevice (UtlString &device) const
 Get the speaker device. More...
 
virtual OsStatus getMicrophoneDevice (UtlString &device) const
 Get the microphone device. More...
 
void setInitialResourceTopology (MpResourceTopology &resourceTopology)
 Set the resource topology to be used when creating new flowgraph. More...
 
MpResourceTopology * getInitialResourceTopology () const
 Get the resource topology defining the resources connections for a new flowgraph. More...
 
void setResourceFactory (MpResourceFactory &resourceFactory)
 Set the factory used to create resources for the new flowgraph contained . More...
 
MpResourceFactory * getResourceFactory () const
 Get the factory for constructing new resources. More...
 
void setConnectionResourceTopology (MpResourceTopology &connectionTopology)
 Set the resource topology to be added to the flow graph when adding an unicast RTP connection. More...
 
MpResourceTopology * getConnectionResourceTopology () const
 Get the resource topology defining what resources get added when adding an unicast RTP connection. More...
 
void setDispatcher (OsMsgDispatcher *dispatcher)
 Set the dispatcher for flowgraph independent media events/messages. More...
 
void setMcastConnectionResourceTopology (MpResourceTopology &connectionTopology)
 Set the resource topology to be added to the flow graph when adding an multicast RTP connection. More...
 
MpResourceTopology * getMcastConnectionResourceTopology () const
 Get the resource topology defining what resources get added when adding an multicast RTP connection. More...
 
int getNumMcastRtpStreams () const
 Return number of RTP streams multicast connection supports. More...
 
MpInputDeviceManager * getInputDeviceManager () const
 
MpResourceFactory * buildDefaultResourceFactory ()
 Build a resource factory with the default set of resource constructors. More...
 
MpResourceTopology * buildUnicastConnectionResourceTopology ()
 Build an incremental resource topology for unicast RTP connections. More...
 
MpResourceTopology * buildMulticastConnectionResourceTopology ()
 Build an incremental resource topology for multicast RTP connections. More...
 
virtual OsStatus getVideoCpuValue (int &cpuValue) const
 
static int getInputDeviceList (UtlContainer &deviceNames)
 Get the list of available input devices. More...
 
static int getOutputDeviceList (UtlContainer &deviceNames)
 Get the list of available output devices. More...
 
static MpResourceTopology * buildDefaultInitialResourceTopology ()
 Build a default initial resource topology. More...
 
static int getMaxInputConnections ()
 Get number of input connections this topology can support. More...
 

Additional Inherited Members

- Public Member Functions inherited from sipXmediaFactoryImpl
 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 OsStatus setSpeakerVolume (int iVolume)
 Set the speaker volume. Valid range includes 0 to 50. More...
 
virtual OsStatus setMicrophoneGain (int iGain)
 Set the microphone gain. Valid range includes 0 to 10. More...
 
virtual OsStatus muteMicrophone (UtlBoolean bMute)
 Mute the microphone. 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 getMicrophoneGain (int &iVolume) const
 Get the microphone gain. 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 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 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...
 
- 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 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...
 

Detailed Description

Subsystem manager and creator of CpTopologyGraphInterfaces specialization of CpMediaInterface.

When createMediaInterface is invoked a new CpTopologyGraph (flowgraph) is constructed and used inside the CpTopologyGraphInterface (CpMediaInterface). The topology and types of the resources in the new flowgraph are determined by the MpResourceTopology last set via setInitialResourceTopology. The specific resources are instantiated using the MpResourceFactory last set via setResourceFactory.

Constructor & Destructor Documentation

CpTopologyGraphFactoryImpl ( OsConfigDb *  pConfigDb,
uint32_t  frameSizeMs,
uint32_t  maxSamplesPerSec,
uint32_t  defaultDeviceSamplesPerSec,
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.

Destructor.

CpTopologyGraphFactoryImpl ( const CpTopologyGraphFactoryImpl refFactoryImpl)
private

Disabled.

Member Function Documentation

CpMediaInterface * createMediaInterface ( const char *  publicAddress,
const char *  localAddress,
int  numCodecs,
SdpCodec *  sdpCodecArray[],
const char *  locale,
int  expeditedIpTos,
const char *  stunServer,
int  stunOptions,
int  stunKeepAliveSecs,
const char *  turnServer,
int  turnPort,
const char *  turnUserName,
const char *  turnPassword,
int  turnKeepAlivePeriodSecs,
UtlBoolean  enableIce,
uint32_t  samplesPerSec,
OsMsgDispatcher *  pDispatcher 
)
virtual

Factory method to construct new flowgraph and media interface using CpTopologyFlowgraph.

Reimplemented from sipXmediaFactoryImpl.

OsStatus setSpeakerDevice ( const UtlString &  device)
virtual

Set the speaker device.

Reimplemented from sipXmediaFactoryImpl.

OsStatus setMicrophoneDevice ( const UtlString &  device)
virtual

Set the Microphone device.

Reimplemented from sipXmediaFactoryImpl.

OsStatus setAudioAECMode ( const MEDIA_AEC_MODE  mode)
virtual

Enable/Disable echo cancellation.

Reimplemented from sipXmediaFactoryImpl.

OsStatus getAudioAECMode ( MEDIA_AEC_MODE mode) const
virtual

Return status of echo cancellation.

Reimplemented from CpMediaInterfaceFactoryImpl.

OsStatus enableAGC ( UtlBoolean  bEnable)
virtual

Enable AGC Status.

Reimplemented from sipXmediaFactoryImpl.

OsStatus setAudioNoiseReductionMode ( const MEDIA_NOISE_REDUCTION_MODE  mode)
virtual

Enable/Disable Noise Reduction.

Reimplemented from sipXmediaFactoryImpl.

OsStatus getSpeakerDevice ( UtlString &  device) const
virtual

Get the speaker device.

Reimplemented from sipXmediaFactoryImpl.

OsStatus getMicrophoneDevice ( UtlString &  device) const
virtual

Get the microphone device.

Reimplemented from sipXmediaFactoryImpl.

int getInputDeviceList ( UtlContainer &  deviceNames)
static

Get the list of available input devices.

int getOutputDeviceList ( UtlContainer &  deviceNames)
static

Get the list of available output devices.

void setInitialResourceTopology ( MpResourceTopology &  resourceTopology)

Set the resource topology to be used when creating new flowgraph.

The given CpTopolgyGraph defines the topology and types of resources that are instantiated in the new flowgraph.

MpResourceTopology * getInitialResourceTopology ( ) const

Get the resource topology defining the resources connections for a new flowgraph.

void setResourceFactory ( MpResourceFactory &  resourceFactory)

Set the factory used to create resources for the new flowgraph contained .

MpResourceFactory * getResourceFactory ( ) const

Get the factory for constructing new resources.

void setConnectionResourceTopology ( MpResourceTopology &  connectionTopology)

Set the resource topology to be added to the flow graph when adding an unicast RTP connection.

MpResourceTopology * getConnectionResourceTopology ( ) const

Get the resource topology defining what resources get added when adding an unicast RTP connection.

void setDispatcher ( OsMsgDispatcher *  dispatcher)
virtual

Set the dispatcher for flowgraph independent media events/messages.

Implements CpMediaInterfaceFactoryImpl.

void setMcastConnectionResourceTopology ( MpResourceTopology &  connectionTopology)

Set the resource topology to be added to the flow graph when adding an multicast RTP connection.

MpResourceTopology * getMcastConnectionResourceTopology ( ) const

Get the resource topology defining what resources get added when adding an multicast RTP connection.

int getNumMcastRtpStreams ( ) const
inline

Return number of RTP streams multicast connection supports.

MpInputDeviceManager * getInputDeviceManager ( ) const
MpResourceFactory * buildDefaultResourceFactory ( )

Build a resource factory with the default set of resource constructors.

MpResourceTopology * buildDefaultInitialResourceTopology ( )
static

Build a default initial resource topology.

MpResourceTopology * buildUnicastConnectionResourceTopology ( )

Build an incremental resource topology for unicast RTP connections.

MpResourceTopology * buildMulticastConnectionResourceTopology ( )

Build an incremental resource topology for multicast RTP connections.

int getMaxInputConnections ( )
static

Get number of input connections this topology can support.

OsStatus getVideoCpuValue ( int &  cpuValue) const
virtual
void addOutputConnectionTopology ( MpResourceTopology *  resourceTopology,
int  logicalPortNum 
)
staticprotected

Add RTP output connection to topology.

void addLocalConnectionTopology ( MpResourceTopology *  resourceTopology)
staticprotected

Add local input and local output connections to topology.

CpTopologyGraphFactoryImpl& operator= ( const CpTopologyGraphFactoryImpl refFactoryImpl)
private

Disabled.

Member Data Documentation

MpResourceTopology* mpInitialResourceTopology
protected
MpResourceFactory* mpResourceFactory
protected
MpResourceTopology* mpConnectionResourceTopology
protected
MpResourceTopology* mpMcastConnectionResourceTopology
protected
UtlBoolean mIsLocalAudioEnabled
protected
MpInputDeviceManager* mpInputDeviceManager
protected
MpOutputDeviceManager* mpOutputDeviceManager
protected
MpMMTimer* mpMediaTaskTicker
protected
MpOutputDeviceHandle mDefaultToOutputDevice
protected
MpInputDeviceHandle mDefaultToInputDevice
protected
int mNumMcastStreams
protected
MaNotfTranslatorDispatcher mTranslatorDispatcher
protected