sipxmediaadapterlib  Version 3.3
CpTopologyGraphFactoryImpl.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007-2021 SIPez LLC. All rights reserved.
3 //
4 //
5 // $$
7 
8 // Author: Dan Petrie (dpetrie AT SIPez DOT com)
9 
10 #ifndef _CpTopologyGraphFactoryImpl_h_
11 #define _CpTopologyGraphFactoryImpl_h_
12 
13 // SYSTEM INCLUDES
14 // APPLICATION INCLUDES
15 #include <sipXmediaFactoryImpl.h>
17 
18 // DEFINES
19 // MACROS
20 // EXTERNAL FUNCTIONS
21 // EXTERNAL VARIABLES
22 // CONSTANTS
23 // STRUCTS
24 // TYPEDEFS
25 // FORWARD DECLARATIONS
26 class MpResourceTopology;
27 class MpResourceFactory;
28 class MpInputDeviceManager;
29 class MpOutputDeviceManager;
30 class MpMMTimer;
31 
46 {
47 /* //////////////////////////// PUBLIC //////////////////////////////////// */
48 public:
49 
50 /* ============================ CREATORS ================================== */
52 
53 
55  CpTopologyGraphFactoryImpl(OsConfigDb* pConfigDb,
56  uint32_t frameSizeMs,
57  uint32_t maxSamplesPerSec,
58  uint32_t defaultDeviceSamplesPerSec,
59  UtlBoolean enableLocalAudio,
60  const UtlString &inputDeviceName,
61  const UtlString &outputDeviceName);
62 
64  virtual
66 
68 
69 /* ============================ MANIPULATORS ============================== */
71 
72 
75  virtual
76  CpMediaInterface* createMediaInterface(const char* publicAddress,
77  const char* localAddress,
78  int numCodecs,
79  SdpCodec* sdpCodecArray[],
80  const char* locale,
81  int expeditedIpTos,
82  const char* stunServer,
83  int stunOptions,
84  int stunKeepAliveSecs,
85  const char* turnServer,
86  int turnPort,
87  const char* turnUserName,
88  const char* turnPassword,
89  int turnKeepAlivePeriodSecs,
90  UtlBoolean enableIce,
91  uint32_t samplesPerSec,
92  OsMsgDispatcher* pDispatcher);
93 
95  virtual OsStatus setSpeakerDevice(const UtlString& device);
97  virtual OsStatus setMicrophoneDevice(const UtlString& device);
99  virtual OsStatus setAudioAECMode(const MEDIA_AEC_MODE mode);
101  virtual OsStatus getAudioAECMode(MEDIA_AEC_MODE& mode) const;
103  virtual OsStatus enableAGC(UtlBoolean bEnable);
105  virtual OsStatus setAudioNoiseReductionMode(const MEDIA_NOISE_REDUCTION_MODE mode);
106 
108 
109 /* ============================ ACCESSORS ================================= */
111 
112 
114  virtual OsStatus getSpeakerDevice(UtlString& device) const;
116  virtual OsStatus getMicrophoneDevice(UtlString& device) const;
117 
119  static int getInputDeviceList(UtlContainer& deviceNames);
120 
122  static int getOutputDeviceList(UtlContainer& deviceNames);
123 
125  // virtual (unless we make this virtual on CpMediaInterfaceFactoryImpl this does more harm than good)
126  void setInitialResourceTopology(MpResourceTopology& resourceTopology);
132  // virtual (unless we make this virtual on CpMediaInterfaceFactoryImpl this does more harm than good)
135  MpResourceTopology* getInitialResourceTopology() const;
136 
138  // virtual (unless we make this virtual on CpMediaInterfaceFactoryImpl this does more harm than good)
139  void setResourceFactory(MpResourceFactory& resourceFactory);
140 
142  // virtual (unless we make this virtual on CpMediaInterfaceFactoryImpl this does more harm than good)
143  MpResourceFactory* getResourceFactory() const;
144 
147  // virtual (unless we make this virtual on CpMediaInterfaceFactoryImpl this does more harm than good)
148  void setConnectionResourceTopology(MpResourceTopology& connectionTopology);
149 
152  // virtual (unless we make this virtual on CpMediaInterfaceFactoryImpl this does more harm than good)
153  MpResourceTopology* getConnectionResourceTopology() const;
154 
156  void setDispatcher(OsMsgDispatcher* dispatcher);
157 
160  // virtual (unless we make this virtual on CpMediaInterfaceFactoryImpl this does more harm than good)
161  void setMcastConnectionResourceTopology(MpResourceTopology& connectionTopology);
162 
165  // virtual (unless we make this virtual on CpMediaInterfaceFactoryImpl this does more harm than good)
166  MpResourceTopology* getMcastConnectionResourceTopology() const;
167 
169  inline
170  int getNumMcastRtpStreams() const;
171 
172  MpInputDeviceManager* getInputDeviceManager() const;
173 
175  MpResourceFactory* buildDefaultResourceFactory();
176 
178  static
179  MpResourceTopology* buildDefaultInitialResourceTopology();
180 
182  MpResourceTopology* buildUnicastConnectionResourceTopology();
183 
185  MpResourceTopology* buildMulticastConnectionResourceTopology();
186 
188  static int getMaxInputConnections();
189 
190  virtual OsStatus getVideoCpuValue(int& cpuValue) const;
192 
193 /* ============================ INQUIRY =================================== */
195 
196 
198 
199 /* //////////////////////////// PROTECTED ///////////////////////////////// */
200 protected:
201 
202  MpResourceTopology *mpInitialResourceTopology;
203  MpResourceFactory *mpResourceFactory;
204  MpResourceTopology *mpConnectionResourceTopology;
207  MpInputDeviceManager *mpInputDeviceManager;
208  MpOutputDeviceManager *mpOutputDeviceManager;
209  MpMMTimer *mpMediaTaskTicker;
210  MpOutputDeviceHandle mDefaultToOutputDevice;
211  MpInputDeviceHandle mDefaultToInputDevice;
214 
216  static void addOutputConnectionTopology(MpResourceTopology* resourceTopology,
217  int logicalPortNum);
218 
220  static void addLocalConnectionTopology(MpResourceTopology* resourceTopology);
221 
222 /* //////////////////////////// PRIVATE /////////////////////////////////// */
223 private:
224 
229 };
230 
231 /* ============================ INLINE METHODS ============================ */
232 
234 {
235  return mNumMcastStreams;
236 }
237 
238 #endif // _CpTopologyGraphFactoryImpl_h_
MpResourceFactory * buildDefaultResourceFactory()
Build a resource factory with the default set of resource constructors.
Definition: CpTopologyGraphFactoryImpl.cpp:759
Definition: sipXmediaFactoryImpl.h:40
Dispatcher to translate MediaLib notifications into abstracted MediaAdapterLib notifications.
Definition: MaNotfTranslatorDispatcher.h:40
virtual OsStatus getVideoCpuValue(int &cpuValue) const
Definition: CpTopologyGraphFactoryImpl.cpp:1421
Subsystem manager and creator of CpTopologyGraphInterfaces specialization of CpMediaInterface.
Definition: CpTopologyGraphFactoryImpl.h:45
MpOutputDeviceHandle mDefaultToOutputDevice
Definition: CpTopologyGraphFactoryImpl.h:210
static int getMaxInputConnections()
Get number of input connections this topology can support.
Definition: CpTopologyGraphFactoryImpl.cpp:1233
int getNumMcastRtpStreams() const
Return number of RTP streams multicast connection supports.
Definition: CpTopologyGraphFactoryImpl.h:233
MpResourceFactory * mpResourceFactory
Definition: CpTopologyGraphFactoryImpl.h:203
MEDIA_NOISE_REDUCTION_MODE
Definition: CpMediaInterfaceFactoryImpl.h:45
void setDispatcher(OsMsgDispatcher *dispatcher)
Set the dispatcher for flowgraph independent media events/messages.
Definition: CpTopologyGraphFactoryImpl.cpp:1389
virtual ~CpTopologyGraphFactoryImpl()
Destructor.
Definition: CpTopologyGraphFactoryImpl.cpp:362
static int getInputDeviceList(UtlContainer &deviceNames)
Get the list of available input devices.
Definition: CpTopologyGraphFactoryImpl.cpp:1259
MpResourceTopology * buildMulticastConnectionResourceTopology()
Build an incremental resource topology for multicast RTP connections.
Definition: CpTopologyGraphFactoryImpl.cpp:1138
void setInitialResourceTopology(MpResourceTopology &resourceTopology)
Set the resource topology to be used when creating new flowgraph.
Definition: CpTopologyGraphFactoryImpl.cpp:1359
virtual OsStatus enableAGC(UtlBoolean bEnable)
Enable AGC Status.
Definition: CpTopologyGraphFactoryImpl.cpp:727
MEDIA_AEC_MODE
Definition: CpMediaInterfaceFactoryImpl.h:37
virtual OsStatus setAudioNoiseReductionMode(const MEDIA_NOISE_REDUCTION_MODE mode)
Enable/Disable Noise Reduction.
Definition: CpTopologyGraphFactoryImpl.cpp:738
virtual OsStatus setAudioAECMode(const MEDIA_AEC_MODE mode)
Enable/Disable echo cancellation.
Definition: CpTopologyGraphFactoryImpl.cpp:670
virtual 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)
Factory method to construct new flowgraph and media interface using CpTopologyFlowgraph.
Definition: CpTopologyGraphFactoryImpl.cpp:432
virtual OsStatus getSpeakerDevice(UtlString &device) const
Get the speaker device.
Definition: CpTopologyGraphFactoryImpl.cpp:1245
virtual OsStatus getMicrophoneDevice(UtlString &device) const
Get the microphone device.
Definition: CpTopologyGraphFactoryImpl.cpp:1252
Abstract media control interface.
Definition: CpMediaInterface.h:96
virtual OsStatus setSpeakerDevice(const UtlString &device)
Set the speaker device.
Definition: CpTopologyGraphFactoryImpl.cpp:502
MpMMTimer * mpMediaTaskTicker
Definition: CpTopologyGraphFactoryImpl.h:209
void setConnectionResourceTopology(MpResourceTopology &connectionTopology)
Set the resource topology to be added to the flow graph when adding an unicast RTP connection...
Definition: CpTopologyGraphFactoryImpl.cpp:1379
MpOutputDeviceManager * mpOutputDeviceManager
Definition: CpTopologyGraphFactoryImpl.h:208
void setMcastConnectionResourceTopology(MpResourceTopology &connectionTopology)
Set the resource topology to be added to the flow graph when adding an multicast RTP connection...
Definition: CpTopologyGraphFactoryImpl.cpp:1406
MpInputDeviceManager * mpInputDeviceManager
Definition: CpTopologyGraphFactoryImpl.h:207
MpResourceFactory * getResourceFactory() const
Get the factory for constructing new resources.
Definition: CpTopologyGraphFactoryImpl.cpp:1374
void setResourceFactory(MpResourceFactory &resourceFactory)
Set the factory used to create resources for the new flowgraph contained .
Definition: CpTopologyGraphFactoryImpl.cpp:1369
int mNumMcastStreams
Definition: CpTopologyGraphFactoryImpl.h:212
virtual OsStatus getAudioAECMode(MEDIA_AEC_MODE &mode) const
Return status of echo cancellation.
Definition: CpTopologyGraphFactoryImpl.cpp:696
static void addLocalConnectionTopology(MpResourceTopology *resourceTopology)
Add local input and local output connections to topology.
Definition: CpTopologyGraphFactoryImpl.cpp:1468
CpTopologyGraphFactoryImpl(OsConfigDb *pConfigDb, uint32_t frameSizeMs, uint32_t maxSamplesPerSec, uint32_t defaultDeviceSamplesPerSec, UtlBoolean enableLocalAudio, const UtlString &inputDeviceName, const UtlString &outputDeviceName)
Default constructor.
Definition: CpTopologyGraphFactoryImpl.cpp:192
UtlBoolean mIsLocalAudioEnabled
Definition: CpTopologyGraphFactoryImpl.h:206
static void addOutputConnectionTopology(MpResourceTopology *resourceTopology, int logicalPortNum)
Add RTP output connection to topology.
Definition: CpTopologyGraphFactoryImpl.cpp:1431
MpResourceTopology * mpInitialResourceTopology
Definition: CpTopologyGraphFactoryImpl.h:202
MpInputDeviceHandle mDefaultToInputDevice
Definition: CpTopologyGraphFactoryImpl.h:211
MpResourceTopology * getConnectionResourceTopology() const
Get the resource topology defining what resources get added when adding an unicast RTP connection...
Definition: CpTopologyGraphFactoryImpl.cpp:1384
MaNotfTranslatorDispatcher mTranslatorDispatcher
Definition: CpTopologyGraphFactoryImpl.h:213
MpResourceTopology * getInitialResourceTopology() const
Get the resource topology defining the resources connections for a new flowgraph. ...
Definition: CpTopologyGraphFactoryImpl.cpp:1364
MpInputDeviceManager * getInputDeviceManager() const
Definition: CpTopologyGraphFactoryImpl.cpp:1416
MpResourceTopology * mpConnectionResourceTopology
Definition: CpTopologyGraphFactoryImpl.h:204
static int getOutputDeviceList(UtlContainer &deviceNames)
Get the list of available output devices.
Definition: CpTopologyGraphFactoryImpl.cpp:1309
MpResourceTopology * getMcastConnectionResourceTopology() const
Get the resource topology defining what resources get added when adding an multicast RTP connection...
Definition: CpTopologyGraphFactoryImpl.cpp:1411
static MpResourceTopology * buildDefaultInitialResourceTopology()
Build a default initial resource topology.
Definition: CpTopologyGraphFactoryImpl.cpp:1002
MpResourceTopology * buildUnicastConnectionResourceTopology()
Build an incremental resource topology for unicast RTP connections.
Definition: CpTopologyGraphFactoryImpl.cpp:1058
virtual OsStatus setMicrophoneDevice(const UtlString &device)
Set the Microphone device.
Definition: CpTopologyGraphFactoryImpl.cpp:608
MpResourceTopology * mpMcastConnectionResourceTopology
Definition: CpTopologyGraphFactoryImpl.h:205
CpTopologyGraphFactoryImpl & operator=(const CpTopologyGraphFactoryImpl *refFactoryImpl)
Disabled.