Commit 8b695901 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Use CoreAccessor in call related classes.

parent 6ef2937a
......@@ -6883,7 +6883,7 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) {
}
void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) {
L_GET_CPP_PTR_FROM_C_OBJECT(params)->initDefault(lc);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->initDefault(lc->cppCore);
}
void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) {
......
......@@ -176,7 +176,7 @@ int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, sock
/* this functions runs a simple stun test and return the number of milliseconds to complete the tests, or -1 if the test were failed.*/
int linphone_run_stun_tests(LinphoneCore *lc, int audioPort, int videoPort, int textPort,
char *audioCandidateAddr, int *audioCandidatePort, char *videoCandidateAddr, int *videoCandidatePort, char *textCandidateAddr, int *textCandidatePort) {
LinphonePrivate::StunClient *client = new LinphonePrivate::StunClient(lc);
LinphonePrivate::StunClient *client = new LinphonePrivate::StunClient(lc->cppCore);
int ret = client->run(audioPort, videoPort, textPort);
strncpy(audioCandidateAddr, client->getAudioCandidate().address.c_str(), LINPHONE_IPADDR_SIZE);
*audioCandidatePort = client->getAudioCandidate().port;
......
......@@ -502,7 +502,7 @@ LinphoneCallParams *linphone_call_params_new (LinphoneCore *core) {
LinphoneCallParams *params = _linphone_CallParams_init();
auto mediaSessionParams = new LinphonePrivate::MediaSessionParams();
L_SET_CPP_PTR_FROM_C_OBJECT(params, mediaSessionParams);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->initDefault(core);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->initDefault(core->cppCore);
delete mediaSessionParams;
return params;
}
......
......@@ -86,7 +86,7 @@ CallSessionParams &CallSessionParams::operator= (const CallSessionParams &src) {
// -----------------------------------------------------------------------------
void CallSessionParams::initDefault (LinphoneCore *core) {
void CallSessionParams::initDefault (const std::shared_ptr<Core> &core) {
L_D();
d->inConference = false;
d->privacy = LinphonePrivacyDefault;
......
......@@ -20,6 +20,8 @@
#ifndef _CALL_SESSION_PARAMS_H_
#define _CALL_SESSION_PARAMS_H_
#include <memory>
#include "object/clonable-object.h"
#include "linphone/types.h"
......@@ -31,6 +33,7 @@
LINPHONE_BEGIN_NAMESPACE
class CallSessionParamsPrivate;
class Core;
class CallSessionParams : public ClonableObject {
friend class CallSession;
......@@ -44,7 +47,7 @@ public:
CallSessionParams &operator= (const CallSessionParams &src);
virtual void initDefault (LinphoneCore *core);
virtual void initDefault (const std::shared_ptr<Core> &core);
const std::string& getSessionName () const;
void setSessionName (const std::string &sessionName);
......
......@@ -22,6 +22,7 @@
#include "media-session-params.h"
#include "core/core.h"
#include "logger/logger.h"
#include "private.h"
......@@ -223,27 +224,28 @@ MediaSessionParams &MediaSessionParams::operator= (const MediaSessionParams &src
// -----------------------------------------------------------------------------
void MediaSessionParams::initDefault (LinphoneCore *core) {
void MediaSessionParams::initDefault (const std::shared_ptr<Core> &core) {
L_D();
CallSessionParams::initDefault(core);
LinphoneCore *cCore = core->getCCore();
d->audioEnabled = true;
d->videoEnabled = linphone_core_video_enabled(core) && core->video_policy.automatically_initiate;
if (!linphone_core_video_enabled(core) && core->video_policy.automatically_initiate) {
d->videoEnabled = linphone_core_video_enabled(cCore) && cCore->video_policy.automatically_initiate;
if (!linphone_core_video_enabled(cCore) && cCore->video_policy.automatically_initiate) {
lError() << "LinphoneCore has video disabled for both capture and display, but video policy is to start the call with video. "
"This is a possible mis-use of the API. In this case, video is disabled in default LinphoneCallParams";
}
d->realtimeTextEnabled = !!linphone_core_realtime_text_enabled(core);
d->encryption = linphone_core_get_media_encryption(core);
d->avpfEnabled = (linphone_core_get_avpf_mode(core) == LinphoneAVPFEnabled);
d->_implicitRtcpFbEnabled = !!lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_fb_implicit_rtcp_fb", true);
d->avpfRrInterval = static_cast<uint16_t>(linphone_core_get_avpf_rr_interval(core));
d->realtimeTextEnabled = !!linphone_core_realtime_text_enabled(cCore);
d->encryption = linphone_core_get_media_encryption(cCore);
d->avpfEnabled = (linphone_core_get_avpf_mode(cCore) == LinphoneAVPFEnabled);
d->_implicitRtcpFbEnabled = !!lp_config_get_int(linphone_core_get_config(cCore), "rtp", "rtcp_fb_implicit_rtcp_fb", true);
d->avpfRrInterval = static_cast<uint16_t>(linphone_core_get_avpf_rr_interval(cCore));
d->audioDirection = LinphoneMediaDirectionSendRecv;
d->videoDirection = LinphoneMediaDirectionSendRecv;
d->earlyMediaSendingEnabled = !!lp_config_get_int(linphone_core_get_config(core), "misc", "real_early_media", false);
d->audioMulticastEnabled = !!linphone_core_audio_multicast_enabled(core);
d->videoMulticastEnabled = !!linphone_core_video_multicast_enabled(core);
d->updateCallWhenIceCompleted = !!lp_config_get_int(linphone_core_get_config(core), "sip", "update_call_when_ice_completed", true);
d->mandatoryMediaEncryptionEnabled = !!linphone_core_is_media_encryption_mandatory(core);
d->earlyMediaSendingEnabled = !!lp_config_get_int(linphone_core_get_config(cCore), "misc", "real_early_media", false);
d->audioMulticastEnabled = !!linphone_core_audio_multicast_enabled(cCore);
d->videoMulticastEnabled = !!linphone_core_video_multicast_enabled(cCore);
d->updateCallWhenIceCompleted = !!lp_config_get_int(linphone_core_get_config(cCore), "sip", "update_call_when_ice_completed", true);
d->mandatoryMediaEncryptionEnabled = !!linphone_core_is_media_encryption_mandatory(cCore);
}
// -----------------------------------------------------------------------------
......
......@@ -43,7 +43,7 @@ public:
MediaSessionParams &operator= (const MediaSessionParams &src);
void initDefault (LinphoneCore *core) override;
void initDefault (const std::shared_ptr<Core> &core) override;
bool audioEnabled () const;
bool audioMulticastEnabled () const;
......
......@@ -35,10 +35,11 @@ LINPHONE_BEGIN_NAMESPACE
shared_ptr<CallSession> ParticipantPrivate::createSession (
const Conference &conference, const CallSessionParams *params, bool hasMedia, CallSessionListener *listener
) {
L_Q();
if (hasMedia && (!params || dynamic_cast<const MediaSessionParams *>(params))) {
session = make_shared<MediaSession>(conference, params, listener);
session = make_shared<MediaSession>(conference.getCore(), q->getSharedFromThis(), params, listener);
} else {
session = make_shared<CallSession>(conference, params, listener);
session = make_shared<CallSession>(conference.getCore(), params, listener);
}
return session;
}
......
......@@ -50,6 +50,8 @@ class Participant : public Object {
friend class ServerGroupChatRoomPrivate;
public:
L_OVERRIDE_SHARED_FROM_THIS(Participant);
explicit Participant (const IdentityAddress &address);
explicit Participant (IdentityAddress &&address);
......
......@@ -31,8 +31,7 @@ LINPHONE_BEGIN_NAMESPACE
class CallSessionPrivate : public ObjectPrivate {
public:
CallSessionPrivate (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener);
virtual ~CallSessionPrivate ();
CallSessionPrivate () = default;
int computeDuration () const;
virtual void initializeParamsAccordingToIncomingCallParams ();
......@@ -41,7 +40,6 @@ public:
bool startPing ();
void setPingTime (int value) { pingTime = value; }
LinphoneCore *getCore () const { return core; }
CallSessionParams *getCurrentParams () const { return currentParams; }
LinphoneProxyConfig * getDestProxy () const { return destProxy; }
SalCallOp * getOp () const { return op; }
......@@ -61,6 +59,8 @@ public:
virtual void updating (bool isUpdate);
protected:
void init ();
void accept (const CallSessionParams *params);
virtual LinphoneStatus acceptUpdate (const CallSessionParams *csp, LinphoneCallState nextState, const std::string &stateInfo);
LinphoneStatus checkForAcceptation () const;
......@@ -85,8 +85,6 @@ private:
LinphoneAddress * getFixedContact () const;
protected:
const Conference &conference;
LinphoneCore *core = nullptr;
CallSessionListener *listener = nullptr;
CallSessionParams *params = nullptr;
......
......@@ -40,32 +40,6 @@ LINPHONE_BEGIN_NAMESPACE
// =============================================================================
CallSessionPrivate::CallSessionPrivate (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener)
: conference(conference), listener(listener) {
if (params)
setParams(new CallSessionParams(*params));
currentParams = new CallSessionParams();
core = conference.getCore()->getCCore();
ei = linphone_error_info_new();
}
CallSessionPrivate::~CallSessionPrivate () {
if (currentParams)
delete currentParams;
if (params)
delete params;
if (remoteParams)
delete remoteParams;
if (ei)
linphone_error_info_unref(ei);
if (log)
linphone_call_log_unref(log);
if (op)
op->release();
}
// -----------------------------------------------------------------------------
int CallSessionPrivate::computeDuration () const {
if (log->connected_date_time == 0)
return 0;
......@@ -108,9 +82,9 @@ void CallSessionPrivate::setState(LinphoneCallState newState, const string &mess
switch (newState) {
case LinphoneCallOutgoingInit:
case LinphoneCallIncomingReceived:
getPlatformHelpers(core)->acquireWifiLock();
getPlatformHelpers(core)->acquireMcastLock();
getPlatformHelpers(core)->acquireCpuLock();
getPlatformHelpers(q->getCore()->getCCore())->acquireWifiLock();
getPlatformHelpers(q->getCore()->getCCore())->acquireMcastLock();
getPlatformHelpers(q->getCore()->getCCore())->acquireCpuLock();
break;
case LinphoneCallEnd:
case LinphoneCallError:
......@@ -150,9 +124,9 @@ void CallSessionPrivate::setState(LinphoneCallState newState, const string &mess
log->connected_date_time = ms_time(nullptr);
break;
case LinphoneCallReleased:
getPlatformHelpers(core)->acquireWifiLock();
getPlatformHelpers(core)->acquireMcastLock();
getPlatformHelpers(core)->acquireCpuLock();
getPlatformHelpers(q->getCore()->getCCore())->acquireWifiLock();
getPlatformHelpers(q->getCore()->getCCore())->acquireMcastLock();
getPlatformHelpers(q->getCore()->getCCore())->acquireCpuLock();
break;
default:
break;
......@@ -199,16 +173,17 @@ void CallSessionPrivate::startIncomingNotification () {
}
bool CallSessionPrivate::startPing () {
if (core->sip_conf.ping_with_options) {
L_Q();
if (q->getCore()->getCCore()->sip_conf.ping_with_options) {
/* Defer the start of the call after the OPTIONS ping for outgoing call or
* send an option request back to the caller so that we get a chance to discover our nat'd address
* before answering for incoming call */
pingReplied = false;
pingOp = new SalOp(core->sal);
pingOp = new SalOp(q->getCore()->getCCore()->sal);
if (direction == LinphoneCallIncoming) {
const char *from = pingOp->get_from();
const char *to = pingOp->get_to();
linphone_configure_op(core, pingOp, log->from, nullptr, false);
linphone_configure_op(q->getCore()->getCCore(), pingOp, log->from, nullptr, false);
pingOp->set_route(op->get_network_origin());
pingOp->ping(from, to);
} else if (direction == LinphoneCallOutgoing) {
......@@ -332,7 +307,7 @@ bool CallSessionPrivate::failure () {
void CallSessionPrivate::infoReceived (SalBodyHandler *bodyHandler) {
L_Q();
LinphoneInfoMessage *info = linphone_core_create_info_message(core);
LinphoneInfoMessage *info = linphone_core_create_info_message(q->getCore()->getCCore());
linphone_info_message_set_headers(info, op->get_recv_custom_header());
if (bodyHandler) {
LinphoneContent *content = linphone_content_from_sal_body_handler(bodyHandler);
......@@ -391,7 +366,8 @@ void CallSessionPrivate::terminated () {
}
void CallSessionPrivate::updated (bool isUpdate) {
deferUpdate = !!lp_config_get_int(linphone_core_get_config(core), "sip", "defer_update_default", FALSE);
L_Q();
deferUpdate = !!lp_config_get_int(linphone_core_get_config(q->getCore()->getCCore()), "sip", "defer_update_default", FALSE);
SalErrorInfo sei;
memset(&sei, 0, sizeof(sei));
switch (state) {
......@@ -459,6 +435,13 @@ void CallSessionPrivate::updating (bool isUpdate) {
// -----------------------------------------------------------------------------
void CallSessionPrivate::init () {
currentParams = new CallSessionParams();
ei = linphone_error_info_new();
}
// -----------------------------------------------------------------------------
void CallSessionPrivate::accept (const CallSessionParams *csp) {
L_Q();
/* Try to be best-effort in giving real local or routable contact address */
......@@ -508,7 +491,7 @@ void CallSessionPrivate::handleIncomingReceivedStateInIncomingNotification () {
/* Try to be best-effort in giving real local or routable contact address for 100Rel case */
setContactOp();
op->notify_ringing(false);
if (op->get_replaces() && lp_config_get_int(linphone_core_get_config(core), "sip", "auto_answer_replacing_calls", 1))
if (op->get_replaces() && lp_config_get_int(linphone_core_get_config(q->getCore()->getCCore()), "sip", "auto_answer_replacing_calls", 1))
q->accept();
}
......@@ -658,11 +641,12 @@ void CallSessionPrivate::setContactOp () {
// -----------------------------------------------------------------------------
void CallSessionPrivate::completeLog () {
L_Q();
log->duration = computeDuration(); /* Store duration since connected */
log->error_info = linphone_error_info_ref(ei);
if (log->status == LinphoneCallMissed)
core->missed_calls++;
linphone_core_report_call_log(core, log);
q->getCore()->getCCore()->missed_calls++;
linphone_core_report_call_log(q->getCore()->getCCore(), log);
}
void CallSessionPrivate::createOp () {
......@@ -673,13 +657,13 @@ void CallSessionPrivate::createOpTo (const LinphoneAddress *to) {
L_Q();
if (op)
op->release();
op = new SalCallOp(core->sal);
op = new SalCallOp(q->getCore()->getCCore()->sal);
op->set_user_pointer(q);
#if 0
if (linphone_call_params_get_referer(call->params))
sal_call_set_referer(call->op,linphone_call_params_get_referer(call->params)->op);
#endif
linphone_configure_op(core, op, to, q->getParams()->getPrivate()->getCustomHeaders(), false);
linphone_configure_op(q->getCore()->getCCore(), op, to, q->getParams()->getPrivate()->getCustomHeaders(), false);
if (q->getParams()->getPrivacy() != LinphonePrivacyDefault)
op->set_privacy((SalPrivacyMask)q->getParams()->getPrivacy());
/* else privacy might be set by proxy */
......@@ -688,6 +672,7 @@ void CallSessionPrivate::createOpTo (const LinphoneAddress *to) {
// -----------------------------------------------------------------------------
LinphoneAddress * CallSessionPrivate::getFixedContact () const {
L_Q();
LinphoneAddress *result = nullptr;
if (op && op->get_contact_address()) {
/* If already choosed, don't change it */
......@@ -703,7 +688,7 @@ LinphoneAddress * CallSessionPrivate::getFixedContact () const {
lInfo() << "Contact has been fixed using proxy";
result = linphone_address_clone(linphone_proxy_config_get_contact(destProxy));
} else {
result = linphone_core_get_primary_contact_parsed(core);
result = linphone_core_get_primary_contact_parsed(q->getCore()->getCCore());
if (result) {
/* Otherwise use supplied localip */
linphone_address_set_domain(result, nullptr /* localip */);
......@@ -716,12 +701,36 @@ LinphoneAddress * CallSessionPrivate::getFixedContact () const {
// =============================================================================
CallSession::CallSession (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener)
: Object(*new CallSessionPrivate(conference, params, listener)) {
CallSession::CallSession (const shared_ptr<Core> &core, const CallSessionParams *params, CallSessionListener *listener)
: Object(*new CallSessionPrivate), CoreAccessor(core) {
L_D();
d->listener = listener;
if (params)
d->setParams(new CallSessionParams(*params));
d->init();
lInfo() << "New CallSession [" << this << "] initialized (LinphoneCore version: " << linphone_core_get_version() << ")";
}
CallSession::CallSession (CallSessionPrivate &p) : Object(p) {}
CallSession::CallSession (CallSessionPrivate &p, const shared_ptr<Core> &core) : Object(p), CoreAccessor(core) {
L_D();
d->init();
}
CallSession::~CallSession () {
L_D();
if (d->currentParams)
delete d->currentParams;
if (d->params)
delete d->params;
if (d->remoteParams)
delete d->remoteParams;
if (d->ei)
linphone_error_info_unref(d->ei);
if (d->log)
linphone_call_log_unref(d->log);
if (d->op)
d->op->release();
}
// -----------------------------------------------------------------------------
......@@ -750,7 +759,7 @@ void CallSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg
LinphoneAddress *toAddr = linphone_address_new(to.asString().c_str());
if (!d->destProxy) {
/* Try to define the destination proxy if it has not already been done to have a correct contact field in the SIP messages */
d->destProxy = linphone_core_lookup_known_proxy(d->core, toAddr);
d->destProxy = linphone_core_lookup_known_proxy(getCore()->getCCore(), toAddr);
}
d->log = linphone_call_log_new(direction, fromAddr, toAddr);
......@@ -758,7 +767,7 @@ void CallSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg
/* We already have an op for incoming calls */
d->op = op;
d->op->set_user_pointer(this);
op->enable_cnx_ip_to_0000_if_sendonly(!!lp_config_get_default_int(linphone_core_get_config(d->core),
op->enable_cnx_ip_to_0000_if_sendonly(!!lp_config_get_default_int(linphone_core_get_config(getCore()->getCCore()),
"sip", "cnx_ip_to_0000_if_sendonly_enabled", 0));
d->log->call_id = ms_strdup(op->get_call_id()); /* Must be known at that time */
}
......@@ -767,7 +776,7 @@ void CallSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg
d->startPing();
} else if (direction == LinphoneCallIncoming) {
d->setParams(new CallSessionParams());
d->params->initDefault(d->core);
d->params->initDefault(getCore());
}
}
......@@ -819,15 +828,15 @@ bool CallSession::initiateOutgoing () {
void CallSession::iterate (time_t currentRealTime, bool oneSecondElapsed) {
L_D();
int elapsed = (int)(currentRealTime - d->log->start_date_time);
if ((d->state == LinphoneCallOutgoingInit) && (elapsed >= d->core->sip_conf.delayed_timeout)) {
if ((d->state == LinphoneCallOutgoingInit) && (elapsed >= getCore()->getCCore()->sip_conf.delayed_timeout)) {
/* Start the call even if the OPTIONS reply did not arrive */
startInvite(nullptr, "");
}
if ((d->state == LinphoneCallIncomingReceived) || (d->state == LinphoneCallIncomingEarlyMedia)) {
if (oneSecondElapsed)
lInfo() << "Incoming call ringing for " << elapsed << " seconds";
if (elapsed > d->core->sip_conf.inc_timeout) {
lInfo() << "Incoming call timeout (" << d->core->sip_conf.inc_timeout << ")";
if (elapsed > getCore()->getCCore()->sip_conf.inc_timeout) {
lInfo() << "Incoming call timeout (" << getCore()->getCCore()->sip_conf.inc_timeout << ")";
#if 0
LinphoneReason declineReason = (core->current_call != call) ? LinphoneReasonBusy : LinphoneReasonDeclined;
#endif
......@@ -839,16 +848,15 @@ void CallSession::iterate (time_t currentRealTime, bool oneSecondElapsed) {
#endif
}
}
if ((d->core->sip_conf.in_call_timeout > 0) && (d->log->connected_date_time != 0)
&& ((currentRealTime - d->log->connected_date_time) > d->core->sip_conf.in_call_timeout)) {
lInfo() << "In call timeout (" << d->core->sip_conf.in_call_timeout << ")";
if ((getCore()->getCCore()->sip_conf.in_call_timeout > 0) && (d->log->connected_date_time != 0)
&& ((currentRealTime - d->log->connected_date_time) > getCore()->getCCore()->sip_conf.in_call_timeout)) {
lInfo() << "In call timeout (" << getCore()->getCCore()->sip_conf.in_call_timeout << ")";
terminate();
}
}
LinphoneStatus CallSession::redirect (const string &redirectUri) {
L_D();
LinphoneAddress *realParsedAddr = linphone_core_interpret_url(d->core, redirectUri.c_str());
LinphoneAddress *realParsedAddr = linphone_core_interpret_url(getCore()->getCCore(), redirectUri.c_str());
if (!realParsedAddr) {
/* Bad url */
lError() << "Bad redirect URI: " << redirectUri;
......
......@@ -34,8 +34,9 @@ LINPHONE_BEGIN_NAMESPACE
class CallPrivate;
class CallSessionPrivate;
class Content;
class Core;
class LINPHONE_PUBLIC CallSession : public Object {
class LINPHONE_PUBLIC CallSession : public Object, public CoreAccessor {
friend class CallPrivate;
friend class ClientGroupChatRoom;
friend class ClientGroupChatRoomPrivate;
......@@ -46,7 +47,8 @@ class LINPHONE_PUBLIC CallSession : public Object {
public:
L_OVERRIDE_SHARED_FROM_THIS(CallSession);
CallSession (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener);
CallSession (const std::shared_ptr<Core> &core, const CallSessionParams *params, CallSessionListener *listener);
virtual ~CallSession ();
LinphoneStatus accept (const CallSessionParams *csp = nullptr);
LinphoneStatus acceptUpdate (const CallSessionParams *csp);
......@@ -80,7 +82,7 @@ public:
std::string getRemoteUserAgent () const;
protected:
explicit CallSession (CallSessionPrivate &p);
explicit CallSession (CallSessionPrivate &p, const std::shared_ptr<Core> &core);
private:
L_DECLARE_PRIVATE(CallSession);
......
......@@ -37,8 +37,7 @@ LINPHONE_BEGIN_NAMESPACE
class MediaSessionPrivate : public CallSessionPrivate {
public:
MediaSessionPrivate (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener);
virtual ~MediaSessionPrivate ();
MediaSessionPrivate () = default;
public:
static void stunAuthRequestedCb (void *userData, const char *realm, const char *nonce, const char **username, const char **password, const char **ha1);
......@@ -69,7 +68,9 @@ public:
MediaSessionParams *getCurrentParams () const { return static_cast<MediaSessionParams *>(currentParams); }
MediaSessionParams *getParams () const { return static_cast<MediaSessionParams *>(params); }
MediaSessionParams *getRemoteParams () const { return static_cast<MediaSessionParams *>(remoteParams); }
void setCurrentParams (MediaSessionParams *msp);
void setParams (MediaSessionParams *msp);
void setRemoteParams (MediaSessionParams *msp);
IceSession *getIceSession () const { return iceAgent->getIceSession(); }
......@@ -99,6 +100,7 @@ private:
static float aggregateQualityRatings (float audioRating, float videoRating);
std::shared_ptr<Participant> getMe () const;
void setState (LinphoneCallState newState, const std::string &message) override;
void computeStreamsIndexes (const SalMediaDescription *md);
......@@ -244,6 +246,8 @@ private:
static const std::string ecStateStore;
static const int ecStateMaxLen;
std::weak_ptr<Participant> me;
AudioStream *audioStream = nullptr;
OrtpEvQueue *audioStreamEvQueue = nullptr;
LinphoneCallStats *audioStats = nullptr;
......
......@@ -26,8 +26,8 @@
#include "call/call-p.h"
#include "conference/participant-p.h"
#include "conference/params/media-session-params-p.h"
#include "conference/session/media-session.h"
#include "core/core.h"
#include "utils/payload-type-handler.h"
#include "logger/logger.h"
......@@ -68,54 +68,6 @@ const int MediaSessionPrivate::ecStateMaxLen = 1048576; /* 1Mo */
// =============================================================================
MediaSessionPrivate::MediaSessionPrivate (const Conference &conference, const CallSessionParams *csp, CallSessionListener *listener)
: CallSessionPrivate(conference, nullptr, listener) {
if (csp)
setParams(new MediaSessionParams(*(reinterpret_cast<const MediaSessionParams *>(csp))));
else
setParams(new MediaSessionParams());
currentParams = new MediaSessionParams();
audioStats = _linphone_call_stats_new();
initStats(audioStats, LinphoneStreamTypeAudio);
videoStats = _linphone_call_stats_new();
initStats(videoStats, LinphoneStreamTypeVideo);
textStats = _linphone_call_stats_new();
initStats(textStats, LinphoneStreamTypeText);
int minPort, maxPort;
linphone_core_get_audio_port_range(core, &minPort, &maxPort);
setPortConfig(mainAudioStreamIndex, make_pair(minPort, maxPort));
linphone_core_get_video_port_range(core, &minPort, &maxPort);
setPortConfig(mainVideoStreamIndex, make_pair(minPort, maxPort));
linphone_core_get_text_port_range(core, &minPort, &maxPort);
setPortConfig(mainTextStreamIndex, make_pair(minPort, maxPort));
memset(sessions, 0, sizeof(sessions));
}
MediaSessionPrivate::~MediaSessionPrivate () {
if (audioStats)
linphone_call_stats_unref(audioStats);
if (videoStats)
linphone_call_stats_unref(videoStats);
if (textStats)
linphone_call_stats_unref(textStats);
if (natPolicy)
linphone_nat_policy_unref(natPolicy);
if (stunClient)
delete stunClient;
delete iceAgent;
if (localDesc)
sal_media_description_unref(localDesc);
if (biggestDesc)
sal_media_description_unref(biggestDesc);
if (resultDesc)
sal_media_description_unref(resultDesc);
}
// -----------------------------------------------------------------------------
void MediaSessionPrivate::stunAuthRequestedCb (void *userData, const char *realm, const char *nonce, const char **username, const char **password, const char **ha1) {
MediaSessionPrivate *msp = reinterpret_cast<MediaSessionPrivate *>(userData);
msp->stunAuthRequestedCb(realm, nonce, username, password, ha1);
......@@ -136,7 +88,7 @@ void MediaSessionPrivate::accepted () {
lInfo() << "Using early media SDP since none was received with the 200 OK";