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
20b924da
Commit
20b924da
authored
17 years ago
by
Alexandre Bourget
Browse files
Options
Downloads
Patches
Plain Diff
DEBUG: dump audio data directly to /tmp/audio.dat
parent
a7d25038
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/audio/audiortp.cpp
+24
-8
24 additions, 8 deletions
src/audio/audiortp.cpp
src/audio/audiortp.h
+5
-0
5 additions, 0 deletions
src/audio/audiortp.h
with
29 additions
and
8 deletions
src/audio/audiortp.cpp
+
24
−
8
View file @
20b924da
...
...
@@ -24,6 +24,8 @@
#include
<assert.h>
#include
<string>
#include
<cstring>
#include
<fstream>
// fstream + iostream pour fstream debugging..
#include
<iostream>
// removeable...
#include
"../global.h"
#include
"../manager.h"
...
...
@@ -91,7 +93,9 @@ AudioRtp::closeRtpSession () {
////////////////////////////////////////////////////////////////////////////////
// AudioRtpRTX Class //
////////////////////////////////////////////////////////////////////////////////
AudioRtpRTX
::
AudioRtpRTX
(
SIPCall
*
sipcall
,
bool
sym
)
{
AudioRtpRTX
::
AudioRtpRTX
(
SIPCall
*
sipcall
,
bool
sym
)
:
_fstream
(
"/tmp/audio.dat"
,
std
::
ofstream
::
binary
)
{
setCancel
(
cancelDeferred
);
time
=
new
ost
::
Time
();
_ca
=
sipcall
;
...
...
@@ -354,39 +358,50 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime)
// decode multiply by two, so the number of byte should be double
// size shall be RTP_FRAME2SEND or lower
int
expandedSize
=
audiocodec
->
codecDecode
(
_receiveDataDecoded
,
data
,
size
);
int
nbInt16
=
expandedSize
/
sizeof
(
int16
);
int
nbInt16
=
expandedSize
/
sizeof
(
int16
);
if
(
nbInt16
>
RTP_20S_8KHZ_MAX
)
{
_debug
(
"We have decoded a RTP packet larger than expected: %s VS %s. crop
\n
"
,
nbInt16
,
RTP_20S_8KHZ_MAX
);
nbInt16
=
RTP_20S_8KHZ_MAX
;
}
/* WRITE IN A FILE FOR DEBUG */
// crache _receiveDataDecoded sur le disque pour analyse avec autre chose.
_fstream
.
write
((
char
*
)
_receiveDataDecoded
,
size
);
_fstream
.
flush
();
SFLDataFormat
*
toAudioLayer
;
int
nbSample
=
nbInt16
;
// 48000 / 8000 = 6
.. Samplerate will convert to 48000 ?!
// 48000 / 8000 = 6
, the number of samples for the maximum rate conversion.
int
nbSampleMaxRate
=
nbInt16
*
6
;
// TODO: change it
if
(
audiolayer
->
getSampleRate
()
!=
audiocodec
->
getClockRate
()
&&
nbSample
)
{
// Do sample rate conversion
double
factord
=
(
double
)
audiolayer
->
getSampleRate
()
/
audiocodec
->
getClockRate
();
double
factord
=
(
double
)
audiolayer
->
getSampleRate
()
/
audiocodec
->
getClockRate
();
// SRC_DATA from samplerate.h
SRC_DATA
src_data
;
src_data
.
data_in
=
_floatBuffer8000
;
src_data
.
data_out
=
_floatBuffer48000
;
src_data
.
input_frames
=
nbSample
;
src_data
.
output_frames
=
nbSample
*
audiolayer
->
getSample
()
/
audiocodec
->
getClockRate
()
;
src_data
.
input_frames
=
RTP_20S_8KHZ_MAX
;
src_data
.
output_frames
=
RTP_20S_48KHZ_MAX
;
src_data
.
src_ratio
=
factord
;
src_short_to_float_array
(
_receiveDataDecoded
,
_floatBuffer8000
,
nbSample
);
src_simple
(
&
src_data
,
SRC_SINC_BEST_QUALITY
/*SRC_SINC_MEDIUM_QUALITY*/
,
1
);
// 1=mono channel
int
err
=
src_simple
(
&
src_data
,
SRC_SINC_BEST_QUALITY
/* SRC_SINC_MEDIUM_QUALITY*/
,
1
);
// 1=mono channel
// Truncate number of samples if too high (ouch!)
nbSample
=
(
src_data
.
output_frames_gen
>
RTP_20S_48KHZ_MAX
)
?
RTP_20S_48KHZ_MAX
:
src_data
.
output_frames_gen
;
#ifdef DATAFORMAT_IS_FLOAT
toAudioLayer
=
_floatBuffer48000
;
#else
src_float_to_short_array
(
_floatBuffer48000
,
_dataAudioLayer
,
nbSample
);
toAudioLayer
=
_dataAudioLayer
;
#endif
}
else
{
nbSample
=
nbInt16
;
...
...
@@ -398,6 +413,7 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime)
toAudioLayer
=
_receiveDataDecoded
;
// int to int
#endif
}
audiolayer
->
putMain
(
toAudioLayer
,
nbSample
*
sizeof
(
SFLDataFormat
));
//_debug("ARTP: %d\n", nbSample * sizeof(SFLDataFormat));
...
...
This diff is collapsed.
Click to expand it.
src/audio/audiortp.h
+
5
−
0
View file @
20b924da
...
...
@@ -22,6 +22,8 @@
#include
<cstdio>
#include
<cstdlib>
#include
<fstream>
// fstream + iostream for _fstream debugging...
#include
<iostream>
#include
<ccrtp/rtp.h>
#include
<cc++/numbers.h>
...
...
@@ -70,6 +72,9 @@ private:
/** Buffer for 8000Hz samples for mic conversion */
int16
*
_intBuffer8000
;
/** Debugging output file */
std
::
ofstream
_fstream
;
void
initAudioRtpSession
(
void
);
void
sendSessionFromMic
(
int
);
void
receiveSessionForSpkr
(
int
&
);
...
...
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