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

#include <CpMediaInterfaceFactoryImpl.h>

Inheritance diagram for CpMediaInterfaceFactoryImpl:
Inheritance graph
[legend]

Public Member Functions

 CpMediaInterfaceFactoryImpl ()
 Default constructor. More...
 
virtual void release ()
 Public interface for destroying this media interface. More...
 
virtual CpMediaInterfacecreateMediaInterface (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)=0
 Create a media interface given the designated parameters. More...
 
virtual OsStatus setSpeakerVolume (int iVolume)=0
 Set the speaker volume. Valid range includes 0 to 50. More...
 
virtual OsStatus setSpeakerDevice (const UtlString &device)=0
 Set the speaker device. More...
 
virtual OsStatus setMicrophoneGain (int iGain)=0
 Set the microphone gain. Valid range includes 0 to 10. More...
 
virtual OsStatus setMicrophoneDevice (const UtlString &device)=0
 Set the Microphone device. More...
 
virtual OsStatus muteMicrophone (UtlBoolean bMute)=0
 Mute the microphone. More...
 
virtual OsStatus setAudioAECMode (const MEDIA_AEC_MODE mode)
 Enable/Disable echo cancellation. More...
 
virtual OsStatus setAudioNoiseReductionMode (const MEDIA_NOISE_REDUCTION_MODE mode)
 Enable/Disable Noise Reduction. More...
 
virtual OsStatus enableAGC (UtlBoolean bEnable)
 Enable AGC Status. 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 buildCodecFactory (SdpCodecList *pFactory, const UtlString &sAudioPreferences, const UtlString &sVideoPreferences, int videoFormat, int *iRejected)=0
 Populate the codec factory, return number of rejected codecs. More...
 
virtual OsStatus setVideoPreviewDisplay (void *pDisplay)
 Set the global video preview window. More...
 
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 setVideoBitrate (int bitrate)
 
virtual OsStatus setVideoFramerate (int framerate)
 
virtual OsStatus setVideoCpuValue (int cpuValue)
 Set the global CPU usage. More...
 
virtual OsStatus updateVideoPreviewWindow (void *displayContext)
 Update the video preview window given the specified display context. 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 getSpeakerVolume (int &iVolume) const =0
 Get the speaker volume. More...
 
virtual OsStatus getSpeakerDevice (UtlString &device) const =0
 Get the speaker device. More...
 
virtual OsStatus getMicrophoneGain (int &iVolume) const =0
 Get the microphone gain. More...
 
virtual OsStatus getMicrophoneDevice (UtlString &device) const =0
 Get the microphone device. More...
 
virtual OsStatus getLocalAudioConnectionId (int &connectionId) const =0
 Get the connection id for the local audio connection. 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...
 

Static Public Member Functions

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

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

static OsStatus ensureCapacityCodecPaths (size_t newSize)
 Ensure that there is enough capacity in our codec paths array. More...
 

Protected Attributes

int miInterfaceId
 
int miGain
 
int miStartRtpPort
 
int miLastRtpPort
 
int miNextRtpPort
 
UtlSList mlistFreePorts
 
UtlSList mlistBusyPorts
 
OsMutex mlockList
 
UtlString mConfiguredIpAddress
 

Static Protected Attributes

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...
 

Private Member Functions

 CpMediaInterfaceFactoryImpl (const CpMediaInterfaceFactoryImpl &rCpMediaInterfaceFactoryImpl)
 Disabled copy constructor. More...
 
CpMediaInterfaceFactoryImploperator= (const CpMediaInterfaceFactoryImpl &rhs)
 Disabled equals operator. More...
 

Constructor & Destructor Documentation

Default constructor.

~CpMediaInterfaceFactoryImpl ( )
protectedvirtual

Destructor.

CpMediaInterfaceFactoryImpl ( const CpMediaInterfaceFactoryImpl rCpMediaInterfaceFactoryImpl)
private

Disabled copy constructor.

Member Function Documentation

void release ( )
virtual

Public interface for destroying this media interface.

public interface for destroying this media interface

virtual 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 
)
pure virtual

Create a media interface given the designated parameters.

Implemented in sipXmediaFactoryImpl, and CpTopologyGraphFactoryImpl.

virtual OsStatus setSpeakerVolume ( int  iVolume)
pure virtual

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

Implemented in sipXmediaFactoryImpl.

virtual OsStatus setSpeakerDevice ( const UtlString &  device)
pure virtual

Set the speaker device.

Implemented in sipXmediaFactoryImpl, and CpTopologyGraphFactoryImpl.

virtual OsStatus setMicrophoneGain ( int  iGain)
pure virtual

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

Implemented in sipXmediaFactoryImpl.

virtual OsStatus setMicrophoneDevice ( const UtlString &  device)
pure virtual

Set the Microphone device.

Implemented in sipXmediaFactoryImpl, and CpTopologyGraphFactoryImpl.

virtual OsStatus muteMicrophone ( UtlBoolean  bMute)
pure virtual

Mute the microphone.

Implemented in sipXmediaFactoryImpl.

virtual OsStatus setAudioAECMode ( const MEDIA_AEC_MODE  mode)
inlinevirtual

Enable/Disable echo cancellation.

Reimplemented in sipXmediaFactoryImpl, and CpTopologyGraphFactoryImpl.

virtual OsStatus setAudioNoiseReductionMode ( const MEDIA_NOISE_REDUCTION_MODE  mode)
inlinevirtual

Enable/Disable Noise Reduction.

Reimplemented in sipXmediaFactoryImpl, and CpTopologyGraphFactoryImpl.

virtual OsStatus enableAGC ( UtlBoolean  bEnable)
inlinevirtual

Enable AGC Status.

Reimplemented in sipXmediaFactoryImpl, and CpTopologyGraphFactoryImpl.

virtual OsStatus enableOutOfBandDTMF ( UtlBoolean  enable)
inlinevirtual

Enable/Disable sending DTMF tones inband.

virtual OsStatus enableInBandDTMF ( UtlBoolean  enable)
inlinevirtual

Enable/Disable sending DTMF tones inband.

virtual OsStatus enableRTCP ( UtlBoolean  bEnable)
inlinevirtual

Enable/Disable RTCP reports.

virtual OsStatus setRTCPName ( const char *  szName)
inlinevirtual

Set name send as part of RTCP reports.

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

Populate the codec factory, return number of rejected codecs.

Implemented in sipXmediaFactoryImpl.

virtual OsStatus setVideoPreviewDisplay ( void *  pDisplay)
inlinevirtual

Set the global video preview window.

Reimplemented in sipXmediaFactoryImpl.

virtual OsStatus setVideoQuality ( int  quality)
inlinevirtual

Set the global video quality.

Reimplemented in sipXmediaFactoryImpl.

virtual OsStatus setVideoParameters ( int  bitRate,
int  frameRate 
)
inlinevirtual

Set the global video parameters.

Reimplemented in sipXmediaFactoryImpl.

virtual OsStatus setVideoBitrate ( int  bitrate)
inlinevirtual
virtual OsStatus setVideoFramerate ( int  framerate)
inlinevirtual
virtual OsStatus setVideoCpuValue ( int  cpuValue)
inlinevirtual

Set the global CPU usage.

virtual OsStatus updateVideoPreviewWindow ( void *  displayContext)
inlinevirtual

Update the video preview window given the specified display context.

Reimplemented in sipXmediaFactoryImpl.

void setRtpPortRange ( int  startRtpPort,
int  lastRtpPort 
)
virtual

Sets the RTP port range for this factory.

OsStatus getNextRtpPort ( const char *  bindAddress,
int &  rtpPort 
)
virtual

Gets the next available rtp port.

OsStatus releaseRtpPort ( const int  rtpPort)
virtual

Release the rtp port back to the pool of available RTP ports.

Parameters
bindAddress- address on which to find available port, may be NULL
rtpPort- next available RTP port to attempt to bind do
virtual OsStatus setConnectionIdleTimeout ( const int  idleTimeout)
inlinevirtual

Set the connection idle timeout.

OsStatus addCodecPaths ( const size_t  nCodecPaths,
const UtlString  codecPaths[] 
)
static

Add directory paths to the codec search path.

Specify directories that will be added to the list of paths used when searching for codecs to load.

Note
The paths passed in should only contain syntactically valid directory paths. TODO: Syntactically invalid paths will be rejected returning OS_FAILED.
Parameters
[in]codecPaths- array of paths to load.
Return values
OS_SUCCESS- if all of the paths passed in are properly stored.
void clearCodecPaths ( )
static

Clear the static codec path list.

virtual void setDispatcher ( OsMsgDispatcher *  dispatcher)
pure virtual

Set the dispatcher for flowgraph independent media events/messages.

Implemented in CpTopologyGraphFactoryImpl.

virtual OsStatus getSpeakerVolume ( int &  iVolume) const
pure virtual

Get the speaker volume.

Implemented in sipXmediaFactoryImpl.

virtual OsStatus getSpeakerDevice ( UtlString &  device) const
pure virtual

Get the speaker device.

Implemented in sipXmediaFactoryImpl, and CpTopologyGraphFactoryImpl.

virtual OsStatus getMicrophoneGain ( int &  iVolume) const
pure virtual

Get the microphone gain.

Implemented in sipXmediaFactoryImpl.

virtual OsStatus getMicrophoneDevice ( UtlString &  device) const
pure virtual

Get the microphone device.

Implemented in sipXmediaFactoryImpl, and CpTopologyGraphFactoryImpl.

virtual OsStatus getLocalAudioConnectionId ( int &  connectionId) const
pure virtual

Get the connection id for the local audio connection.

Implemented in sipXmediaFactoryImpl.

virtual OsStatus getConnectionIdleTimeout ( int &  idleTimeout) const
inlinevirtual

Get the connection idle timeout.

void setConfiguredIpAddress ( const UtlString &  configuredIpAddress)
virtual

Set IP address to use in SDP (spoofed address)

virtual OsStatus getAudioAECMode ( MEDIA_AEC_MODE mode) const
inlinevirtual

Return status of echo cancellation.

Reimplemented in CpTopologyGraphFactoryImpl.

virtual OsStatus getAudioNoiseReductionMode ( MEDIA_NOISE_REDUCTION_MODE mode) const
inlinevirtual

Return status of noise reduction.

virtual OsStatus isAGCEnabled ( UtlBoolean &  bEnable) const
inlinevirtual

Return status of AGC.

virtual OsStatus isOutOfBandDTMFEnabled ( UtlBoolean &  enabled) const
inlinevirtual

Return status of out-of-band DTMF.

virtual OsStatus isInBandDTMFEnabled ( UtlBoolean &  enabled) const
inlinevirtual

Return status of in band DTMF.

UtlBoolean isAddressPortBusy ( const char *  bindAddress,
int  iPort,
int  checkTimeMS 
)
protected

Bind the the specified port and see if any data is ready to read for the designated check time.

Parameters
bindAddress- IP address on which to check port availablity
iPortPort number to check
checkTimeMSNumber of ms to wait for data. Note: had a problem on x86_64 where this was not properly invoked without specifying explicitly class CpMediaInterfaceFactoryImpl scope. So for now made this a non-virtual function.
OsStatus ensureCapacityCodecPaths ( size_t  newSize)
staticprotected

Ensure that there is enough capacity in our codec paths array.

Ensure that there is enough capacity in our codec paths array for newSize elements. If there is not enough capacity, then the maximum capacity is increased above newSize, unless there are so many elements that newSize exceeds 1/2 the maximum value of a size_t, in which case, it is just allocated to fit newSize, and no greater.

Parameters
[in]newSize- the size to check the codec path array allocation size against.
Return values
OS_SUCCESS- If everything went ok, and there is enough capacity.
OS_NO_MEMORY- If there was an allocation error.
CpMediaInterfaceFactoryImpl& operator= ( const CpMediaInterfaceFactoryImpl rhs)
private

Disabled equals operator.

Member Data Documentation

int miInterfaceId
protected

Id for the next media interface

int miGain
protected

Gain value stored for unmuting

int miStartRtpPort
protected

Requested starting rtp port

int miLastRtpPort
protected

Requested ending rtp port

int miNextRtpPort
protected

Next available rtp port

UtlSList mlistFreePorts
protected

List of recently freed ports

UtlSList mlistBusyPorts
protected

List of busy ports

OsMutex mlockList
protected

Lock for port allocation

UtlString mConfiguredIpAddress
protected

IP address to use for SDP c line

size_t mnAllocCodecPaths = 0
staticprotected

Number of slots allocated in codec path array.

size_t mnCodecPaths = 0
staticprotected

Number of codec paths stored.

UtlString * mpCodecPaths = NULL
staticprotected

dynamic array of paths to use when loading codecs.