Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
6ef2937a
Commit
6ef2937a
authored
Nov 29, 2017
by
Ghislain MARY
Browse files
Rework call parameters handling.
parent
b357534b
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
295 additions
and
323 deletions
+295
-323
src/conference/params/call-session-params-p.h
src/conference/params/call-session-params-p.h
+1
-5
src/conference/params/call-session-params.cpp
src/conference/params/call-session-params.cpp
+24
-29
src/conference/params/call-session-params.h
src/conference/params/call-session-params.h
+1
-1
src/conference/params/media-session-params-p.h
src/conference/params/media-session-params-p.h
+1
-7
src/conference/params/media-session-params.cpp
src/conference/params/media-session-params.cpp
+52
-60
src/conference/params/media-session-params.h
src/conference/params/media-session-params.h
+1
-1
src/conference/session/call-session-p.h
src/conference/session/call-session-p.h
+3
-0
src/conference/session/call-session.cpp
src/conference/session/call-session.cpp
+17
-10
src/conference/session/media-session-p.h
src/conference/session/media-session-p.h
+9
-22
src/conference/session/media-session.cpp
src/conference/session/media-session.cpp
+186
-188
No files found.
src/conference/params/call-session-params-p.h
View file @
6ef2937a
...
...
@@ -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
;
}
...
...
src/conference/params/call-session-params.cpp
View file @
6ef2937a
...
...
@@ -27,35 +27,21 @@ LINPHONE_BEGIN_NAMESPACE
// =============================================================================
CallSessionParamsPrivate
::
CallSessionParamsPrivate
(
const
CallSessionParamsPrivate
&
src
)
:
ClonableObjectPrivate
()
{
clone
(
src
,
*
this
);
}
CallSessionParamsPrivate
::~
CallSessionParamsPrivate
()
{
if
(
customHeaders
)
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
(
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
);
customHeaders
=
nullptr
;
}
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
.
customContactParameters
=
src
.
customContactParameters
;
dst
.
referer
=
src
.
referer
;
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
;
}
...
...
src/conference/params/call-session-params.h
View file @
6ef2937a
...
...
@@ -40,7 +40,7 @@ class CallSessionParams : public ClonableObject {
public:
CallSessionParams
();
CallSessionParams
(
const
CallSessionParams
&
src
);
virtual
~
CallSessionParams
()
=
default
;
virtual
~
CallSessionParams
();
CallSessionParams
&
operator
=
(
const
CallSessionParams
&
src
);
...
...
src/conference/params/media-session-params-p.h
View file @
6ef2937a
...
...
@@ -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
);
...
...
src/conference/params/media-session-params.cpp
View file @
6ef2937a
...
...
@@ -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
;
}
...
...
src/conference/params/media-session-params.h
View file @
6ef2937a
...
...
@@ -39,7 +39,7 @@ class MediaSessionParams : public CallSessionParams {
public:
MediaSessionParams
();
MediaSessionParams
(
const
MediaSessionParams
&
src
);
virtual
~
MediaSessionParams
()
=
default
;
virtual
~
MediaSessionParams
();
MediaSessionParams
&
operator
=
(
const
MediaSessionParams
&
src
);
...
...
src/conference/session/call-session-p.h
View file @
6ef2937a
...
...
@@ -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
();
...
...
src/conference/session/call-session.cpp
View file @
6ef2937a
...
...
@@ -43,7 +43,7 @@ LINPHONE_BEGIN_NAMESPACE
CallSessionPrivate
::
CallSessionPrivate
(
const
Conference
&
conference
,
const
CallSessionParams
*
params
,
CallSessionListener
*
listener
)
:
conference
(
conference
),
listener
(
listener
)
{
if
(
params
)
this
->
p
arams
=
new
CallSessionParams
(
*
params
);
setP
arams
(
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
->
getC
urrentParams
()
->
setPrivacy
((
LinphonePrivacyMask
)
op
->
get_privacy
());
c
urrentParams
->
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
->
p
arams
=
new
CallSessionParams
(
*
params
);
op
->
set_sent_custom_header
(
this
->
params
->
getPrivate
()
->
getCustomHeaders
());
}
if
(
csp
)
setP
arams
(
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
->
p
arams
=
new
CallSessionParams
();
d
->
setP
arams
(
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
->
p
arams
=
new
CallSessionParams
(
*
csp
);
d
->
setP
arams
(
new
CallSessionParams
(
*
csp
)
)
;
d
->
op
->
set_local_body
(
content
?
*
content
:
Content
());
LinphoneStatus
result
=
d
->
startUpdate
(
subject
);
if
(
result
&&
(
d
->
state
!=
initialState
))
{
...
...
src/conference/session/media-session-p.h
View file @
6ef2937a
...
...
@@ -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
;
...
...
src/conference/session/media-session.cpp
View file @
6ef2937a
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment