mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-19 20:18:09 +00:00
Rework call parameters handling.
This commit is contained in:
parent
b357534bfe
commit
6ef2937a8e
10 changed files with 296 additions and 324 deletions
|
|
@ -33,12 +33,8 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
class CallSessionParamsPrivate : public ClonableObjectPrivate {
|
||||
public:
|
||||
CallSessionParamsPrivate () = default;
|
||||
CallSessionParamsPrivate (const CallSessionParamsPrivate &src);
|
||||
virtual ~CallSessionParamsPrivate ();
|
||||
|
||||
CallSessionParamsPrivate &operator= (const CallSessionParamsPrivate &src);
|
||||
|
||||
static void clone (const CallSessionParamsPrivate &src, CallSessionParamsPrivate &dst);
|
||||
void clone (const CallSessionParamsPrivate *src);
|
||||
|
||||
bool getInConference () const { return inConference; }
|
||||
void setInConference (bool value) { inConference = value; }
|
||||
|
|
|
|||
|
|
@ -27,35 +27,21 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
// =============================================================================
|
||||
|
||||
CallSessionParamsPrivate::CallSessionParamsPrivate (const CallSessionParamsPrivate &src) : ClonableObjectPrivate () {
|
||||
clone(src, *this);
|
||||
}
|
||||
|
||||
CallSessionParamsPrivate::~CallSessionParamsPrivate () {
|
||||
if (customHeaders)
|
||||
sal_custom_header_free(customHeaders);
|
||||
}
|
||||
|
||||
CallSessionParamsPrivate &CallSessionParamsPrivate::operator= (const CallSessionParamsPrivate &src) {
|
||||
if (this != &src) {
|
||||
if (customHeaders)
|
||||
sal_custom_header_free(customHeaders);
|
||||
clone(src, *this);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void CallSessionParamsPrivate::clone (const CallSessionParamsPrivate &src, CallSessionParamsPrivate &dst) {
|
||||
dst.sessionName = src.sessionName;
|
||||
dst.privacy = src.privacy;
|
||||
dst.inConference = src.inConference;
|
||||
dst.internalCallUpdate = src.internalCallUpdate;
|
||||
dst.noUserConsent = src.noUserConsent;
|
||||
void CallSessionParamsPrivate::clone (const CallSessionParamsPrivate *src) {
|
||||
sessionName = src->sessionName;
|
||||
privacy = src->privacy;
|
||||
inConference = src->inConference;
|
||||
internalCallUpdate = src->internalCallUpdate;
|
||||
noUserConsent = src->noUserConsent;
|
||||
/* The management of the custom headers is not optimal. We copy everything while ref counting would be more efficient. */
|
||||
if (src.customHeaders)
|
||||
dst.customHeaders = sal_custom_header_clone(src.customHeaders);
|
||||
dst.customContactParameters = src.customContactParameters;
|
||||
dst.referer = src.referer;
|
||||
if (customHeaders) {
|
||||
sal_custom_header_free(customHeaders);
|
||||
customHeaders = nullptr;
|
||||
}
|
||||
if (src->customHeaders)
|
||||
customHeaders = sal_custom_header_clone(src->customHeaders);
|
||||
customContactParameters = src->customContactParameters;
|
||||
referer = src->referer;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -80,12 +66,21 @@ CallSessionParams::CallSessionParams () : ClonableObject(*new CallSessionParamsP
|
|||
CallSessionParams::CallSessionParams (CallSessionParamsPrivate &p) : ClonableObject(p) {}
|
||||
|
||||
CallSessionParams::CallSessionParams (const CallSessionParams &src)
|
||||
: ClonableObject(*new CallSessionParamsPrivate(*src.getPrivate())) {}
|
||||
: ClonableObject(*new CallSessionParamsPrivate) {
|
||||
L_D();
|
||||
d->clone(src.getPrivate());
|
||||
}
|
||||
|
||||
CallSessionParams::~CallSessionParams () {
|
||||
L_D();
|
||||
if (d->customHeaders)
|
||||
sal_custom_header_free(d->customHeaders);
|
||||
}
|
||||
|
||||
CallSessionParams &CallSessionParams::operator= (const CallSessionParams &src) {
|
||||
L_D();
|
||||
if (this != &src)
|
||||
*d = *src.getPrivate();
|
||||
d->clone(src.getPrivate());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class CallSessionParams : public ClonableObject {
|
|||
public:
|
||||
CallSessionParams ();
|
||||
CallSessionParams (const CallSessionParams &src);
|
||||
virtual ~CallSessionParams () = default;
|
||||
virtual ~CallSessionParams ();
|
||||
|
||||
CallSessionParams &operator= (const CallSessionParams &src);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,13 +36,7 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
class MediaSessionParamsPrivate : public CallSessionParamsPrivate {
|
||||
public:
|
||||
MediaSessionParamsPrivate ();
|
||||
MediaSessionParamsPrivate (const MediaSessionParamsPrivate &src);
|
||||
virtual ~MediaSessionParamsPrivate ();
|
||||
|
||||
MediaSessionParamsPrivate &operator= (const MediaSessionParamsPrivate &src);
|
||||
|
||||
static void clone (const MediaSessionParamsPrivate &src, MediaSessionParamsPrivate &dst);
|
||||
void clone (const MediaSessionParamsPrivate *src);
|
||||
void clean ();
|
||||
|
||||
static SalStreamDir mediaDirectionToSalStreamDir (LinphoneMediaDirection direction);
|
||||
|
|
|
|||
|
|
@ -32,61 +32,42 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
// =============================================================================
|
||||
|
||||
MediaSessionParamsPrivate::MediaSessionParamsPrivate () {
|
||||
memset(customSdpMediaAttributes, 0, sizeof(customSdpMediaAttributes));
|
||||
}
|
||||
|
||||
MediaSessionParamsPrivate::MediaSessionParamsPrivate (const MediaSessionParamsPrivate &src) : CallSessionParamsPrivate(src) {
|
||||
clone(src, *this);
|
||||
}
|
||||
|
||||
MediaSessionParamsPrivate::~MediaSessionParamsPrivate () {
|
||||
this->clean();
|
||||
}
|
||||
|
||||
MediaSessionParamsPrivate &MediaSessionParamsPrivate::operator= (const MediaSessionParamsPrivate &src) {
|
||||
if (this != &src) {
|
||||
this->clean();
|
||||
clone(src, *this);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void MediaSessionParamsPrivate::clone (const MediaSessionParamsPrivate &src, MediaSessionParamsPrivate &dst) {
|
||||
dst.audioEnabled = src.audioEnabled;
|
||||
dst.audioBandwidthLimit = src.audioBandwidthLimit;
|
||||
dst.audioDirection = src.audioDirection;
|
||||
dst.audioMulticastEnabled = src.audioMulticastEnabled;
|
||||
dst.usedAudioCodec = src.usedAudioCodec;
|
||||
dst.videoEnabled = src.videoEnabled;
|
||||
dst.videoDirection = src.videoDirection;
|
||||
dst.videoMulticastEnabled = src.videoMulticastEnabled;
|
||||
dst.usedVideoCodec = src.usedVideoCodec;
|
||||
dst.receivedFps = src.receivedFps;
|
||||
dst.receivedVideoDefinition = src.receivedVideoDefinition ? linphone_video_definition_ref(src.receivedVideoDefinition) : nullptr;
|
||||
dst.sentFps = src.sentFps;
|
||||
dst.sentVideoDefinition = src.sentVideoDefinition ? linphone_video_definition_ref(src.sentVideoDefinition) : nullptr;
|
||||
dst.realtimeTextEnabled = src.realtimeTextEnabled;
|
||||
dst.usedRealtimeTextCodec = src.usedRealtimeTextCodec;
|
||||
dst.avpfEnabled = src.avpfEnabled;
|
||||
dst.avpfRrInterval = src.avpfRrInterval;
|
||||
dst.lowBandwidthEnabled = src.lowBandwidthEnabled;
|
||||
dst.recordFilePath = src.recordFilePath;
|
||||
dst.earlyMediaSendingEnabled = src.earlyMediaSendingEnabled;
|
||||
dst.encryption = src.encryption;
|
||||
dst.mandatoryMediaEncryptionEnabled = src.mandatoryMediaEncryptionEnabled;
|
||||
dst._implicitRtcpFbEnabled = src._implicitRtcpFbEnabled;
|
||||
dst.downBandwidth = src.downBandwidth;
|
||||
dst.upBandwidth = src.upBandwidth;
|
||||
dst.downPtime = src.downPtime;
|
||||
dst.upPtime = src.upPtime;
|
||||
dst.updateCallWhenIceCompleted = src.updateCallWhenIceCompleted;
|
||||
if (src.customSdpAttributes)
|
||||
dst.customSdpAttributes = sal_custom_sdp_attribute_clone(src.customSdpAttributes);
|
||||
memset(dst.customSdpMediaAttributes, 0, sizeof(dst.customSdpMediaAttributes));
|
||||
void MediaSessionParamsPrivate::clone (const MediaSessionParamsPrivate *src) {
|
||||
clean();
|
||||
CallSessionParamsPrivate::clone(src);
|
||||
audioEnabled = src->audioEnabled;
|
||||
audioBandwidthLimit = src->audioBandwidthLimit;
|
||||
audioDirection = src->audioDirection;
|
||||
audioMulticastEnabled = src->audioMulticastEnabled;
|
||||
usedAudioCodec = src->usedAudioCodec;
|
||||
videoEnabled = src->videoEnabled;
|
||||
videoDirection = src->videoDirection;
|
||||
videoMulticastEnabled = src->videoMulticastEnabled;
|
||||
usedVideoCodec = src->usedVideoCodec;
|
||||
receivedFps = src->receivedFps;
|
||||
receivedVideoDefinition = src->receivedVideoDefinition ? linphone_video_definition_ref(src->receivedVideoDefinition) : nullptr;
|
||||
sentFps = src->sentFps;
|
||||
sentVideoDefinition = src->sentVideoDefinition ? linphone_video_definition_ref(src->sentVideoDefinition) : nullptr;
|
||||
realtimeTextEnabled = src->realtimeTextEnabled;
|
||||
usedRealtimeTextCodec = src->usedRealtimeTextCodec;
|
||||
avpfEnabled = src->avpfEnabled;
|
||||
avpfRrInterval = src->avpfRrInterval;
|
||||
lowBandwidthEnabled = src->lowBandwidthEnabled;
|
||||
recordFilePath = src->recordFilePath;
|
||||
earlyMediaSendingEnabled = src->earlyMediaSendingEnabled;
|
||||
encryption = src->encryption;
|
||||
mandatoryMediaEncryptionEnabled = src->mandatoryMediaEncryptionEnabled;
|
||||
_implicitRtcpFbEnabled = src->_implicitRtcpFbEnabled;
|
||||
downBandwidth = src->downBandwidth;
|
||||
upBandwidth = src->upBandwidth;
|
||||
downPtime = src->downPtime;
|
||||
upPtime = src->upPtime;
|
||||
updateCallWhenIceCompleted = src->updateCallWhenIceCompleted;
|
||||
if (src->customSdpAttributes)
|
||||
customSdpAttributes = sal_custom_sdp_attribute_clone(src->customSdpAttributes);
|
||||
for (unsigned int i = 0; i < (unsigned int)LinphoneStreamTypeUnknown; i++) {
|
||||
if (src.customSdpMediaAttributes[i])
|
||||
dst.customSdpMediaAttributes[i] = sal_custom_sdp_attribute_clone(src.customSdpMediaAttributes[i]);
|
||||
if (src->customSdpMediaAttributes[i])
|
||||
customSdpMediaAttributes[i] = sal_custom_sdp_attribute_clone(src->customSdpMediaAttributes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,6 +82,7 @@ void MediaSessionParamsPrivate::clean () {
|
|||
if (customSdpMediaAttributes[i])
|
||||
sal_custom_sdp_attribute_free(customSdpMediaAttributes[i]);
|
||||
}
|
||||
memset(customSdpMediaAttributes, 0, sizeof(customSdpMediaAttributes));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -215,17 +197,27 @@ void MediaSessionParamsPrivate::setCustomSdpMediaAttributes (LinphoneStreamType
|
|||
|
||||
// =============================================================================
|
||||
|
||||
MediaSessionParams::MediaSessionParams () : CallSessionParams(*new MediaSessionParamsPrivate) {}
|
||||
MediaSessionParams::MediaSessionParams () : CallSessionParams(*new MediaSessionParamsPrivate) {
|
||||
L_D();
|
||||
memset(d->customSdpMediaAttributes, 0, sizeof(d->customSdpMediaAttributes));
|
||||
}
|
||||
|
||||
MediaSessionParams::MediaSessionParams (const MediaSessionParams &src)
|
||||
: CallSessionParams(*new MediaSessionParamsPrivate(*src.getPrivate())) {}
|
||||
: CallSessionParams(*new MediaSessionParamsPrivate) {
|
||||
L_D();
|
||||
memset(d->customSdpMediaAttributes, 0, sizeof(d->customSdpMediaAttributes));
|
||||
d->clone(src.getPrivate());
|
||||
}
|
||||
|
||||
MediaSessionParams::~MediaSessionParams () {
|
||||
L_D();
|
||||
d->clean();
|
||||
}
|
||||
|
||||
MediaSessionParams &MediaSessionParams::operator= (const MediaSessionParams &src) {
|
||||
L_D();
|
||||
if (this != &src) {
|
||||
CallSessionParams::operator=(src);
|
||||
*d = *src.getPrivate();
|
||||
}
|
||||
if (this != &src)
|
||||
d->clone(src.getPrivate());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class MediaSessionParams : public CallSessionParams {
|
|||
public:
|
||||
MediaSessionParams ();
|
||||
MediaSessionParams (const MediaSessionParams &src);
|
||||
virtual ~MediaSessionParams () = default;
|
||||
virtual ~MediaSessionParams ();
|
||||
|
||||
MediaSessionParams &operator= (const MediaSessionParams &src);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,8 +41,11 @@ 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; }
|
||||
void setParams (CallSessionParams *csp);
|
||||
|
||||
virtual void abort (const std::string &errorMsg);
|
||||
virtual void accepted ();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
CallSessionPrivate::CallSessionPrivate (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener)
|
||||
: conference(conference), listener(listener) {
|
||||
if (params)
|
||||
this->params = new CallSessionParams(*params);
|
||||
setParams(new CallSessionParams(*params));
|
||||
currentParams = new CallSessionParams();
|
||||
core = conference.getCore()->getCCore();
|
||||
ei = linphone_error_info_new();
|
||||
|
|
@ -226,6 +226,14 @@ bool CallSessionPrivate::startPing () {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CallSessionPrivate::setParams (CallSessionParams *csp) {
|
||||
if (params)
|
||||
delete params;
|
||||
params = csp;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CallSessionPrivate::abort (const string &errorMsg) {
|
||||
op->terminate();
|
||||
setState(LinphoneCallError, errorMsg);
|
||||
|
|
@ -346,9 +354,8 @@ void CallSessionPrivate::pingReply () {
|
|||
}
|
||||
|
||||
void CallSessionPrivate::remoteRinging () {
|
||||
L_Q();
|
||||
/* Set privacy */
|
||||
q->getCurrentParams()->setPrivacy((LinphonePrivacyMask)op->get_privacy());
|
||||
currentParams->setPrivacy((LinphonePrivacyMask)op->get_privacy());
|
||||
#if 0
|
||||
if (lc->ringstream == NULL) start_remote_ring(lc, call);
|
||||
#endif
|
||||
|
|
@ -452,14 +459,14 @@ void CallSessionPrivate::updating (bool isUpdate) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CallSessionPrivate::accept (const CallSessionParams *params) {
|
||||
void CallSessionPrivate::accept (const CallSessionParams *csp) {
|
||||
L_Q();
|
||||
/* Try to be best-effort in giving real local or routable contact address */
|
||||
setContactOp();
|
||||
if (params) {
|
||||
this->params = new CallSessionParams(*params);
|
||||
op->set_sent_custom_header(this->params->getPrivate()->getCustomHeaders());
|
||||
}
|
||||
if (csp)
|
||||
setParams(new CallSessionParams(*csp));
|
||||
if (params)
|
||||
op->set_sent_custom_header(params->getPrivate()->getCustomHeaders());
|
||||
|
||||
op->accept();
|
||||
if (listener)
|
||||
|
|
@ -759,7 +766,7 @@ void CallSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg
|
|||
if (direction == LinphoneCallOutgoing) {
|
||||
d->startPing();
|
||||
} else if (direction == LinphoneCallIncoming) {
|
||||
d->params = new CallSessionParams();
|
||||
d->setParams(new CallSessionParams());
|
||||
d->params->initDefault(d->core);
|
||||
}
|
||||
}
|
||||
|
|
@ -964,7 +971,7 @@ LinphoneStatus CallSession::update (const CallSessionParams *csp, const string &
|
|||
if (d->currentParams == csp)
|
||||
lWarning() << "CallSession::update() is given the current params, this is probably not what you intend to do!";
|
||||
if (csp)
|
||||
d->params = new CallSessionParams(*csp);
|
||||
d->setParams(new CallSessionParams(*csp));
|
||||
d->op->set_local_body(content ? *content : Content());
|
||||
LinphoneStatus result = d->startUpdate(subject);
|
||||
if (result && (d->state != initialState)) {
|
||||
|
|
|
|||
|
|
@ -62,30 +62,21 @@ public:
|
|||
void prepareStreamsForIceGathering (bool hasVideo);
|
||||
void stopStreamsForIceGathering ();
|
||||
|
||||
int getAf () const {
|
||||
return af;
|
||||
}
|
||||
int getAf () const { return af; }
|
||||
|
||||
bool getAudioMuted () const {
|
||||
return audioMuted;
|
||||
}
|
||||
bool getAudioMuted () const { return audioMuted; }
|
||||
|
||||
LinphoneCore *getCore () const {
|
||||
return core;
|
||||
}
|
||||
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 setParams (MediaSessionParams *msp);
|
||||
|
||||
IceSession *getIceSession () const {
|
||||
return iceAgent->getIceSession();
|
||||
}
|
||||
IceSession *getIceSession () const { return iceAgent->getIceSession(); }
|
||||
|
||||
SalMediaDescription *getLocalDesc () const {
|
||||
return localDesc;
|
||||
}
|
||||
SalMediaDescription *getLocalDesc () const { return localDesc; }
|
||||
|
||||
MediaStream *getMediaStream (LinphoneStreamType type) const;
|
||||
LinphoneNatPolicy *getNatPolicy () const {
|
||||
return natPolicy;
|
||||
}
|
||||
LinphoneNatPolicy *getNatPolicy () const { return natPolicy; }
|
||||
|
||||
int getRtcpPort (LinphoneStreamType type) const;
|
||||
int getRtpPort (LinphoneStreamType type) const;
|
||||
|
|
@ -253,10 +244,6 @@ private:
|
|||
static const std::string ecStateStore;
|
||||
static const int ecStateMaxLen;
|
||||
|
||||
MediaSessionParams *params = nullptr;
|
||||
mutable MediaSessionParams *currentParams = nullptr;
|
||||
MediaSessionParams *remoteParams = nullptr;
|
||||
|
||||
AudioStream *audioStream = nullptr;
|
||||
OrtpEvQueue *audioStreamEvQueue = nullptr;
|
||||
LinphoneCallStats *audioStats = nullptr;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue