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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
4b951b37
"git@git.jami.net:savoirfairelinux/jami-jams.git" did not exist on "e0c0ceb20e395b17608e43162a374092fa446899"
Commit
4b951b37
authored
15 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
[#3443] Fix G722 codec timestamp incrementation
parent
a38ea129
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sflphone-common/src/audio/audiortp/AudioRtpSession.h
+82
-53
82 additions, 53 deletions
sflphone-common/src/audio/audiortp/AudioRtpSession.h
with
82 additions
and
53 deletions
sflphone-common/src/audio/audiortp/AudioRtpSession.h
+
82
−
53
View file @
4b951b37
...
@@ -50,6 +50,9 @@
...
@@ -50,6 +50,9 @@
#include
<ccrtp/rtp.h>
#include
<ccrtp/rtp.h>
#include
<cc++/numbers.h>
// ost::Time
#include
<cc++/numbers.h>
// ost::Time
// Frequency (in packet number)
#define RTP_TIMESTAMP_RESET_FREQ 100
namespace
sfl
{
namespace
sfl
{
static
const
int
schedulingTimeout
=
100000
;
static
const
int
schedulingTimeout
=
100000
;
...
@@ -206,6 +209,17 @@ namespace sfl {
...
@@ -206,6 +209,17 @@ namespace sfl {
*/
*/
int
_timestamp
;
int
_timestamp
;
/**
* Timestamp incrementation value based on codec period length (framesize)
* except for G722 which require a 8 kHz incrementation.
*/
int
_timestampIncrement
;
/**
* Timestamp reset freqeuncy specified in number of packet sent
*/
short
_timestampCount
;
/**
/**
* Time counter used to trigger incoming call notification
* Time counter used to trigger incoming call notification
*/
*/
...
@@ -238,6 +252,8 @@ namespace sfl {
...
@@ -238,6 +252,8 @@ namespace sfl {
_manager
(
manager
),
_manager
(
manager
),
_converterSamplingRate
(
0
),
_converterSamplingRate
(
0
),
_timestamp
(
0
),
_timestamp
(
0
),
_timestampIncrement
(
0
),
_timestampCount
(
0
),
_countNotificationTime
(
0
),
_countNotificationTime
(
0
),
_ca
(
sipcall
)
_ca
(
sipcall
)
{
{
...
@@ -329,18 +345,26 @@ namespace sfl {
...
@@ -329,18 +345,26 @@ namespace sfl {
_codecSampleRate
=
_audiocodec
->
getClockRate
();
_codecSampleRate
=
_audiocodec
->
getClockRate
();
_codecFrameSize
=
_audiocodec
->
getFrameSize
();
_codecFrameSize
=
_audiocodec
->
getFrameSize
();
// G722 requires timestamp to be incremented at 8 kHz
if
(
_audiocodec
->
getPayload
()
==
9
)
_timestampIncrement
=
160
;
else
_timestampIncrement
=
_codecFrameSize
;
_debug
(
"RTP: Codec sampling rate: %d"
,
_codecSampleRate
);
_debug
(
"RTP: Codec sampling rate: %d"
,
_codecSampleRate
);
_debug
(
"RTP: Codec frame size: %d"
,
_codecFrameSize
);
_debug
(
"RTP: Codec frame size: %d"
,
_codecFrameSize
);
_debug
(
"RTP: RTP timestamp increment: %d"
,
_timestampIncrement
);
//
TODO: figure out why this is necessary.
//
Even if specified as a 16 kHz codec, G722 requires rtp sending rate to be 8 kHz
if
(
_audiocodec
->
getPayload
()
==
9
)
{
if
(
_audiocodec
->
getPayload
()
==
9
)
{
_debug
(
"RTP: Setting payload format
to G722
"
);
_debug
(
"RTP: Setting
G722
payload format"
);
static_cast
<
D
*>
(
this
)
->
setPayloadFormat
(
ost
::
DynamicPayloadFormat
(
(
ost
::
PayloadType
)
_audiocodec
->
getPayload
(),
_audiocodec
->
getClockRate
()));
static_cast
<
D
*>
(
this
)
->
setPayloadFormat
(
ost
::
DynamicPayloadFormat
(
(
ost
::
PayloadType
)
_audiocodec
->
getPayload
(),
_audiocodec
->
getClockRate
()));
}
else
if
(
_audiocodec
->
hasDynamicPayload
())
{
}
else
if
(
_audiocodec
->
hasDynamicPayload
())
{
_debug
(
"RTP: Setting
a
dynamic payload format"
);
_debug
(
"RTP: Setting dynamic payload format"
);
static_cast
<
D
*>
(
this
)
->
setPayloadFormat
(
ost
::
DynamicPayloadFormat
(
(
ost
::
PayloadType
)
_audiocodec
->
getPayload
(),
_audiocodec
->
getClockRate
()));
static_cast
<
D
*>
(
this
)
->
setPayloadFormat
(
ost
::
DynamicPayloadFormat
(
(
ost
::
PayloadType
)
_audiocodec
->
getPayload
(),
_audiocodec
->
getClockRate
()));
}
else
if
(
!
_audiocodec
->
hasDynamicPayload
()
&&
_audiocodec
->
getPayload
()
!=
9
)
{
}
else
if
(
!
_audiocodec
->
hasDynamicPayload
()
&&
_audiocodec
->
getPayload
()
!=
9
)
{
_debug
(
"RTP: Setting
a
static payload format"
);
_debug
(
"RTP: Setting static payload format"
);
static_cast
<
D
*>
(
this
)
->
setPayloadFormat
(
ost
::
StaticPayloadFormat
(
(
ost
::
StaticPayloadType
)
_audiocodec
->
getPayload
()));
static_cast
<
D
*>
(
this
)
->
setPayloadFormat
(
ost
::
StaticPayloadFormat
(
(
ost
::
StaticPayloadType
)
_audiocodec
->
getPayload
()));
}
}
}
}
...
@@ -567,7 +591,7 @@ namespace sfl {
...
@@ -567,7 +591,7 @@ namespace sfl {
// 4. send it
// 4. send it
// Increment timestamp for outgoing packet
// Increment timestamp for outgoing packet
_timestamp
+=
_
codecFrameSize
;
_timestamp
+=
_
timestampIncrement
;
if
(
!
_audiolayer
)
{
if
(
!
_audiolayer
)
{
_debug
(
"No audiolayer available for MIC"
);
_debug
(
"No audiolayer available for MIC"
);
...
@@ -668,14 +692,19 @@ namespace sfl {
...
@@ -668,14 +692,19 @@ namespace sfl {
while
(
!
testCancel
())
{
while
(
!
testCancel
())
{
// ost::MutexLock lock(*(_manager->getAudioLayerMutex()));
// Reset timestamp to make sure the timing information are up to date
if
(
_timestampCount
>
RTP_TIMESTAMP_RESET_FREQ
)
{
_timestamp
=
static_cast
<
D
*>
(
this
)
->
getCurrentTimestamp
();
_timestampCount
=
0
;
}
_timestampCount
++
;
_manager
->
getAudioLayerMutex
()
->
enter
();
_manager
->
getAudioLayerMutex
()
->
enter
();
// converterSamplingRate = _audiolayer->getMainBuffer()->getInternalSamplingRate();
// converterSamplingRate = _audiolayer->getMainBuffer()->getInternalSamplingRate();
_converterSamplingRate
=
_manager
->
getAudioDriver
()
->
getMainBuffer
()
->
getInternalSamplingRate
();
_converterSamplingRate
=
_manager
->
getAudioDriver
()
->
getMainBuffer
()
->
getInternalSamplingRate
();
sessionWaiting
=
static_cast
<
D
*>
(
this
)
->
isWaiting
();
sessionWaiting
=
static_cast
<
D
*>
(
this
)
->
isWaiting
();
// Send session
// Send session
...
...
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