Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
dfda5df8
Commit
dfda5df8
authored
12 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
#13678: Fix Zrtp thread may hang when hanging up a call
parent
eac7e9a3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
daemon/src/audio/audiortp/audio_zrtp_session.cpp
+36
-40
36 additions, 40 deletions
daemon/src/audio/audiortp/audio_zrtp_session.cpp
daemon/src/audio/audiortp/audio_zrtp_session.h
+25
-4
25 additions, 4 deletions
daemon/src/audio/audiortp/audio_zrtp_session.h
with
61 additions
and
44 deletions
daemon/src/audio/audiortp/audio_zrtp_session.cpp
+
36
−
40
View file @
dfda5df8
...
...
@@ -47,24 +47,26 @@
namespace
sfl
{
AudioZrtpSession
::
AudioZrtpSession
(
SIPCall
&
call
,
const
std
::
string
&
zidFilename
)
:
AudioRtpSession
(
call
,
*
this
,
*
this
),
ost
::
TRTPSessionBase
<
ost
::
SymmetricRTPChannel
,
ost
::
SymmetricRTPChannel
,
ost
::
ZrtpQueue
>
(
ost
::
InetHostAddress
(
call_
.
getLocalIp
().
c_str
()),
call_
.
getLocalAudioPort
(),
0
,
ost
::
MembershipBookkeeping
::
defaultMembersHashSize
,
ost
::
defaultApplication
()),
zidFilename_
(
zidFilename
)
ost
::
TimerPort
()
,
ost
::
SymmetricZRTPSession
(
ost
::
InetHostAddress
(
call
.
getLocalIp
().
c_str
()),
call
.
getLocalAudioPort
())
,
AudioRtpSession
(
call
,
*
this
,
*
this
)
,
zidFilename_
(
zidFilename
)
,
rtpThread_
(
*
this
)
{
initializeZid
();
DEBUG
(
"Setting new RTP session with destination %s:%d"
,
call_
.
getLocalIp
().
c_str
(),
call_
.
getLocalAudioPort
());
audioRtpRecord_
.
callId_
=
call_
.
getCallId
();
}
AudioZrtpSession
::~
AudioZrtpSession
()
{
ost
::
Thread
::
terminate
();
Manager
::
instance
().
getMainBuffer
()
->
unBindAll
(
call_
.
getCallId
());
if
(
rtpThread_
.
running_
)
{
rtpThread_
.
running_
=
false
;
rtpThread_
.
join
();
}
}
void
AudioZrtpSession
::
initializeZid
()
{
...
...
@@ -120,46 +122,31 @@ void AudioZrtpSession::sendMicData()
queue_
.
sendImmediate
(
timestamp_
,
getMicDataEncoded
(),
compSize
);
}
void
AudioZrtpSession
::
run
()
AudioZrtpSession
::
AudioZrtpThread
::
AudioZrtpThread
(
AudioZrtpSession
&
session
)
:
running_
(
true
),
zrtpSession_
(
session
)
{}
void
AudioZrtpSession
::
AudioZrtpThread
::
run
()
{
// Set recording sampling rate
call_
.
setRecordingSmplRate
(
getCodecSampleRate
());
DEBUG
(
"Entering mainloop for call %s"
,
call_
.
getCallId
().
c_str
());
int
threadSleep
=
20
;
uint32
timeout
=
0
;
DEBUG
(
"Entering Audio zrtp thread main loop %s"
,
running_
?
"running"
:
"not running"
)
;
while
(
isActive
())
{
if
(
timeout
<
1000
)
timeout
=
getSchedulingTimeout
();
TimerPort
::
setTimer
(
threadSleep
);
while
(
running_
)
{
// Send session
if
(
hasDTMFPending
())
sendDtmfEvent
();
if
(
zrtpSession_
.
hasDTMFPending
())
zrtpSession_
.
sendDtmfEvent
();
else
sendMicData
();
controlReceptionService
();
controlTransmissionService
();
uint32
maxWait
=
timeval2microtimeout
(
getRTCPCheckInterval
());
// make sure the scheduling timeout is
// <= the check interval for RTCP
// packets
timeout
=
(
timeout
>
maxWait
)
?
maxWait
:
timeout
;
if
(
timeout
<
1000
)
{
// !(timeout/1000)
// dispatchDataPacket();
timerTick
();
}
else
{
if
(
isPendingData
(
timeout
/
1000
))
{
if
(
isActive
())
takeInDataPacket
();
}
timeout
=
0
;
}
zrtpSession_
.
sendMicData
();
Thread
::
sleep
(
TimerPort
::
getTimer
());
TimerPort
::
incTimer
(
threadSleep
);
}
DEBUG
(
"Le
ft main loop for call %s"
,
call_
.
getCallId
().
c_str
()
);
DEBUG
(
"Le
aving audio rtp thread loop"
);
}
int
AudioZrtpSession
::
getIncrementForDTMF
()
const
...
...
@@ -172,4 +159,13 @@ void AudioZrtpSession::setSessionMedia(AudioCodec &audioCodec)
AudioRtpSession
::
setSessionMedia
(
audioCodec
);
}
int
AudioZrtpSession
::
startRtpThread
(
AudioCodec
&
audiocodec
)
{
if
(
isStarted_
)
return
0
;
AudioRtpSession
::
startRtpThread
(
audiocodec
);
return
startZrtpThread
();
}
}
This diff is collapsed.
Click to expand it.
daemon/src/audio/audiortp/audio_zrtp_session.h
+
25
−
4
View file @
dfda5df8
...
...
@@ -54,25 +54,46 @@ class ZrtpZidException : public std::runtime_error {
};
class
AudioZrtpSession
:
public
AudioRtpSession
,
protected
ost
::
Thread
,
public
ost
::
TRTPSessionBase
<
ost
::
SymmetricRTPChannel
,
ost
::
SymmetricRTPChannel
,
ost
::
ZrtpQueue
>
{
public
ost
::
TimerPort
,
// public ost::TRTPSessionBase<ost::SymmetricRTPChannel, ost::SymmetricRTPChannel, ost::ZrtpQueue> {
public
ost
::
SymmetricZRTPSession
,
public
AudioRtpSession
{
public:
AudioZrtpSession
(
SIPCall
&
call
,
const
std
::
string
&
zidFilename
);
~
AudioZrtpSession
();
// Thread associated method
virtual
void
run
();
int
startZrtpThread
()
{
rtpThread_
.
start
();
return
0
;
}
virtual
bool
onRTPPacketRecv
(
ost
::
IncomingRTPPkt
&
pkt
)
{
return
AudioRtpSession
::
onRTPPacketRecv
(
pkt
);
}
private
:
NON_COPYABLE
(
AudioZrtpSession
);
class
AudioZrtpThread
:
public
ost
::
Thread
,
public
ost
::
TimerPort
{
public:
AudioZrtpThread
(
AudioZrtpSession
&
session
);
virtual
void
run
();
bool
running_
;
private:
NON_COPYABLE
(
AudioZrtpThread
);
AudioZrtpSession
&
zrtpSession_
;
};
void
sendMicData
();
void
initializeZid
();
std
::
string
zidFilename_
;
void
setSessionMedia
(
AudioCodec
&
codec
);
int
startRtpThread
(
AudioCodec
&
audiocodec
);
virtual
int
getIncrementForDTMF
()
const
;
AudioZrtpThread
rtpThread_
;
};
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment