Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
58dca09f
Commit
58dca09f
authored
May 23, 2011
by
Guillaume Beraudo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Custom sample rate for echo calibration.
New "echo_cancellation_rate" config file key.
parent
27ab8107
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
6 deletions
+26
-6
coreapi/ec-calibrator.c
coreapi/ec-calibrator.c
+12
-4
coreapi/private.h
coreapi/private.h
+1
-0
coreapi/test_ecc.c
coreapi/test_ecc.c
+12
-1
mediastreamer2
mediastreamer2
+1
-1
No files found.
coreapi/ec-calibrator.c
View file @
58dca09f
...
...
@@ -23,15 +23,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2/mstonedetector.h"
#include "mediastreamer2/dtmfgen.h"
#include "lpconfig.h"
static
void
ecc_init_filters
(
EcCalibrator
*
ecc
){
unsigned
int
rate
;
ecc
->
ticker
=
ms_ticker_new
();
ecc
->
sndread
=
ms_snd_card_create_reader
(
ecc
->
play_card
);
ms_filter_call_method
(
ecc
->
sndread
,
MS_FILTER_SET_SAMPLE_RATE
,
&
ecc
->
rate
);
ecc
->
det
=
ms_filter_new
(
MS_TONE_DETECTOR_ID
);
ms_filter_call_method
(
ecc
->
det
,
MS_FILTER_SET_SAMPLE_RATE
,
&
ecc
->
rate
);
ecc
->
rec
=
ms_filter_new
(
MS_FILE_REC_ID
);
ms_filter_link
(
ecc
->
sndread
,
0
,
ecc
->
det
,
0
);
...
...
@@ -39,14 +42,17 @@ static void ecc_init_filters(EcCalibrator *ecc){
ecc
->
play
=
ms_filter_new
(
MS_FILE_PLAYER_ID
);
ecc
->
gen
=
ms_filter_new
(
MS_DTMF_GEN_ID
);
ms_filter_call_method
(
ecc
->
gen
,
MS_FILTER_SET_SAMPLE_RATE
,
&
ecc
->
rate
);
ecc
->
resampler
=
ms_filter_new
(
MS_RESAMPLE_ID
);
ecc
->
sndwrite
=
ms_snd_card_create_writer
(
ecc
->
capt_card
);
ms_filter_link
(
ecc
->
play
,
0
,
ecc
->
gen
,
0
);
ms_filter_link
(
ecc
->
gen
,
0
,
ecc
->
resampler
,
0
);
ms_filter_link
(
ecc
->
resampler
,
0
,
ecc
->
sndwrite
,
0
);
unsigned
int
rate
;
ms_filter_call_method
(
ecc
->
sndwrite
,
MS_FILTER_SET_SAMPLE_RATE
,
&
ecc
->
rate
);
ms_filter_call_method
(
ecc
->
sndwrite
,
MS_FILTER_GET_SAMPLE_RATE
,
&
rate
);
ms_filter_call_method
(
ecc
->
resampler
,
MS_FILTER_SET_SAMPLE_RATE
,
&
ecc
->
rate
);
ms_filter_call_method
(
ecc
->
resampler
,
MS_FILTER_SET_OUTPUT_SAMPLE_RATE
,
&
rate
);
ms_ticker_attach
(
ecc
->
ticker
,
ecc
->
play
);
...
...
@@ -149,9 +155,10 @@ static void * ecc_thread(void *p){
return
NULL
;
}
EcCalibrator
*
ec_calibrator_new
(
MSSndCard
*
play_card
,
MSSndCard
*
capt_card
,
LinphoneEcCalibrationCallback
cb
,
void
*
cb_data
){
EcCalibrator
*
ec_calibrator_new
(
MSSndCard
*
play_card
,
MSSndCard
*
capt_card
,
unsigned
int
rate
,
LinphoneEcCalibrationCallback
cb
,
void
*
cb_data
){
EcCalibrator
*
ecc
=
ms_new0
(
EcCalibrator
,
1
);
ecc
->
rate
=
rate
;
ecc
->
cb
=
cb
;
ecc
->
cb_data
=
cb_data
;
ecc
->
capt_card
=
capt_card
;
...
...
@@ -174,6 +181,7 @@ int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibration
ms_error
(
"Echo calibration is still on going !"
);
return
-
1
;
}
lc
->
ecc
=
ec_calibrator_new
(
lc
->
sound_conf
.
play_sndcard
,
lc
->
sound_conf
.
capt_sndcard
,
cb
,
cb_data
);
unsigned
int
rate
=
lp_config_get_int
(
lc
->
config
,
"sound"
,
"echo_cancellation_rate"
,
8000
);
lc
->
ecc
=
ec_calibrator_new
(
lc
->
sound_conf
.
play_sndcard
,
lc
->
sound_conf
.
capt_sndcard
,
rate
,
cb
,
cb_data
);
return
0
;
}
coreapi/private.h
View file @
58dca09f
...
...
@@ -472,6 +472,7 @@ struct _EcCalibrator{
int
sent_count
;
int64_t
acc
;
int
delay
;
unsigned
int
rate
;
LinphoneEcCalibratorStatus
status
;
};
...
...
coreapi/test_ecc.c
View file @
58dca09f
...
...
@@ -27,10 +27,21 @@ static void calibration_finished(LinphoneCore *lc, LinphoneEcCalibratorStatus st
if
(
status
==
LinphoneEcCalibratorDone
)
ms_message
(
"Measured delay is %i"
,
delay
);
}
static
char
config_file
[
1024
];
void
parse_args
(
int
argc
,
char
*
argv
[]){
if
(
argc
!=
3
||
strncmp
(
"-c"
,
argv
[
1
],
2
)
||
access
(
argv
[
2
],
F_OK
)
!=
0
)
{
printf
(
"Usage: test_ecc [-c config_file] where config_file will be written with the detected value
\n
"
);
exit
(
-
1
);
}
strncpy
(
config_file
,
argv
[
2
],
1024
);
}
int
main
(
int
argc
,
char
*
argv
[]){
if
(
argc
>
1
)
parse_args
(
argc
,
argv
);
int
count
=
0
;
LinphoneCoreVTable
vtable
=
{
0
};
LinphoneCore
*
lc
=
linphone_core_new
(
&
vtable
,
NULL
,
NULL
,
NULL
);
LinphoneCore
*
lc
=
linphone_core_new
(
&
vtable
,
config_file
,
NULL
,
NULL
);
linphone_core_enable_logs
(
NULL
);
...
...
mediastreamer2
@
45a3e458
Subproject commit
0781bd574fc09a43bcadcb55d8f1563d6493629c
Subproject commit
45a3e458669ae7d3f5537665d7549d82469cf96f
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