mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 20:48:07 +00:00
Add definition of operator= for call/media session params.
This commit is contained in:
parent
57de771a28
commit
f97b6b9bae
6 changed files with 102 additions and 44 deletions
|
|
@ -33,6 +33,10 @@ public:
|
|||
CallSessionParamsPrivate (const CallSessionParamsPrivate &src);
|
||||
virtual ~CallSessionParamsPrivate ();
|
||||
|
||||
CallSessionParamsPrivate &operator= (const CallSessionParamsPrivate &src);
|
||||
|
||||
static void clone (const CallSessionParamsPrivate &src, CallSessionParamsPrivate &dst);
|
||||
|
||||
bool getInConference () const { return inConference; }
|
||||
void setInConference (bool value) { inConference = value; }
|
||||
bool getInternalCallUpdate () const { return internalCallUpdate; }
|
||||
|
|
|
|||
|
|
@ -27,15 +27,7 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
// =============================================================================
|
||||
|
||||
CallSessionParamsPrivate::CallSessionParamsPrivate (const CallSessionParamsPrivate &src) : ClonableObjectPrivate () {
|
||||
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)
|
||||
customHeaders = sal_custom_header_clone(src.customHeaders);
|
||||
referer = src.referer;
|
||||
clone(src, *this);
|
||||
}
|
||||
|
||||
CallSessionParamsPrivate::~CallSessionParamsPrivate () {
|
||||
|
|
@ -43,6 +35,27 @@ CallSessionParamsPrivate::~CallSessionParamsPrivate () {
|
|||
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;
|
||||
/* 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.referer = src.referer;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
SalCustomHeader * CallSessionParamsPrivate::getCustomHeaders () const {
|
||||
|
|
@ -67,6 +80,13 @@ CallSessionParams::CallSessionParams (CallSessionParamsPrivate &p) : ClonableObj
|
|||
CallSessionParams::CallSessionParams (const CallSessionParams &src)
|
||||
: ClonableObject(*new CallSessionParamsPrivate(*src.getPrivate())) {}
|
||||
|
||||
CallSessionParams &CallSessionParams::operator= (const CallSessionParams &src) {
|
||||
L_D(CallSessionParams);
|
||||
if (this != &src)
|
||||
*d = *src.getPrivate();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CallSessionParams::initDefault (LinphoneCore *core) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ public:
|
|||
CallSessionParams (const CallSessionParams &src);
|
||||
virtual ~CallSessionParams () = default;
|
||||
|
||||
CallSessionParams &operator= (const CallSessionParams &src);
|
||||
|
||||
virtual void initDefault (LinphoneCore *core);
|
||||
|
||||
const std::string& getSessionName () const;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@ public:
|
|||
MediaSessionParamsPrivate (const MediaSessionParamsPrivate &src);
|
||||
virtual ~MediaSessionParamsPrivate ();
|
||||
|
||||
MediaSessionParamsPrivate &operator= (const MediaSessionParamsPrivate &src);
|
||||
|
||||
static void clone (const MediaSessionParamsPrivate &src, MediaSessionParamsPrivate &dst);
|
||||
void clean ();
|
||||
|
||||
static SalStreamDir mediaDirectionToSalStreamDir (LinphoneMediaDirection direction);
|
||||
static LinphoneMediaDirection salStreamDirToMediaDirection (SalStreamDir dir);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,44 +36,60 @@ MediaSessionParamsPrivate::MediaSessionParamsPrivate () {
|
|||
}
|
||||
|
||||
MediaSessionParamsPrivate::MediaSessionParamsPrivate (const MediaSessionParamsPrivate &src) : CallSessionParamsPrivate(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);
|
||||
memset(customSdpMediaAttributes, 0, sizeof(customSdpMediaAttributes));
|
||||
for (unsigned int i = 0; i < (unsigned int)LinphoneStreamTypeUnknown; i++) {
|
||||
if (src.customSdpMediaAttributes[i])
|
||||
customSdpMediaAttributes[i] = sal_custom_sdp_attribute_clone(src.customSdpMediaAttributes[i]);
|
||||
}
|
||||
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));
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
void MediaSessionParamsPrivate::clean () {
|
||||
if (receivedVideoDefinition)
|
||||
linphone_video_definition_unref(receivedVideoDefinition);
|
||||
if (sentVideoDefinition)
|
||||
|
|
@ -203,6 +219,15 @@ MediaSessionParams::MediaSessionParams () : CallSessionParams(*new MediaSessionP
|
|||
MediaSessionParams::MediaSessionParams (const MediaSessionParams &src)
|
||||
: CallSessionParams(*new MediaSessionParamsPrivate(*src.getPrivate())) {}
|
||||
|
||||
MediaSessionParams &MediaSessionParams::operator= (const MediaSessionParams &src) {
|
||||
L_D(MediaSessionParams);
|
||||
if (this != &src) {
|
||||
CallSessionParams::operator=(src);
|
||||
*d = *src.getPrivate();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void MediaSessionParams::initDefault (LinphoneCore *core) {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ public:
|
|||
MediaSessionParams (const MediaSessionParams &src);
|
||||
virtual ~MediaSessionParams () = default;
|
||||
|
||||
MediaSessionParams &operator= (const MediaSessionParams &src);
|
||||
|
||||
void initDefault (LinphoneCore *core) override;
|
||||
|
||||
bool audioEnabled () const;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue