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

#include <CpTopologyGraphInterface.h>

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

Public Member Functions

 CpTopologyGraphInterface (CpTopologyGraphFactoryImpl *factoryImpl, uint32_t samplesPerFrame, uint32_t samplesPerSec, const char *publicAddress=NULL, const char *localAddress=NULL, int numCodecs=0, SdpCodec *sdpCodecArray[]=NULL, const char *pLocale="", int expeditedIpTos=QOS_LAYER3_LOW_DELAY_IP_TOS, const char *stunServer=NULL, int stunPort=PORT_NONE, int stunKeepAlivePeriodSecs=28, const char *turnServer=NULL, int turnPort=PORT_NONE, const char *turnUsername=NULL, const char *turnPassword=NULL, int turnKeepAlivePeriodSecs=28, UtlBoolean enableIce=FALSE, OsMsgDispatcher *pDispatcher=NULL, MpInputDeviceManager *pInputDeviceManager=NULL, MpInputDeviceHandle inputDeviceHandle=1, UtlBoolean inputDeviceAlreadyEnabled=FALSE, MpOutputDeviceManager *pOutputDeviceManager=NULL, MpOutputDeviceHandle outputDeviceHandle=1)
 Default constructor. More...
 
virtual ~CpTopologyGraphInterface ()
 Destructor. More...
 
void release ()
 
virtual OsStatus createConnection (int &connectionId, const char *szLocalAddress, int localPort=0, void *videoWindowHandle=NULL, void *const pSecurityAttributes=NULL, const RtpTransportOptions rtpTransportOptions=RTP_TRANSPORT_UDP)
 Create a media connection in the media processing subsystem. More...
 
virtual OsStatus createConnection (int &connectionId, OsSocket *rtpSocket, OsSocket *rtcpSocket, UtlBoolean isMulticast)
 This is non-standard version of createConnection() to be used with custom OsSocket. More...
 
virtual OsStatus setPlcMethod (int connectionId, const UtlString &methodName="")
 Set PLC method to use for codecs which does not have own PLC. More...
 
virtual OsMsgDispatcher * setNotificationDispatcher (OsMsgDispatcher *pNotificationDispatcher)
 Add, replace, or clear the media notification dispatcher held by the MI. More...
 
virtual OsStatus setNotificationsEnabled (bool enabled, const UtlString &resourceName=NULL)
 Enable or disable media notifications for one/all resource(s). More...
 
int getNumBridgePorts ()
 Get number of bridge ports (-1 on failure). More...
 
OsStatus getConnectionPortOnBridge (int connectionId, int streamNum, int &portOnBridge)
 Look up the port on the bridge to which the indicated connection is connected. More...
 
OsStatus getResourceInputPortOnBridge (const UtlString &resourceName, int resourceOutputPortIndex, int &portOnBridge)
 Look up the port on the bridge to which the indicated resource is connected. More...
 
OsStatus getResourceOutputPortOnBridge (const UtlString &resourceName, int resourceInputPortIndex, int &portOnBridge)
 Look up the port on the bridge to which the indicated resource is connected. More...
 
virtual OsStatus setMediaPassThrough (int connectionId, MEDIA_STREAM_TYPE mediaType, int mediaTypeStreamIndex, UtlString &receiveAddress, int rtpPort, int rtcpPort)
 Set pass through port and address to send RTP stream to. More...
 
virtual OsStatus setConnectionDestination (int connectionId, const char *rtpHostAddress, int rtpAudioPort, int rtcpAudioPort, int rtpVideoPort, int rtcpVideoPort)
 Set the connection destination (target) for the designated media connection. More...
 
virtual OsStatus setConnectionDestination (int connectionId, CpMediaInterface::MEDIA_STREAM_TYPE mediaType, int streamIndex, const char *rtpHostAddress, int rtpPort, int rtcpPort)
 Set the connection destination (target) for the designated media connection. More...
 
virtual OsStatus copyPayloadIds (int connectionId, int numCodecs, SdpCodec *remoceCodecs[])
 copies payload IDs for matching codecs to interfaces codec list More...
 
virtual OsStatus startRtpSend (int connectionId, int numCodecs, SdpCodec *sendCodec[])
 Start sending RTP using the specified codec list. More...
 
virtual OsStatus startRtpReceive (int connectionId, int numCodecs, SdpCodec *sendCodec[])
 Set the connection destination (target) for the designated media connection. More...
 
virtual OsStatus stopRtpSend (int connectionId)
 Stop sending RTP and RTCP data for the specified connection. More...
 
virtual OsStatus stopRtpReceive (int connectionId)
 Stop receiving RTP and RTCP data for the specified connection. More...
 
virtual const SdpCodecList * getConnectionCodecList (int connectionId)
 Get the list of codecs and payload IDs for the connection. More...
 
virtual OsStatus deleteConnection (int connectionId)
 Delete the specified RTP or RTCP connetion. More...
 
virtual OsStatus startTone (int toneId, UtlBoolean local, UtlBoolean remote)
 Start playing the specified tone for this call. More...
 
virtual OsStatus startTone (const UtlString &resourceName, int toneId, UtlBoolean rfc4733Enabled=TRUE)
 
virtual OsStatus stopTone ()
 Stop playing all tones. More...
 
virtual OsStatus stopTone (const UtlString &resourceName, UtlBoolean rfc4733Enabled=TRUE)
 
virtual OsStatus setRtcpTimeOffset (int connectionId, CpMediaInterface::MEDIA_STREAM_TYPE mediaType, int streamIndex, int timeOffset)
 Set an offset to the NTP time provided in the RTCP SR. More...
 
virtual OsStatus startChannelTone (int connectionId, int toneId, UtlBoolean local, UtlBoolean remote)
 Start playing DTMF tone. More...
 
virtual OsStatus startChannelTone (const UtlString &resourceName, int connectionId, int toneId)
 
virtual OsStatus stopChannelTone (int connectionId)
 Stop playing DTMF tone. More...
 
virtual OsStatus stopChannelTone (const UtlString &resourceName, int connectionId)
 
virtual OsStatus startChannelOnlyTone (int connectionId, int toneId)
 
virtual OsStatus stopChannelOnlyTone (int connectionId)
 
virtual OsStatus playAudio (const char *url, UtlBoolean repeat, UtlBoolean local, UtlBoolean remote, UtlBoolean mixWithMic=false, int downScaling=100, UtlBoolean autoStopAfterFinish=TRUE)
 Play the specified audio URL to the call. More...
 
virtual OsStatus playAudio (const UtlString &resourceName, const char *url, UtlBoolean repeat, UtlBoolean autoStopAfterFinish=TRUE)
 
virtual OsStatus playBuffer (char *buf, unsigned long bufSize, uint32_t bufRate, int type, UtlBoolean repeat, UtlBoolean local, UtlBoolean remote, OsProtectedEvent *event=NULL, UtlBoolean mixWithMic=false, int downScaling=100, UtlBoolean autoStopOnFinish=TRUE)
 Play the specified audio buffer to the call. More...
 
virtual OsStatus playBuffer (const UtlString &resourceName, char *buf, unsigned long bufSize, uint32_t bufRate, int type, UtlBoolean repeat, OsProtectedEvent *event=NULL, UtlBoolean autoStopOnFinish=TRUE)
 
virtual OsStatus pauseAudio ()
 Pause all playing URLs or buffers. More...
 
virtual OsStatus pauseAudio (const UtlString &resourceName)
 
virtual OsStatus resumeAudio ()
 Resume all paused URLs or buffers. More...
 
virtual OsStatus resumeAudio (const UtlString &resourceName)
 
virtual OsStatus stopAudio ()
 Stop playing any URLs or buffers. More...
 
virtual OsStatus stopAudio (const UtlString &resourceName)
 
virtual OsStatus playChannelAudio (int connectionId, const char *url, UtlBoolean repeat, UtlBoolean local, UtlBoolean remote, UtlBoolean mixWithMic=false, int downScaling=100, UtlBoolean autoStopOnFinish=TRUE)
 
virtual OsStatus stopChannelAudio (int connectionId)
 
virtual OsStatus recordChannelAudio (int connectionId, const char *szFile, CpAudioFileFormat cpFileFormat=CP_WAVE_PCM_16, UtlBoolean appendToFile=FALSE, int numChannels=1, int maxTime=0, int silenceLength=-1, UtlBoolean setupMultiChannelMixesAutomatically=TRUE)
 Start recording to file. More...
 
virtual OsStatus recordAudio (const UtlString &resourceName, const char *szFile, CpAudioFileFormat cpFileFormat=CP_WAVE_PCM_16, UtlBoolean appendToFile=FALSE, int numChannels=1, int maxTime=0, int silenceLength=-1, UtlBoolean setupMultiChannelMixesAutomatically=TRUE)
 
virtual OsStatus pauseRecordChannelAudio (int connectionId)
 Pause buffer or file recording which has been started. More...
 
virtual OsStatus pauseRecordAudio (const UtlString &resourceName)
 
virtual OsStatus resumeRecordChannelAudio (int connectionId)
 Resume buffer or file recording which has been paused. More...
 
virtual OsStatus resumeRecordAudio (const UtlString &resourceName)
 
virtual OsStatus stopRecordChannelAudio (int connectionId)
 Stop buffer or file recording which has been started. More...
 
virtual OsStatus stopRecordAudio (const UtlString &resourceName)
 
virtual OsStatus recordBufferChannelAudio (int connectionId, char *pBuffer, int bufferSize, int maxRecordTime=-1, int maxSilence=-1)
 Start recording to buffer. More...
 
virtual OsStatus recordBufferAudio (const UtlString &resourceName, char *pBuffer, int bufferSize, int maxRecordTime=-1, int maxSilence=-1)
 
virtual OsStatus stopRecordBufferChannelAudio (int connectionId)
 
virtual OsStatus recordCircularBufferChannelAudio (int connectionId, CircularBufferPtr &buffer, CpMediaInterface::CpAudioFileFormat recordingFormat, unsigned long recordingBufferNotificationWatermark)
 
virtual OsStatus recordCircularBufferAudio (const UtlString &resourceName, CircularBufferPtr &buffer, CpMediaInterface::CpAudioFileFormat recordingFormat, unsigned long recordingBufferNotificationWatermark)
 
virtual OsStatus stopRecordCircularBufferChannelAudio (int connectionId)
 
virtual OsStatus createPlayer (MpStreamPlayer **ppPlayer, const char *szStream, int flags, OsMsgQ *pMsgQ=NULL, const char *szTarget=NULL)
 Deprecated. More...
 
virtual OsStatus destroyPlayer (MpStreamPlayer *pPlayer)
 Deprecated. More...
 
virtual OsStatus createPlaylistPlayer (MpStreamPlaylistPlayer **ppPlayer, OsMsgQ *pMsgQ=NULL, const char *szTarget=NULL)
 Deprecated. More...
 
virtual OsStatus destroyPlaylistPlayer (MpStreamPlaylistPlayer *pPlayer)
 Deprecated. More...
 
virtual OsStatus createQueuePlayer (MpStreamQueuePlayer **ppPlayer, OsMsgQ *pMsgQ=NULL, const char *szTarget=NULL)
 Deprecated. More...
 
virtual OsStatus destroyQueuePlayer (MpStreamQueuePlayer *pPlayer)
 Deprecated. More...
 
virtual OsStatus giveFocus ()
 Give the focus of the local audio device to the associated call. More...
 
virtual OsStatus defocus ()
 Take this call out of focus for the local audio device. More...
 
virtual void setCodecCPULimit (int iLimit)
 Set the CPU resource limit for the media connections in this call. More...
 
virtual OsStatus recordMic (int ms, int16_t *pAudioBuf, int bufferSize)
 Record the microphone data. More...
 
virtual OsStatus recordMic (int ms, int silenceLength, const char *fileName)
 Record the microphone data to a file. More...
 
virtual void setContactType (int connectionId, SIPX_CONTACT_TYPE eType, SIPX_CONTACT_ID contactId)
 Set the preferred contact type for this media connection. More...
 
virtual OsStatus setAudioCodecBandwidth (int connectionId, int bandWidth)
 Rebuild the codec factory on the fly. More...
 
virtual OsStatus limitCodecs (int connectionId, const SdpCodecList &includeOnlyCodecList)
 Further restrict the set of codecs to the list provided. More...
 
virtual OsStatus rebuildCodecFactory (int connectionId, int audioBandwidth, int videoBandwidth, UtlString &videoCodec)
 Rebuild codec factory with one video codec. More...
 
virtual OsStatus setConnectionBitrate (int connectionId, int bitrate)
 Set connection bitrate on the fly. More...
 
virtual OsStatus setConnectionFramerate (int connectionId, int framerate)
 Set connection framerate on the fly. More...
 
virtual OsStatus setSecurityAttributes (const void *security)
 
virtual OsStatus addAudioRtpConnectionDestination (int connectionId, int iPriority, const char *candidateIp, int candidatePort)
 Add an alternate Audio RTP connection destination for this media interface. More...
 
virtual OsStatus addAudioRtcpConnectionDestination (int connectionId, int iPriority, const char *candidateIp, int candidatePort)
 Add an alternate Audio RTCP connection destination for this media interface. More...
 
virtual OsStatus addVideoRtpConnectionDestination (int connectionId, int iPriority, const char *candidateIp, int candidatePort)
 Add an alternate Video RTP connection destination for this media interface. More...
 
virtual OsStatus addVideoRtcpConnectionDestination (int connectionId, int iPriority, const char *candidateIp, int candidatePort)
 Add an alternate Video RTCP connection destination for this media interface. More...
 
virtual void setConnectionTcpRole (const int connectionId, const RtpTcpRoles role)
 
virtual OsStatus generateVoiceQualityReport (int connectiond, const char *callId, UtlString &report)
 
OsStatus enableDtx (int connectionId, UtlBoolean enable)
 Enable/disable discontinuous transmission for given connection. More...
 
OsStatus setRtpInactivityTimeout (int connectionId, int timeoutMs)
 Set inactive time (in ms) after which RTP stream is actually marked inactive. More...
 
virtual OsStatus getCapabilities (int connectionId, UtlString &rtpHostAddress, int &rtpAudioPort, int &rtcpAudioPort, int &rtpVideoPort, int &rtcpVideoPort, SdpCodecList &supportedCodecs, SdpSrtpParameters &srtpParams, int bandWidth, int &videoBandwidth, int &videoFramerate)
 
virtual OsStatus getCapabilitiesEx (int connectionId, int nMaxAddresses, UtlString rtpHostAddresses[], int rtpAudioPorts[], int rtcpAudioPorts[], int rtpVideoPorts[], int rtcpVideoPorts[], RTP_TRANSPORT transportTypes[], int &nActualAddresses, SdpCodecList &supportedCodecs, SdpSrtpParameters &srtpParameters, int bandWidth, int &videoBandwidth, int &videoFramerate)
 
virtual int getCodecCPUCost ()
 
virtual int getCodecCPULimit ()
 
virtual uint32_t getSamplesPerSec ()
 Returns the sample rate of the flowgraph. More...
 
virtual uint32_t getSamplesPerFrame ()
 Returns the samples per frame of the flowgraph. More...
 
virtual OsMsgQ * getMsgQ ()
 Returns the flowgraph's message queue. More...
 
virtual OsMsgDispatcher * getNotificationDispatcher ()
 Returns the Media Notification dispatcher this controls. More...
 
virtual OsStatus setMixWeightForOutput (int bridgeOutputPort, float weight)
 Set the mix weight for all inputs, but its own to the given weight and output on bridge. More...
 
virtual OsStatus setMixWeightsForOutput (int bridgeOutputPort, int numWeights, float weights[])
 Set gain for inputs to given output on bridge. More...
 
virtual OsStatus getVideoQuality (int &quality)
 
virtual OsStatus getVideoBitRate (int &bitRate)
 
virtual OsStatus getVideoFrameRate (int &frameRate)
 
virtual OsStatus getPrimaryCodec (int connectionId, UtlString &audioCodec, UtlString &videoCodec, int *audiopPayloadType, int *videoPayloadType, bool &isEncrypted)
 Returns the primary codec for the connection. More...
 
virtual OsStatus setVideoWindowDisplay (const void *hWnd)
 
virtual const void * getVideoWindowDisplay ()
 
virtual OsStatus getAudioEnergyLevels (int &iInputEnergyLevel, int &iOutputEnergyLevel)
 
virtual OsStatus getAudioEnergyLevels (int connectionId, int &iInputEnergyLevel, int &iOutputEnergyLevel, int &nContributors, unsigned int *pContributorSRCIds, int *pContributorEngeryLevels)
 
virtual OsStatus getAudioRtpSourceIDs (int connectionId, unsigned int &uiSendingSSRC, unsigned int &uiReceivingSSRC)
 Get receiving and sending SSRCs for given connection. More...
 
virtual OsStatus enableAudioTransport (int connectionId, UtlBoolean bEnable)
 
virtual OsStatus enableVideoTransport (int connectionId, UtlBoolean bEnable)
 
virtual OsStatus setMediaProperty (const UtlString &propertyName, const UtlString &propertyValue)
 Set a media property on the media interface. More...
 
virtual OsStatus getMediaProperty (const UtlString &propertyName, UtlString &propertyValue)
 Get a media property on the media interface. More...
 
virtual OsStatus setMediaProperty (int connectionId, const UtlString &propertyName, const UtlString &propertyValue)
 Set a media property associated with a connection. More...
 
virtual OsStatus getMediaProperty (int connectionId, const UtlString &propertyName, UtlString &propertyValue)
 Get a media property associated with a connection. More...
 
virtual OsStatus getConnectionInputLatency (int &latency, MpConnectionID connectionId, int streamId=0)
 Get a latency of the input part of the RTP or local connection. More...
 
virtual OsStatus getConnectionOutputLatency (int &latency, MpConnectionID connectionId=-1)
 Get a latency of the output part of the RTP or local connection. More...
 
virtual UtlString getType ()
 Set IP address to advertise in SDP. More...
 
virtual UtlBoolean isSendingRtpAudio (int connectionId)
 
virtual UtlBoolean isSendingRtpVideo (int connectionId)
 
virtual UtlBoolean isReceivingRtpAudio (int connectionId)
 
virtual UtlBoolean isReceivingRtpVideo (int connectionId)
 
virtual UtlBoolean isDestinationSet (int connectionId)
 
virtual UtlBoolean canAddParty ()
 Query whether a new party can be added to this media interfaces. More...
 
virtual UtlBoolean isVideoInitialized (int connectionId)
 Query whether the connection has started sending or receiving video. More...
 
virtual UtlBoolean isAudioInitialized (int connectionId)
 Query whether the connection has started sending or receiving audio. More...
 
virtual UtlBoolean isAudioAvailable ()
 Query if the audio device is available. More...
 
virtual UtlBoolean isVideoConferencing ()
 Query if we are mixing a video conference. More...
 
- Public Member Functions inherited from CpMediaInterface
 CpMediaInterface (CpMediaInterfaceFactoryImpl *pFactoryImpl)
 Default constructor. More...
 
virtual OsStatus setSrtpParams (SdpSrtpParameters &srtpParameters)
 Set the secure RTP parameters. More...
 
virtual void setConfiguredIpAddress (const UtlString &ipAddress)
 
virtual UtlBoolean isConnectionIdValid (int connectionId)
 Query if connectionId is valid. More...
 

Protected Member Functions

UtlBoolean getLocalAddresses (int connectionId, UtlString &hostIp, int &rtpAudioPort, int &rtcpAudioPort, int &rtpVideoPort, int &rtcpVideoPort)
 
UtlBoolean getNatedAddresses (int connectionId, UtlString &hostIp, int &rtpAudioPort, int &rtcpAudioPort, int &rtpVideoPort, int &rtcpVideoPort)
 
UtlBoolean getRelayAddresses (int connectionId, UtlString &hostIp, int &rtpAudioPort, int &rtcpAudioPort, int &rtpVideoPort, int &rtcpVideoPort)
 
OsStatus addLocalContacts (int connectionId, int nMaxAddresses, UtlString rtpHostAddresses[], int rtpAudioPorts[], int rtcpAudioPorts[], int rtpVideoPorts[], int rtcpVideoPorts[], int &nActualAddresses)
 
OsStatus addNatedContacts (int connectionId, int nMaxAddresses, UtlString rtpHostAddresses[], int rtpAudioPorts[], int rtcpAudioPorts[], int rtpVideoPorts[], int rtcpVideoPorts[], int &nActualAddresses)
 
OsStatus addRelayContacts (int connectionId, int nMaxAddresses, UtlString rtpHostAddresses[], int rtpAudioPorts[], int rtcpAudioPorts[], int rtpVideoPorts[], int rtcpVideoPorts[], int &nActualAddresses)
 
void applyAlternateDestinations (int connectionId)
 
OsStatus createRtpSocketPair (UtlString localAddress, int localPort, UtlBoolean isMulticast, SIPX_CONTACT_TYPE contactType, OsSocket *&rtpSocket, OsSocket *&rtcpSocket)
 Create socket pair for RTP/RTCP streams. More...
 
- Protected Member Functions inherited from CpMediaInterface
virtual ~CpMediaInterface ()
 Protected Destructor so that we can manage media interface pointers. More...
 

Private Member Functions

int getNextConnectionId ()
 Get the next unique connection Id scoped to this flowgraph. More...
 
CpTopologyMediaConnectioncreateMediaConnection (int &connectionId, UtlBoolean isMcast)
 Create media connection structure to store connection params. More...
 
OsStatus deleteMediaConnection (CpTopologyMediaConnection *mediaConnection)
 Free media connection structure. More...
 
CpTopologyMediaConnectiongetMediaConnection (int connectionId)
 Get media connection structure by its connectionID. More...
 
OsStatus discardLoopbackRtp (CpTopologyMediaConnection *mediaConnection)
 Enable discarding of our RTP stream, looped back to us. More...
 
void stopRtpReceive (CpTopologyMediaConnection *mediaConnection)
 Stop receiving RTP on selected media connection. More...
 
void stopRtpSend (CpTopologyMediaConnection *mediaConnection)
 Stop receiving RTP on selected media connection. More...
 
OsStatus setConnectionWeightOnBridge (CpTopologyMediaConnection *mediaConnection, int destPort, float weight)
 Set mixing weight from all connection's streams to the given output port. More...
 
OsStatus setConnectionToConnectionWeight (CpTopologyMediaConnection *srcConnection, int destConnectionId, float weight)
 Set mixing weight from all connection's streams to the given output port. More...
 
OsStatus setMicGain (float gain)
 Set the Mic gain. More...
 
OsStatus setMicWeightOnBridge (float weight)
 Set mixing weight from the Mic to all other Bridge ports. More...
 
 CpTopologyGraphInterface (CpTopologyGraphInterface &)
 Disabled copy constructor. More...
 
CpTopologyGraphInterfaceoperator= (const CpTopologyGraphInterface &)
 Disabled assignment operator. More...
 

Private Attributes

int mLastConnectionId
 
MpResourceFactory * mpResourceFactory
 
MpTopologyGraph * mpTopologyGraph
 
SdpCodecList mSupportedCodecs
 
UtlDList mMediaConnections
 
int mExpeditedIpTos
 
int mInitialTopologyBridgePorts
 
MpInputDeviceManager * mpInputDeviceManager
 
MpInputDeviceHandle mInputDeviceHandle
 
MpOutputDeviceManager * mpOutputDeviceManager
 
MpOutputDeviceHandle mOutputDeviceHandle
 
UtlString mStunServer
 
int mStunPort
 
int mStunRefreshPeriodSecs
 
UtlString mTurnServer
 
int mTurnPort
 
int mTurnRefreshPeriodSecs
 
UtlString mTurnUsername
 
UtlString mTurnPassword
 
UtlBoolean mEnableIce
 
UtlString mRtpReceiveHostAddress
 
UtlString mLocalAddress
 
UtlHashMap mInterfaceProperties
 
MaNotfTranslatorDispatcher mTranslatorDispatcher
 

Additional Inherited Members

- Public Types inherited from CpMediaInterface
enum  MEDIA_STREAM_TYPE { MEDIA_TYPE_UNKNOWN = 0, AUDIO_STREAM, VIDEO_STREAM }
 
enum  CpAudioFileFormat {
  CP_UNKNOWN_FORMAT = 0, CP_WAVE_PCM_16, CP_WAVE_ALAW, CP_WAVE_MULAW,
  CP_WAVE_GSM, CP_OGG_OPUS
}
 
- Static Public Member Functions inherited from CpMediaInterface
static int getInvalidConnectionId ()
 Provide an invalid connectionId. More...
 
- Protected Attributes inherited from CpMediaInterface
CpMediaInterfaceFactoryImplmpFactoryImpl
 
SdpSrtpParameters mSrtpParams
 
UtlString mConfiguredIpAddress
 Address to use instead of local address in SDP. More...
 

Detailed Description

Subsystem manager and creator of CpTopologyGraphInterfaces specialization of CpMediaInterface

Constructor & Destructor Documentation

CpTopologyGraphInterface ( CpTopologyGraphFactoryImpl factoryImpl,
uint32_t  samplesPerFrame,
uint32_t  samplesPerSec,
const char *  publicAddress = NULL,
const char *  localAddress = NULL,
int  numCodecs = 0,
SdpCodec *  sdpCodecArray[] = NULL,
const char *  pLocale = "",
int  expeditedIpTos = QOS_LAYER3_LOW_DELAY_IP_TOS,
const char *  stunServer = NULL,
int  stunPort = PORT_NONE,
int  stunKeepAlivePeriodSecs = 28,
const char *  turnServer = NULL,
int  turnPort = PORT_NONE,
const char *  turnUsername = NULL,
const char *  turnPassword = NULL,
int  turnKeepAlivePeriodSecs = 28,
UtlBoolean  enableIce = FALSE,
OsMsgDispatcher *  pDispatcher = NULL,
MpInputDeviceManager *  pInputDeviceManager = NULL,
MpInputDeviceHandle  inputDeviceHandle = 1,
UtlBoolean  inputDeviceAlreadyEnabled = FALSE,
MpOutputDeviceManager *  pOutputDeviceManager = NULL,
MpOutputDeviceHandle  outputDeviceHandle = 1 
)

Default constructor.

Destructor.

Disabled copy constructor.

Member Function Documentation

void release ( )
virtual

public interface for destroying this media interface

Implements CpMediaInterface.

OsStatus createConnection ( int &  connectionId,
const char *  szLocalAddress,
int  localPort = 0,
void *  videoWindowHandle = NULL,
void *const  pSecurityAttributes = NULL,
const RtpTransportOptions  rtpTransportOptions = RTP_TRANSPORT_UDP 
)
virtual

Create a media connection in the media processing subsystem.

One instance of the CpMediaInterface exists for each call, however, each leg of the call requires an individual connection.

Parameters
[out]connectionId- A newly allocated connection id returned via this call. The connection passed to many other media processing methods in this interface.
[in]szLocalAddress- Local address (interface) that should be used for this connection.
[in]localPort- Local port that should be used for this connection. Note, that in fact two ports will be allocated - (localPort) for RTP and (localPort+1) for RTCP. If 0 is passed, port number will be selected automatically.
[in]videoWindowHandle- Video Window handle if using video. Supply a window handle of NULL to disable video for this call/connection.
pSecurityAttributes- Pointer to a SIPXVE_SECURITY_ATTRIBUTES object.
pSocketIdleSink- <<UNKNOWN -- What does this do? -- kkyzivat 20070801 >>
pMediaEventListener- <<UNKNOWN -- What does this do? -- kkyzivat 20070801 >>
[in]rtpTransportOptionsRTP_TRANSPORT_UDP, RTP_TRANSPORT_TCP, or BOTH
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

OsStatus createConnection ( int &  connectionId,
OsSocket *  rtpSocket,
OsSocket *  rtcpSocket,
UtlBoolean  isMulticast 
)
virtual

This is non-standard version of createConnection() to be used with custom OsSocket.

This version of createConnection() can be used if you want to override the OsSocket class in order to provide an external socket implementation.

Note
In this case application should free socket instances by itself, because it is not freed in deleteConnection() method.
OsStatus setPlcMethod ( int  connectionId,
const UtlString &  methodName = "" 
)
virtual

Set PLC method to use for codecs which does not have own PLC.

Parameters
[in]connectionId- Connection Id for the call leg obtained from createConnection
[in]methodName- Name of PLC method. If method name is unknown, default method will be used. This also means you could pass "" to select default method.
Return values
OS_SUCCESS- message to connection was sent, PLC method will be changed on next message processing interval.
OS_NOT_FOUND- connection with given connectionId was not found.
OS_NOT_SUPPORTED- this implementation of CpMediaInterface does not support PLC algorithm changing.
OS_NOT_YET_IMPLEMENTED- this implementation of CpMediaInterface might support PLC algorithm changing, but this feature is not yet implemented.

Implements CpMediaInterface.

OsMsgDispatcher * setNotificationDispatcher ( OsMsgDispatcher *  pNotificationDispatcher)
virtual

Add, replace, or clear the media notification dispatcher held by the MI.

Gives the Media Interface an object to help in the dispatching of notification messages to users of the media interface. Users are free to subclass OsMsgDispatcher to filter messages as they see fit, and should hold on to it to receive their messages.

Parameters
[in]pNotificationDispatcher- A notification dispatcher to give to the MI.
Returns
Pointer to the previous media notification dispatcher set in this MI. If there was no previous media notification dispatcher, NULL is returned.

Implements CpMediaInterface.

OsStatus setNotificationsEnabled ( bool  enabled,
const UtlString &  resourceName = NULL 
)
virtual

Enable or disable media notifications for one/all resource(s).

Enable or disable media notifications for a given resource or all resources.

If /p NULL is passed for resource name, then all resources will have all notifications enabled/disabled This is an asynchronous operation. After calling this, it may take a bit of time before the new state takes effect.

Parameters
[in]enabled- Whether notification type is to be enabled or disabled.
[in]resourceName- the name of the resource to have notifications enabled/disabled on.
Return values
OS_SUCCESSif the initial sending of a message to enable/disable notifications succeeded.
OS_NOT_FOUNDif there is no resource named /p resourceName.
OS_FAILEDif some other failure in queuing the message occurred.

Implements CpMediaInterface.

int getNumBridgePorts ( )
virtual

Get number of bridge ports (-1 on failure).

Reimplemented from CpMediaInterface.

OsStatus getConnectionPortOnBridge ( int  connectionId,
int  streamNum,
int &  portOnBridge 
)

Look up the port on the bridge to which the indicated connection is connected.

Parameters
[in]connectionId- ID of connection to lookup.
[in]streamNum- number of an input RTP stream to lookup. Numbering starts from 0, and stream 0 is always present.
[out]portOnBridge- found bridge port or -1 on failure.
Note
Output bridge port is always the same as input bridge port for stream 0.
Return values
OS_SUCCESSon success
OS_NOT_FOUNDif some error occurs.
OsStatus getResourceInputPortOnBridge ( const UtlString &  resourceName,
int  resourceOutputPortIndex,
int &  portOnBridge 
)

Look up the port on the bridge to which the indicated resource is connected.

Warning
You must be sure, that this resource is actually connected to the bridge.
Parameters
[in]resourceName- name of the resource to lookup.
[in]resourceOutputPortIndex- index of the resource's output port which is connected to the bridge.
[out]portOnBridge- index of an input port to which resource is connected.
OsStatus getResourceOutputPortOnBridge ( const UtlString &  resourceName,
int  resourceInputPortIndex,
int &  portOnBridge 
)

Look up the port on the bridge to which the indicated resource is connected.

Warning
You must be sure, that this resource is actually connected to the bridge.
Parameters
[in]resourceName- name of the resource to lookup.
[in]resourceInputPortIndex- index of the resource's input port which is connected to the bridge.
[out]portOnBridge- index of an input port to which resource is connected.
OsStatus setMediaPassThrough ( int  connectionId,
MEDIA_STREAM_TYPE  mediaType,
int  mediaTypeStreamIndex,
UtlString &  receiveAddress,
int  rtpPort,
int  rtcpPort 
)
virtual

Set pass through port and address to send RTP stream to.

Set up so that RTP stream does not go through the media subsystem, but get send directly to this port and address. The idea is that this address and port(s) are provided for use in advertizing in the SDP for the local address and port that the remote side should send the media stream to. This address and port is provided in the getCapabilitiesEx/getCapabilities methods.

Implements CpMediaInterface.

OsStatus setConnectionDestination ( int  connectionId,
const char *  rtpHostAddress,
int  rtpAudioPort,
int  rtcpAudioPort,
int  rtpVideoPort,
int  rtcpVideoPort 
)
virtual

Set the connection destination (target) for the designated media connection.

Parameters
[in]connectionId- Connection Id for the call leg obtained from createConnection
[in]rtpHostAddress- IP (or host) address of remote party.
[in]rtpAudioPort- RTP audio port of remote party
[in]rtcpAudioPort- RTCP audio port of remote party
[in]rtpVideoPort- RTP video port of remote party
[in]rtcpVideoPort- RTCP video port of remote party
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

OsStatus setConnectionDestination ( int  connectionId,
CpMediaInterface::MEDIA_STREAM_TYPE  mediaType,
int  streamIndex,
const char *  rtpHostAddress,
int  rtpPort,
int  rtcpPort 
)
virtual

Set the connection destination (target) for the designated media connection.

Parameters
[in]connectionId- Connection Id for the call leg obtained from createConnection
[in]rtpHostAddress- IP (or host) address of remote party.
[in]rtpAudioPort- RTP audio port of remote party
[in]rtcpAudioPort- RTCP audio port of remote party
[in]rtpVideoPort- RTP video port of remote party
[in]rtcpVideoPort- RTCP video port of remote party
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

OsStatus copyPayloadIds ( int  connectionId,
int  numCodecs,
SdpCodec *  remoceCodecs[] 
)
virtual

copies payload IDs for matching codecs to interfaces codec list

Implements CpMediaInterface.

OsStatus startRtpSend ( int  connectionId,
int  numCodecs,
SdpCodec *  sendCodec[] 
)
virtual

Start sending RTP using the specified codec list.

Generally, this codec list is the intersection between both parties.

Parameters
[in]connectionId- Connection Id for the call leg obtained from createConnection
[in]numCodecNumber of codecs supplied in the sendCodec array
[in]sendCodecArray of codecs ordered in sending preference.
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

OsStatus startRtpReceive ( int  connectionId,
int  numCodecs,
SdpCodec *  sendCodec[] 
)
virtual

Set the connection destination (target) for the designated media connection.

Parameters
[in]connectionId- Connection Id for the call leg obtained from createConnection
[in]rtpHostAddress- IP (or host) address of remote party.
[in]rtpAudioPort- RTP audio port of remote party
[in]rtcpAudioPort- RTCP audio port of remote party
[in]rtpVideoPort- RTP video port of remote party
[in]rtcpVideoPort- RTCP video port of remote party
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

OsStatus stopRtpSend ( int  connectionId)
virtual

Stop sending RTP and RTCP data for the specified connection.

Parameters
[in]connectionId- Connection Id for the call leg obtained from createConnection
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

OsStatus stopRtpReceive ( int  connectionId)
virtual

Stop receiving RTP and RTCP data for the specified connection.

Parameters
[in]connectionId- Connection Id for the call leg obtained from createConnection
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

const SdpCodecList * getConnectionCodecList ( int  connectionId)
virtual

Get the list of codecs and payload IDs for the connection.

Return values
pointerto connection's SdpCodecList

Implements CpMediaInterface.

OsStatus deleteConnection ( int  connectionId)
virtual

Delete the specified RTP or RTCP connetion.

Delete the specified connection and free up any resources associated with that connection.

Parameters
[in]connectionId- Connection Id for the call leg obtained from createConnection.
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

OsStatus startTone ( int  toneId,
UtlBoolean  local,
UtlBoolean  remote 
)
virtual

Start playing the specified tone for this call.

If the tone is a DTMF tone and the remote flag is set, the interface should send out of band DTMF using RFC 2833. Inband audio should be sent to all connections. If a previous tone was playing, calling startTone should automatically stop existing tone.

Parameters
[in]toneId- The designated tone to play (TODO: make enum)
[in]local- True indicates that sound should be played to the local speaker (assuming call is in focus).
[in]remote- True indicates that the sound should be played to all remote parties.
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

OsStatus startTone ( const UtlString &  resourceName,
int  toneId,
UtlBoolean  rfc4733Enabled = TRUE 
)
virtual
OsStatus stopTone ( )
virtual

Stop playing all tones.

Implements CpMediaInterface.

OsStatus stopTone ( const UtlString &  resourceName,
UtlBoolean  rfc4733Enabled = TRUE 
)
virtual
OsStatus setRtcpTimeOffset ( int  connectionId,
CpMediaInterface::MEDIA_STREAM_TYPE  mediaType,
int  streamIndex,
int  timeOffset 
)
virtual

Set an offset to the NTP time provided in the RTCP SR.

Some tones/implementations may not support this. For example, some DTMF playing implementations will only play DTMF for a fixed interval.

Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

OsStatus startChannelTone ( int  connectionId,
int  toneId,
UtlBoolean  local,
UtlBoolean  remote 
)
virtual

Start playing DTMF tone.

Allows the RTCP synchronization time to be offset from the local wall clock time (NTP time). This does not efect the RTP timestamps in the RTP packets. It only effects the synchronization time in the RTCP sender report by offsetting the calculation of the RTP timestamp in the RTCP sender report for the current wall clock time in the RTCP sender report. This has the effect of adding a syncrhonization offset from other RTP streams (for receiving end points that use the RTCP sender report for synchronization).

Parameters
[in]connectionId- connection in which the RTP stream to be offset is contained.
[in]mediaType- media time of the stream to be offset (e.g. video or audio)
[in]streamIndex- index to specific RTP stream of the give media type in the given connection.
[in]timeOffset- offset to apply to the stream synchronization time in milliseconds
Return values

Implements CpMediaInterface.

OsStatus startChannelTone ( const UtlString &  resourceName,
int  connectionId,
int  toneId 
)
virtual
OsStatus stopChannelTone ( int  connectionId)
virtual

Stop playing DTMF tone.

Implements CpMediaInterface.

OsStatus stopChannelTone ( const UtlString &  resourceName,
int  connectionId 
)
virtual
OsStatus startChannelOnlyTone ( int  connectionId,
int  toneId 
)
virtual

OsStatus stopChannelOnlyTone ( int  connectionId)
virtual

OsStatus playAudio ( const char *  url,
UtlBoolean  repeat,
UtlBoolean  local,
UtlBoolean  remote,
UtlBoolean  mixWithMic = false,
int  downScaling = 100,
UtlBoolean  autoStopAfterFinish = TRUE 
)
virtual

Play the specified audio URL to the call.

Parameters
[in]url- Audio url to be played – The sipX implementation is limited to file paths (not file Urls).
[in]repeat- If set, loop the audio file until stopAudio is called.
[in]local- True indicates that sound should be played to the local speaker (assuming call is in focus).
[in]remote- True indicates that the sound should be played to all remote parties.
[in]mixWithMic- True to mix with microphone or False to replace it.
[in]downScaling- 100 for no down scaling (range from 0 to 100)
[in]autoStopAfterFinish- if set to TRUE you don't need to call stopAudio() when playback finishes because of end of the file. Otherwise you need to call stopAudio() on receiving of FINISHED notification.
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

OsStatus playAudio ( const UtlString &  resourceName,
const char *  url,
UtlBoolean  repeat,
UtlBoolean  autoStopAfterFinish = TRUE 
)
virtual
OsStatus playBuffer ( char *  buf,
unsigned long  bufSize,
uint32_t  bufRate,
int  type,
UtlBoolean  repeat,
UtlBoolean  local,
UtlBoolean  remote,
OsProtectedEvent *  event = NULL,
UtlBoolean  mixWithMic = false,
int  downScaling = 100,
UtlBoolean  autoStopOnFinish = TRUE 
)
virtual

Play the specified audio buffer to the call.

Todo:
This method should also specify the audio format (e.g. samples/per second, etc.).
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>
See also
CpMediaInterface::playAudio

Implements CpMediaInterface.

OsStatus playBuffer ( const UtlString &  resourceName,
char *  buf,
unsigned long  bufSize,
uint32_t  bufRate,
int  type,
UtlBoolean  repeat,
OsProtectedEvent *  event = NULL,
UtlBoolean  autoStopOnFinish = TRUE 
)
virtual
OsStatus pauseAudio ( )
virtual

Pause all playing URLs or buffers.

Todo:
This method should also take an optional uniqueId representing a particular playing instance to pause, instead of all of them.
Return values
OS_SUCCESSif the asynchronous request to pause audio succeeded.
OS_NOT_FOUNDif required underlying media resources are not found.

Implements CpMediaInterface.

OsStatus pauseAudio ( const UtlString &  resourceName)
virtual
OsStatus resumeAudio ( )
virtual

Resume all paused URLs or buffers.

Todo:
This method should also take an optional uniqueId representing a particular paused instance to resume, instead of all of them.
Return values
OS_SUCCESSif the asynchronous request to pause audio succeeded.
OS_NOT_FOUNDif required underlying media resources are not found.

Implements CpMediaInterface.

OsStatus resumeAudio ( const UtlString &  resourceName)
virtual
OsStatus stopAudio ( )
virtual

Stop playing any URLs or buffers.

Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070802 >>

Implements CpMediaInterface.

OsStatus stopAudio ( const UtlString &  resourceName)
virtual
OsStatus playChannelAudio ( int  connectionId,
const char *  url,
UtlBoolean  repeat,
UtlBoolean  local,
UtlBoolean  remote,
UtlBoolean  mixWithMic = false,
int  downScaling = 100,
UtlBoolean  autoStopOnFinish = TRUE 
)
virtual

Implements CpMediaInterface.

OsStatus stopChannelAudio ( int  connectionId)
virtual

Implements CpMediaInterface.

OsStatus recordChannelAudio ( int  connectionId,
const char *  szFile,
CpAudioFileFormat  cpFileFormat = CP_WAVE_PCM_16,
UtlBoolean  appendToFile = FALSE,
int  numChannels = 1,
int  maxTime = 0,
int  silenceLength = -1,
UtlBoolean  setupMultiChannelMixesAutomatically = TRUE 
)
virtual

Start recording to file.

Implements CpMediaInterface.

OsStatus recordAudio ( const UtlString &  resourceName,
const char *  szFile,
CpAudioFileFormat  cpFileFormat = CP_WAVE_PCM_16,
UtlBoolean  appendToFile = FALSE,
int  numChannels = 1,
int  maxTime = 0,
int  silenceLength = -1,
UtlBoolean  setupMultiChannelMixesAutomatically = TRUE 
)
virtual
OsStatus pauseRecordChannelAudio ( int  connectionId)
virtual

Pause buffer or file recording which has been started.

Implements CpMediaInterface.

OsStatus pauseRecordAudio ( const UtlString &  resourceName)
virtual
OsStatus resumeRecordChannelAudio ( int  connectionId)
virtual

Resume buffer or file recording which has been paused.

Implements CpMediaInterface.

OsStatus resumeRecordAudio ( const UtlString &  resourceName)
virtual
OsStatus stopRecordChannelAudio ( int  connectionId)
virtual

Stop buffer or file recording which has been started.

Parameters
[in]connectionId- handle for media connection to which recorder is relate
[in]szFile- name of file to record to
[in]cpFileFormat- audio encoding format to use in the file
[in]appendToFile- if file exist TRUE/FALSE should append to existing audio file. Note: If file is existing, it must be of the same audio format. Also be aware that when stopping and starting in rapid succession, you should wait for the stop notification before starting to record again with the same file or results are unpredictable.
[in]numChannels- number of channels of audio to record to file
[in]maxTime- max number of milliseconds to record, or 0 for no limit
[in]silenceLength- length of silence (in milliseconds) after which recording is automatically stopped. This feature is disabled if -1 is passed.
[in]setupMultiChannelMixesAutomatically- if number of channels is > 1 and this is true then the following mixes are automatically created: -All Local resources (including mic and file playback) are routed to channel 1 -The middle channels (2-3 in a 4 channel setup) get individual RTP resources -The last channel (channel 4 in a 4 channel setup) gets a mix of all other RTP resources
Returns
OS_SUCCESS if file was successfully opened (and if append, format is the same) OS_FAILED if existing file was of a different audio format than requested or unable to determine existing file audio format, or error opening file for read and write.

Implements CpMediaInterface.

OsStatus stopRecordAudio ( const UtlString &  resourceName)
virtual
OsStatus recordBufferChannelAudio ( int  connectionId,
char *  pBuffer,
int  bufferSize,
int  maxRecordTime = -1,
int  maxSilence = -1 
)
virtual

Start recording to buffer.

Implements CpMediaInterface.

OsStatus recordBufferAudio ( const UtlString &  resourceName,
char *  pBuffer,
int  bufferSize,
int  maxRecordTime = -1,
int  maxSilence = -1 
)
virtual
OsStatus stopRecordBufferChannelAudio ( int  connectionId)
virtual

Implements CpMediaInterface.

OsStatus recordCircularBufferChannelAudio ( int  connectionId,
CircularBufferPtr &  buffer,
CpMediaInterface::CpAudioFileFormat  recordingFormat,
unsigned long  recordingBufferNotificationWatermark 
)
virtual

Implements CpMediaInterface.

OsStatus recordCircularBufferAudio ( const UtlString &  resourceName,
CircularBufferPtr &  buffer,
CpMediaInterface::CpAudioFileFormat  recordingFormat,
unsigned long  recordingBufferNotificationWatermark 
)
virtual
OsStatus stopRecordCircularBufferChannelAudio ( int  connectionId)
virtual

Implements CpMediaInterface.

OsStatus createPlayer ( MpStreamPlayer **  ppPlayer,
const char *  szStream,
int  flags,
OsMsgQ *  pMsgQ = NULL,
const char *  szTarget = NULL 
)
virtual

Deprecated.

Implements CpMediaInterface.

OsStatus destroyPlayer ( MpStreamPlayer *  pPlayer)
virtual

Deprecated.

Implements CpMediaInterface.

OsStatus createPlaylistPlayer ( MpStreamPlaylistPlayer **  ppPlayer,
OsMsgQ *  pMsgQ = NULL,
const char *  szTarget = NULL 
)
virtual

Deprecated.

Implements CpMediaInterface.

OsStatus destroyPlaylistPlayer ( MpStreamPlaylistPlayer *  pPlayer)
virtual

Deprecated.

Implements CpMediaInterface.

OsStatus createQueuePlayer ( MpStreamQueuePlayer **  ppPlayer,
OsMsgQ *  pMsgQ = NULL,
const char *  szTarget = NULL 
)
virtual

Deprecated.

Implements CpMediaInterface.

OsStatus destroyQueuePlayer ( MpStreamQueuePlayer *  pPlayer)
virtual

Deprecated.

Implements CpMediaInterface.

OsStatus giveFocus ( )
virtual

Give the focus of the local audio device to the associated call.

(for example, take this call off hold).

Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070802 >>

Implements CpMediaInterface.

OsStatus defocus ( )
virtual

Take this call out of focus for the local audio device.

(for example, put this call on hold).

Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070802 >>

Implements CpMediaInterface.

void setCodecCPULimit ( int  iLimit)
virtual

Set the CPU resource limit for the media connections in this call.

This is used to limit the available codecs to only those within the designated CPU cost limit.

Implements CpMediaInterface.

OsStatus recordMic ( int  ms,
int16_t *  pAudioBuf,
int  bufferSize 
)
virtual

Record the microphone data.

Record audio from the microphone to a buffer passed in.

Note
The flowgraph must be in focus for this to work properly.
Parameters
[in]ms- The amount of time (in milliseconds) to record.
[in]pAudioBuf- Audio buffer to record to.
[in]bufferSize- Size of the buffer (in samples).

Implements CpMediaInterface.

OsStatus recordMic ( int  ms,
int  silenceLength,
const char *  fileName 
)
virtual

Record the microphone data to a file.

Record a fixed amount of audio from the microphone to a file.

Note
The flowgraph must be in focus for this to work properly.
Parameters
[in]ms- The amount of time, in milliseconds, to record.
[in]silenceLength- The amount of silence, in SECONDS, before recording is terminated.
[in]fileName- The path and name of a file to record to.

Implements CpMediaInterface.

void setContactType ( int  connectionId,
SIPX_CONTACT_TYPE  eType,
SIPX_CONTACT_ID  contactId 
)
virtual

Set the preferred contact type for this media connection.

Implements CpMediaInterface.

OsStatus setAudioCodecBandwidth ( int  connectionId,
int  bandWidth 
)
virtual

Rebuild the codec factory on the fly.

Implements CpMediaInterface.

OsStatus limitCodecs ( int  connectionId,
const SdpCodecList &  includeOnlyCodecList 
)
virtual

Further restrict the set of codecs to the list provided.

Implements CpMediaInterface.

OsStatus rebuildCodecFactory ( int  connectionId,
int  audioBandwidth,
int  videoBandwidth,
UtlString &  videoCodec 
)
virtual

Rebuild codec factory with one video codec.

No codecs will be added. This method only removes currently enabled codecs which are not included in the given list.

Returns
the number of codecs remaining enabled

Implements CpMediaInterface.

OsStatus setConnectionBitrate ( int  connectionId,
int  bitrate 
)
virtual

Set connection bitrate on the fly.

Implements CpMediaInterface.

OsStatus setConnectionFramerate ( int  connectionId,
int  framerate 
)
virtual

Set connection framerate on the fly.

Implements CpMediaInterface.

OsStatus setSecurityAttributes ( const void *  security)
virtual

Implements CpMediaInterface.

OsStatus addAudioRtpConnectionDestination ( int  connectionId,
int  iPriority,
const char *  candidateIp,
int  candidatePort 
)
virtual

Add an alternate Audio RTP connection destination for this media interface.

Alternerates are generally obtained from the SdpBody in the form of candidate addresses. When adding an alternate connection, the implementation should use an ICE-like method to determine the best destination address.

Parameters
[in]connectionId- Connection Id for the call leg obtained from createConnection
[in]iPriority- Relatively priority of the destination. Higher numbers have greater priority.
[in]candidateIp- Target/Candidate IP Address
[in]candidatePort- Target/Candidate Port
Return values
UNKNOWN- << TODO: Add useful return values here - i.e. failure codes to expect, etc. – kkyzivat 20070801 >>

Implements CpMediaInterface.

OsStatus addAudioRtcpConnectionDestination ( int  connectionId,
int  iPriority,
const char *  candidateIp,
int  candidatePort 
)
virtual

Add an alternate Audio RTCP connection destination for this media interface.

See also
CpMediaInterface::addAudioRtpConnectionDestination

Implements CpMediaInterface.

OsStatus addVideoRtpConnectionDestination ( int  connectionId,
int  iPriority,
const char *  candidateIp,
int  candidatePort 
)
virtual

Add an alternate Video RTP connection destination for this media interface.

See also
CpMediaInterface::addAudioRtpConnectionDestination

Implements CpMediaInterface.

OsStatus addVideoRtcpConnectionDestination ( int  connectionId,
int  iPriority,
const char *  candidateIp,
int  candidatePort 
)
virtual

Add an alternate Video RTCP connection destination for this media interface.

See also
CpMediaInterface::addAudioRtpConnectionDestination

Implements CpMediaInterface.

virtual void setConnectionTcpRole ( const int  connectionId,
const RtpTcpRoles  role 
)
inlinevirtual

Implements CpMediaInterface.

OsStatus generateVoiceQualityReport ( int  connectiond,
const char *  callId,
UtlString &  report 
)
virtual

Implements CpMediaInterface.

OsStatus enableDtx ( int  connectionId,
UtlBoolean  enable 
)

Enable/disable discontinuous transmission for given connection.

OsStatus setRtpInactivityTimeout ( int  connectionId,
int  timeoutMs 
)

Set inactive time (in ms) after which RTP stream is actually marked inactive.

OsStatus getCapabilities ( int  connectionId,
UtlString &  rtpHostAddress,
int &  rtpAudioPort,
int &  rtcpAudioPort,
int &  rtpVideoPort,
int &  rtcpVideoPort,
SdpCodecList &  supportedCodecs,
SdpSrtpParameters &  srtpParams,
int  bandWidth,
int &  videoBandwidth,
int &  videoFramerate 
)
virtual

soon to be deprecated in favor of getCapabilitiesEx

Implements CpMediaInterface.

OsStatus getCapabilitiesEx ( int  connectionId,
int  nMaxAddresses,
UtlString  rtpHostAddresses[],
int  rtpAudioPorts[],
int  rtcpAudioPorts[],
int  rtpVideoPorts[],
int  rtcpVideoPorts[],
RTP_TRANSPORT  transportTypes[],
int &  nActualAddresses,
SdpCodecList &  supportedCodecs,
SdpSrtpParameters &  srtpParameters,
int  bandWidth,
int &  videoBandwidth,
int &  videoFramerate 
)
virtual

replacement for getCapabilities

Implements CpMediaInterface.

int getCodecCPUCost ( )
virtual

Calculate the current cost for the current set of sending/receiving codecs.

Implements CpMediaInterface.

int getCodecCPULimit ( )
virtual

Calculate the worst case cost for the current set of sending/receiving codecs.

Implements CpMediaInterface.

uint32_t getSamplesPerSec ( )
virtual

Returns the sample rate of the flowgraph.

Implements CpMediaInterface.

uint32_t getSamplesPerFrame ( )
virtual

Returns the samples per frame of the flowgraph.

Implements CpMediaInterface.

OsMsgQ * getMsgQ ( )
virtual

Returns the flowgraph's message queue.

Implements CpMediaInterface.

OsMsgDispatcher * getNotificationDispatcher ( )
virtual

Returns the Media Notification dispatcher this controls.

Implements CpMediaInterface.

OsStatus setMixWeightForOutput ( int  bridgeOutputPort,
float  weight 
)
virtual

Set the mix weight for all inputs, but its own to the given weight and output on bridge.

Parameters
[in]bridgeOutputPort- output port on the bridge to which input gains are to be set
[in]weight- the new weights to set for the inputs. 1.0f is a net gain of zero. 2.0f is a 3Db gain. The input at port bridgeOutputPort, will get a weight of 0.0f.

Implements CpMediaInterface.

OsStatus setMixWeightsForOutput ( int  bridgeOutputPort,
int  numWeights,
float  weights[] 
)
virtual

Set gain for inputs to given output on bridge.

Parameters
[in]bridgeOutputPort- output port on the bridge to which input gains are to be set
[in]numWeights- number of input weights provided. If this number is less than the number of inputs on the bridge the inputs after numWeights are left unchanged.
[in]weights- the new weights to set for the inputs. One for each of the numWeights to set. 1.0f is a net gain of zero. 2.0f is a 3Db gain.

Implements CpMediaInterface.

OsStatus getVideoQuality ( int &  quality)
virtual
OsStatus getVideoBitRate ( int &  bitRate)
virtual
OsStatus getVideoFrameRate ( int &  frameRate)
virtual
OsStatus getPrimaryCodec ( int  connectionId,
UtlString &  audioCodec,
UtlString &  videoCodec,
int *  audiopPayloadType,
int *  videoPayloadType,
bool &  isEncrypted 
)
virtual

Returns the primary codec for the connection.

Implements CpMediaInterface.

OsStatus setVideoWindowDisplay ( const void *  hWnd)
virtual

Implements CpMediaInterface.

const void * getVideoWindowDisplay ( )
virtual

Implements CpMediaInterface.

virtual OsStatus getAudioEnergyLevels ( int &  iInputEnergyLevel,
int &  iOutputEnergyLevel 
)
inlinevirtual

Reimplemented from CpMediaInterface.

virtual OsStatus getAudioEnergyLevels ( int  connectionId,
int &  iInputEnergyLevel,
int &  iOutputEnergyLevel,
int &  nContributors,
unsigned int *  pContributorSRCIds,
int *  pContributorEngeryLevels 
)
inlinevirtual

Reimplemented from CpMediaInterface.

OsStatus getAudioRtpSourceIDs ( int  connectionId,
unsigned int &  uiSendingSSRC,
unsigned int &  uiReceivingSSRC 
)
virtual

Get receiving and sending SSRCs for given connection.

WARNING! uiReceivingSSRC is not filled right now. Someday it should be made an array and then we'll be able to fill it in.

Reimplemented from CpMediaInterface.

virtual OsStatus enableAudioTransport ( int  connectionId,
UtlBoolean  bEnable 
)
inlinevirtual

Reimplemented from CpMediaInterface.

virtual OsStatus enableVideoTransport ( int  connectionId,
UtlBoolean  bEnable 
)
inlinevirtual

Reimplemented from CpMediaInterface.

OsStatus setMediaProperty ( const UtlString &  propertyName,
const UtlString &  propertyValue 
)
virtual

Set a media property on the media interface.

Implements CpMediaInterface.

OsStatus getMediaProperty ( const UtlString &  propertyName,
UtlString &  propertyValue 
)
virtual

Get a media property on the media interface.

Implements CpMediaInterface.

OsStatus setMediaProperty ( int  connectionId,
const UtlString &  propertyName,
const UtlString &  propertyValue 
)
virtual

Set a media property associated with a connection.

Implements CpMediaInterface.

OsStatus getMediaProperty ( int  connectionId,
const UtlString &  propertyName,
UtlString &  propertyValue 
)
virtual

Get a media property associated with a connection.

Implements CpMediaInterface.

OsStatus getConnectionInputLatency ( int &  latency,
MpConnectionID  connectionId,
int  streamId = 0 
)
virtual

Get a latency of the input part of the RTP or local connection.

Parameters
[out]latency- returned latency value.
[in]connectionId- connection ID to get latency for. Use -1 for local mic.
[in]streamId- stream ID to get latency for. Use 0 for default.
Return values
OS_SUCCESSif latency has been successfully calculated.
OS_NOT_FOUNDif connection or stream is not found.
OsStatus getConnectionOutputLatency ( int &  latency,
MpConnectionID  connectionId = -1 
)
virtual

Get a latency of the output part of the RTP or local connection.

Parameters
[out]latency- returned latency value.
[in]connectionId- connection ID to get latency for. Use -1 for local speaker.
Return values
OS_SUCCESSif latency has been successfully calculated.
OS_NOT_FOUNDif connection or stream is not found.
virtual UtlString getType ( )
inlinevirtual

Set IP address to advertise in SDP.

Implements CpMediaInterface.

UtlBoolean isSendingRtpAudio ( int  connectionId)
virtual

Query whether the specified media connection is enabled for sending RTP.

Implements CpMediaInterface.

UtlBoolean isSendingRtpVideo ( int  connectionId)
virtual

Query whether the specified media connection is enabled for sending RTP.

Implements CpMediaInterface.

UtlBoolean isReceivingRtpAudio ( int  connectionId)
virtual

Query whether the specified media connection is enabled for sending RTP.

Implements CpMediaInterface.

UtlBoolean isReceivingRtpVideo ( int  connectionId)
virtual

Query whether the specified media connection is enabled for sending RTP.

Implements CpMediaInterface.

UtlBoolean isDestinationSet ( int  connectionId)
virtual

Query whether the specified media connection has a destination specified for sending RTP.

Implements CpMediaInterface.

UtlBoolean canAddParty ( )
virtual

Query whether a new party can be added to this media interfaces.

Implements CpMediaInterface.

UtlBoolean isVideoInitialized ( int  connectionId)
virtual

Query whether the connection has started sending or receiving video.

Implements CpMediaInterface.

UtlBoolean isAudioInitialized ( int  connectionId)
virtual

Query whether the connection has started sending or receiving audio.

Implements CpMediaInterface.

UtlBoolean isAudioAvailable ( )
virtual

Query if the audio device is available.

Implements CpMediaInterface.

virtual UtlBoolean isVideoConferencing ( )
inlinevirtual

Query if we are mixing a video conference.

Implements CpMediaInterface.

UtlBoolean getLocalAddresses ( int  connectionId,
UtlString &  hostIp,
int &  rtpAudioPort,
int &  rtcpAudioPort,
int &  rtpVideoPort,
int &  rtcpVideoPort 
)
protected
UtlBoolean getNatedAddresses ( int  connectionId,
UtlString &  hostIp,
int &  rtpAudioPort,
int &  rtcpAudioPort,
int &  rtpVideoPort,
int &  rtcpVideoPort 
)
protected
UtlBoolean getRelayAddresses ( int  connectionId,
UtlString &  hostIp,
int &  rtpAudioPort,
int &  rtcpAudioPort,
int &  rtpVideoPort,
int &  rtcpVideoPort 
)
protected
OsStatus addLocalContacts ( int  connectionId,
int  nMaxAddresses,
UtlString  rtpHostAddresses[],
int  rtpAudioPorts[],
int  rtcpAudioPorts[],
int  rtpVideoPorts[],
int  rtcpVideoPorts[],
int &  nActualAddresses 
)
protected
OsStatus addNatedContacts ( int  connectionId,
int  nMaxAddresses,
UtlString  rtpHostAddresses[],
int  rtpAudioPorts[],
int  rtcpAudioPorts[],
int  rtpVideoPorts[],
int  rtcpVideoPorts[],
int &  nActualAddresses 
)
protected
OsStatus addRelayContacts ( int  connectionId,
int  nMaxAddresses,
UtlString  rtpHostAddresses[],
int  rtpAudioPorts[],
int  rtcpAudioPorts[],
int  rtpVideoPorts[],
int  rtcpVideoPorts[],
int &  nActualAddresses 
)
protected
void applyAlternateDestinations ( int  connectionId)
protected
OsStatus createRtpSocketPair ( UtlString  localAddress,
int  localPort,
UtlBoolean  isMulticast,
SIPX_CONTACT_TYPE  contactType,
OsSocket *&  rtpSocket,
OsSocket *&  rtcpSocket 
)
protected

Create socket pair for RTP/RTCP streams.

For RTP/RTCP port pair will be set next free port pair.

Parameters
[in]localAddress- Address to bind to (for multihomed hosts).
[in]localPort- Local port to bind to (0 for auto select).
[in]isMulticast- Is requested stream multicast or not?
[in]contactType- Contact type (see SIPX_CONTACT_TYPE).
[out]rtpSocket- Created socket for RTP stream.
[out]rtcpSocket- Created socket for RTCP stream.
int getNextConnectionId ( )
private

Get the next unique connection Id scoped to this flowgraph.

CpTopologyMediaConnection * createMediaConnection ( int &  connectionId,
UtlBoolean  isMcast 
)
private

Create media connection structure to store connection params.

OsStatus deleteMediaConnection ( CpTopologyMediaConnection mediaConnection)
private

Free media connection structure.

CpTopologyMediaConnection * getMediaConnection ( int  connectionId)
private

Get media connection structure by its connectionID.

OsStatus discardLoopbackRtp ( CpTopologyMediaConnection mediaConnection)
private

Enable discarding of our RTP stream, looped back to us.

This is the case, when you have to turn off similar OS functionality. E.g. this is the case, when you're running two or more connections on the same computer with the same multicast address and want to receive each others packets.

void stopRtpReceive ( CpTopologyMediaConnection mediaConnection)
private

Stop receiving RTP on selected media connection.

void stopRtpSend ( CpTopologyMediaConnection mediaConnection)
private

Stop receiving RTP on selected media connection.

OsStatus setConnectionWeightOnBridge ( CpTopologyMediaConnection mediaConnection,
int  destPort,
float  weight 
)
private

Set mixing weight from all connection's streams to the given output port.

OsStatus setConnectionToConnectionWeight ( CpTopologyMediaConnection srcConnection,
int  destConnectionId,
float  weight 
)
private

Set mixing weight from all connection's streams to the given output port.

OsStatus setMicGain ( float  gain)
privatevirtual

Set the Mic gain.

Implements CpMediaInterface.

OsStatus setMicWeightOnBridge ( float  weight)
private

Set mixing weight from the Mic to all other Bridge ports.

CpTopologyGraphInterface& operator= ( const CpTopologyGraphInterface )
private

Disabled assignment operator.

Member Data Documentation

int mLastConnectionId
private
MpResourceFactory* mpResourceFactory
private
MpTopologyGraph* mpTopologyGraph
private
SdpCodecList mSupportedCodecs
private
UtlDList mMediaConnections
private
int mExpeditedIpTos
private
int mInitialTopologyBridgePorts
private
MpInputDeviceManager* mpInputDeviceManager
private
MpInputDeviceHandle mInputDeviceHandle
private
MpOutputDeviceManager* mpOutputDeviceManager
private
MpOutputDeviceHandle mOutputDeviceHandle
private
UtlString mStunServer
private
int mStunPort
private
int mStunRefreshPeriodSecs
private
UtlString mTurnServer
private
int mTurnPort
private
int mTurnRefreshPeriodSecs
private
UtlString mTurnUsername
private
UtlString mTurnPassword
private
UtlBoolean mEnableIce
private
UtlString mRtpReceiveHostAddress
private
UtlString mLocalAddress
private
UtlHashMap mInterfaceProperties
private
MaNotfTranslatorDispatcher mTranslatorDispatcher
private

Dispatcher for translating mediaLib notification messages into abstract MediaAdapter ones. Only used if a dispatcher is set on this interface.