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
bd00a4df
Commit
bd00a4df
authored
Nov 02, 2015
by
Simon Morlat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve echo calibration user experience.
parent
057bf043
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
14 deletions
+33
-14
coreapi/ec-calibrator.c
coreapi/ec-calibrator.c
+27
-9
tools/test_ecc.c
tools/test_ecc.c
+6
-5
No files found.
coreapi/ec-calibrator.c
View file @
bd00a4df
...
...
@@ -114,8 +114,10 @@ static void ecc_deinit_filters(EcCalibrator *ecc){
static
void
on_tone_sent
(
void
*
data
,
MSFilter
*
f
,
unsigned
int
event_id
,
void
*
arg
){
MSDtmfGenEvent
*
ev
=
(
MSDtmfGenEvent
*
)
arg
;
EcCalibrator
*
ecc
=
(
EcCalibrator
*
)
data
;
ecc
->
acc
-=
ev
->
tone_start_time
;
ms_message
(
"Sent tone at %u"
,(
unsigned
int
)
ev
->
tone_start_time
);
if
(
ev
->
tone_name
[
0
]
!=
'\0'
){
ecc
->
acc
-=
ev
->
tone_start_time
;
ms_message
(
"Sent tone at %u"
,(
unsigned
int
)
ev
->
tone_start_time
);
}
}
static
bool_t
is_valid_tone
(
EcCalibrator
*
ecc
,
MSToneDetectorEvent
*
ev
){
...
...
@@ -159,21 +161,21 @@ static void ecc_play_tones(EcCalibrator *ecc){
/* configure the tones to be scanned */
strncpy
(
expected_tone
.
tone_name
,
"freq1"
,
sizeof
(
expected_tone
.
tone_name
));
expected_tone
.
frequency
=
2
000
;
expected_tone
.
frequency
=
2
349
.
32
;
expected_tone
.
min_duration
=
40
;
expected_tone
.
min_amplitude
=
0
.
1
f
;
ms_filter_call_method
(
ecc
->
det
,
MS_TONE_DETECTOR_ADD_SCAN
,
&
expected_tone
);
strncpy
(
expected_tone
.
tone_name
,
"freq2"
,
sizeof
(
expected_tone
.
tone_name
));
expected_tone
.
frequency
=
2
300
;
expected_tone
.
frequency
=
2
637
.
02
;
expected_tone
.
min_duration
=
40
;
expected_tone
.
min_amplitude
=
0
.
1
f
;
ms_filter_call_method
(
ecc
->
det
,
MS_TONE_DETECTOR_ADD_SCAN
,
&
expected_tone
);
strncpy
(
expected_tone
.
tone_name
,
"freq3"
,
sizeof
(
expected_tone
.
tone_name
));
expected_tone
.
frequency
=
2
500
;
expected_tone
.
frequency
=
2
093
;
expected_tone
.
min_duration
=
40
;
expected_tone
.
min_amplitude
=
0
.
1
f
;
...
...
@@ -191,20 +193,36 @@ static void ecc_play_tones(EcCalibrator *ecc){
ms_filter_add_notify_callback
(
ecc
->
gen
,
on_tone_sent
,
ecc
,
TRUE
);
/* play the three tones*/
tone
.
frequencies
[
0
]
=
2
000
;
strncpy
(
tone
.
tone_name
,
"D"
,
sizeof
(
tone
.
tone_name
));
tone
.
frequencies
[
0
]
=
2
349
.
32
;
tone
.
duration
=
100
;
ms_filter_call_method
(
ecc
->
gen
,
MS_DTMF_GEN_PLAY_CUSTOM
,
&
tone
);
ms_usleep
(
300000
);
tone
.
frequencies
[
0
]
=
2300
;
strncpy
(
tone
.
tone_name
,
"E"
,
sizeof
(
tone
.
tone_name
));
tone
.
frequencies
[
0
]
=
2637
.
02
;
tone
.
duration
=
100
;
ms_filter_call_method
(
ecc
->
gen
,
MS_DTMF_GEN_PLAY_CUSTOM
,
&
tone
);
ms_usleep
(
300000
);
tone
.
frequencies
[
0
]
=
2500
;
strncpy
(
tone
.
tone_name
,
"C"
,
sizeof
(
tone
.
tone_name
));
tone
.
frequencies
[
0
]
=
2093
;
tone
.
duration
=
100
;
ms_filter_call_method
(
ecc
->
gen
,
MS_DTMF_GEN_PLAY_CUSTOM
,
&
tone
);
ms_usleep
(
300000
);
/*these two next ones are for lyrism*/
tone
.
tone_name
[
0
]
=
'\0'
;
tone
.
frequencies
[
0
]
=
1046
.
5
;
tone
.
duration
=
400
;
ms_filter_call_method
(
ecc
->
gen
,
MS_DTMF_GEN_PLAY_CUSTOM
,
&
tone
);
ms_usleep
(
300000
);
tone
.
tone_name
[
0
]
=
'\0'
;
tone
.
frequencies
[
0
]
=
1567
.
98
;
tone
.
duration
=
400
;
ms_filter_call_method
(
ecc
->
gen
,
MS_DTMF_GEN_PLAY_CUSTOM
,
&
tone
);
ms_sleep
(
1
);
if
(
ecc
->
freq1
&&
ecc
->
freq2
&&
ecc
->
freq3
)
{
...
...
tools/test_ecc.c
View file @
bd00a4df
...
...
@@ -23,14 +23,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if _MSC_VER
#include <io.h>
#endif
static
int
done
=
0
;
static
void
calibration_finished
(
LinphoneCore
*
lc
,
LinphoneEcCalibratorStatus
status
,
int
delay
,
void
*
data
)
{
ms_message
(
"echo calibration finished %s."
,
status
==
LinphoneEcCalibratorDone
?
"successfully"
:
"with faillure"
);
if
(
status
==
LinphoneEcCalibratorDone
)
ms_message
(
"Measured delay is %i"
,
delay
);
done
=
1
;
}
static
char
config_file
[
1024
];
static
char
config_file
[
1024
]
=
{
0
}
;
void
parse_args
(
int
argc
,
char
*
argv
[])
{
#ifndef F_OK
#define F_OK 4
...
...
@@ -43,20 +45,19 @@ void parse_args(int argc, char *argv[]) {
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
count
=
0
;
LinphoneCoreVTable
vtable
=
{
0
};
LinphoneCore
*
lc
;
if
(
argc
>
1
)
parse_args
(
argc
,
argv
);
lc
=
linphone_core_new
(
&
vtable
,
config_file
,
NULL
,
NULL
);
lc
=
linphone_core_new
(
&
vtable
,
config_file
[
0
]
?
config_file
:
NULL
,
NULL
,
NULL
);
linphone_core_enable_logs
(
NULL
);
linphone_core_start_echo_calibration
(
lc
,
calibration_finished
,
NULL
,
NULL
,
NULL
);
while
(
count
++
<
1000
)
{
while
(
!
done
)
{
linphone_core_iterate
(
lc
);
ms_usleep
(
1
0000
);
ms_usleep
(
2
0000
);
}
linphone_core_destroy
(
lc
);
return
0
;
...
...
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