mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 19:18:06 +00:00
Use unique_ptr for StunClient and IceAgent objects.
This commit is contained in:
parent
5ec972c98d
commit
01394ff75c
2 changed files with 5 additions and 8 deletions
|
|
@ -74,7 +74,7 @@ public:
|
|||
void setParams (MediaSessionParams *msp);
|
||||
void setRemoteParams (MediaSessionParams *msp);
|
||||
|
||||
IceSession *getIceSession () const { return iceAgent->getIceSession(); }
|
||||
IceSession *getIceSession () const { return iceAgent ? iceAgent->getIceSession() : nullptr; }
|
||||
|
||||
SalMediaDescription *getLocalDesc () const { return localDesc; }
|
||||
|
||||
|
|
@ -284,8 +284,8 @@ private:
|
|||
int mainTextStreamIndex = LINPHONE_CALL_STATS_TEXT;
|
||||
|
||||
LinphoneNatPolicy *natPolicy = nullptr;
|
||||
StunClient *stunClient = nullptr;
|
||||
IceAgent *iceAgent = nullptr;
|
||||
std::unique_ptr<StunClient> stunClient;
|
||||
std::unique_ptr<IceAgent> iceAgent;
|
||||
|
||||
// The address family to prefer for RTP path, guessed from signaling path.
|
||||
int af;
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,7 @@ string MediaSessionPrivate::getPublicIpForStream (int streamIndex) {
|
|||
void MediaSessionPrivate::runStunTestsIfNeeded () {
|
||||
L_Q();
|
||||
if (linphone_nat_policy_stun_enabled(natPolicy) && !(linphone_nat_policy_ice_enabled(natPolicy) || linphone_nat_policy_turn_enabled(natPolicy))) {
|
||||
stunClient = new StunClient(q->getCore());
|
||||
stunClient = makeUnique<StunClient>(q->getCore());
|
||||
int ret = stunClient->run(mediaPorts[mainAudioStreamIndex].rtpPort, mediaPorts[mainVideoStreamIndex].rtpPort, mediaPorts[mainTextStreamIndex].rtpPort);
|
||||
if (ret >= 0)
|
||||
pingTime = ret;
|
||||
|
|
@ -3939,7 +3939,7 @@ MediaSession::MediaSession (const shared_ptr<Core> &core, shared_ptr<Participant
|
|||
d->setPortConfig(d->mainTextStreamIndex, make_pair(minPort, maxPort));
|
||||
|
||||
memset(d->sessions, 0, sizeof(d->sessions));
|
||||
d->iceAgent = new IceAgent(*this);
|
||||
d->iceAgent = makeUnique<IceAgent>(*this);
|
||||
|
||||
lInfo() << "New MediaSession [" << this << "] initialized (LinphoneCore version: " << linphone_core_get_version() << ")";
|
||||
}
|
||||
|
|
@ -3957,9 +3957,6 @@ MediaSession::~MediaSession () {
|
|||
linphone_call_stats_unref(d->textStats);
|
||||
if (d->natPolicy)
|
||||
linphone_nat_policy_unref(d->natPolicy);
|
||||
if (d->stunClient)
|
||||
delete d->stunClient;
|
||||
delete d->iceAgent;
|
||||
if (d->localDesc)
|
||||
sal_media_description_unref(d->localDesc);
|
||||
if (d->biggestDesc)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue