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
d4822091
Commit
d4822091
authored
13 years ago
by
Rafaël Carré
Browse files
Options
Downloads
Patches
Plain Diff
AudioRtpRecordHandler / AudioRtpSession : simplify
parent
43b3961c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp
+4
-20
4 additions, 20 deletions
sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp
sflphone-common/src/audio/audiortp/AudioRtpSession.cpp
+5
-17
5 additions, 17 deletions
sflphone-common/src/audio/audiortp/AudioRtpSession.cpp
with
9 additions
and
37 deletions
sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp
+
4
−
20
View file @
d4822091
...
...
@@ -260,7 +260,6 @@ int AudioRtpRecordHandler::processDataEncode (void)
{
SFLDataFormat
*
micData
=
_audioRtpRecord
.
_micData
;
unsigned
char
*
micDataEncoded
=
_audioRtpRecord
.
_micDataEncoded
;
//SFLDataFormat *micDataEchoCancelled = _audioRtpRecord._micDataEchoCancelled;
SFLDataFormat
*
micDataConverted
=
_audioRtpRecord
.
_micDataConverted
;
int
codecFrameSize
=
getCodecFrameSize
();
...
...
@@ -303,11 +302,9 @@ int AudioRtpRecordHandler::processDataEncode (void)
_audioRtpRecord
.
audioProcessMutex
.
enter
();
if
(
Manager
::
instance
().
audioPreference
.
getNoiseReduce
())
{
// _audioRtpRecord._audioProcess->processAudio (micDataEchoCancelled, nbSample * sizeof (SFLDataFormat));
_audioRtpRecord
.
_audioProcess
->
processAudio
(
micDataConverted
,
nbSample
*
sizeof
(
SFLDataFormat
));
}
// echoCanceller.process(micDataConverted, micDataEchoCancelled, nbSample * sizeof(SFLDataFormat));
if
(
Manager
::
instance
().
getEchoCancelState
()
==
"enabled"
)
{
echoCanceller
.
getData
(
micData
);
}
...
...
@@ -317,7 +314,6 @@ int AudioRtpRecordHandler::processDataEncode (void)
_audioRtpRecord
.
audioCodecMutex
.
enter
();
compSize
=
_audioRtpRecord
.
_audioCodec
->
encode
(
micDataEncoded
,
micData
,
nbSample
*
sizeof
(
SFLDataFormat
));
// compSize = _audioRtpRecord._audioCodec->encode (micDataEncoded, micDataConverted, nbSample * sizeof (SFLDataFormat));
_audioRtpRecord
.
audioCodecMutex
.
leave
();
...
...
@@ -327,11 +323,8 @@ int AudioRtpRecordHandler::processDataEncode (void)
if
(
Manager
::
instance
().
audioPreference
.
getNoiseReduce
())
{
_audioRtpRecord
.
_audioProcess
->
processAudio
(
micData
,
nbSample
*
sizeof
(
SFLDataFormat
));
// _audioRtpRecord._audioProcess->processAudio (micDataEchoCancelled, nbSample * sizeof (SFLDataFormat));
}
// echoCanceller.process(micData, micDataEchoCancelled, nbSample * sizeof(SFLDataFormat));
// echoCanceller.process(micData, micDataEchoCancelled, nbSample * sizeof(SFLDataFormat));
if
(
Manager
::
instance
().
getEchoCancelState
()
==
"enabled"
)
{
echoCanceller
.
getData
(
micData
);
}
...
...
@@ -346,7 +339,6 @@ int AudioRtpRecordHandler::processDataEncode (void)
_audioRtpRecord
.
audioCodecMutex
.
enter
();
// no resampling required
// compSize = _audioRtpRecord._audioCodec->encode (micDataEncoded, micData, nbSample * sizeof (SFLDataFormat));
compSize
=
_audioRtpRecord
.
_audioCodec
->
encode
(
micDataEncoded
,
micData
,
nbSample
*
sizeof
(
SFLDataFormat
));
_audioRtpRecord
.
audioCodecMutex
.
leave
();
...
...
@@ -383,10 +375,8 @@ void AudioRtpRecordHandler::processDataDecode (unsigned char *spkrData, unsigned
// test if resampling is required
if
(
codecSampleRate
!=
mainBufferSampleRate
)
{
// Do sample rate conversion
int
nbSampleDown
=
nbSample
;
nbSample
=
_audioRtpRecord
.
_converter
->
upsampleData
(
spkrDataDecoded
,
spkrDataConverted
,
codecSampleRate
,
mainBufferSampleRate
,
nbSampleDown
);
nbSample
=
_audioRtpRecord
.
_converter
->
upsampleData
(
spkrDataDecoded
,
spkrDataConverted
,
codecSampleRate
,
mainBufferSampleRate
,
nbSample
);
if
(
Manager
::
instance
().
getEchoCancelState
()
==
"enabled"
)
{
echoCanceller
.
putData
(
spkrDataConverted
,
nbSample
*
sizeof
(
SFLDataFormat
));
...
...
@@ -407,22 +397,16 @@ void AudioRtpRecordHandler::processDataDecode (unsigned char *spkrData, unsigned
bool
AudioRtpRecordHandler
::
fadeIn
(
SFLDataFormat
*
audio
,
int
size
,
SFLDataFormat
*
factor
)
{
// if factor reach 0, this function should no be called anymore
if
(
*
factor
<=
0
)
return
true
;
// apply amplitude factor;
while
(
size
)
{
size
--
;
audio
[
size
]
/=
*
factor
;
}
while
(
size
)
audio
[
--
size
]
/=
*
factor
;
// decrease factor
*
factor
/=
FADEIN_STEP_SIZE
;
return
false
;
return
*
factor
<=
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
sflphone-common/src/audio/audiortp/AudioRtpSession.cpp
+
5
−
17
View file @
d4822091
...
...
@@ -181,7 +181,6 @@ void AudioRtpSession::sendDtmfEvent (sfl::DtmfEvent *dtmf)
dtmf
->
payload
.
duration
++
;
// next packet is going to be the last one
if
(
(
dtmf
->
length
-
increment
)
<
increment
)
dtmf
->
payload
.
ebit
=
true
;
...
...
@@ -195,26 +194,16 @@ void AudioRtpSession::sendDtmfEvent (sfl::DtmfEvent *dtmf)
void
AudioRtpSession
::
receiveSpeakerData
()
{
const
ost
::
AppDataUnit
*
adu
=
NULL
;
int
packetTimestamp
=
_queue
->
getFirstTimestamp
();
adu
=
_queue
->
getData
(
packetTimestamp
);
if
(
!
adu
)
{
const
ost
::
AppDataUnit
*
adu
=
_queue
->
getData
(
_queue
->
getFirstTimestamp
());
if
(
!
adu
)
return
;
}
unsigned
char
*
spkrDataIn
=
NULL
;
unsigned
int
size
=
0
;
spkrDataIn
=
(
unsigned
char
*
)
adu
->
getData
();
// data in char
size
=
adu
->
getSize
();
// size in char
unsigned
char
*
spkrDataIn
=
(
unsigned
char
*
)
adu
->
getData
();
// data in char
unsigned
int
size
=
adu
->
getSize
();
// size in char
// DTMF over RTP, size must be over 4 in order to process it as voice data
if
(
size
>
4
)
{
if
(
size
>
4
)
processDataDecode
(
spkrDataIn
,
size
);
}
delete
adu
;
}
...
...
@@ -324,7 +313,6 @@ void AudioRtpSession::stopRtpThread ()
bool
AudioRtpSession
::
onRTPPacketRecv
(
ost
::
IncomingRTPPkt
&
)
{
receiveSpeakerData
();
return
true
;
}
...
...
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