Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
f2ddc59e
Commit
f2ddc59e
authored
Sep 22, 2010
by
Simon Morlat
Browse files
set a minimum duration for dtmfs
parent
292e7943
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
src/dtmfgen.c
src/dtmfgen.c
+8
-4
No files found.
src/dtmfgen.c
View file @
f2ddc59e
...
...
@@ -158,10 +158,11 @@ static int dtmfgen_start(MSFilter *f, void *arg){
static
int
dtmfgen_stop
(
MSFilter
*
f
,
void
*
arg
){
DtmfGenState
*
s
=
(
DtmfGenState
*
)
f
->
data
;
int
min_duration
=
(
100
*
s
->
rate
)
/
1000
;
/*wait at least 100 ms*/
ms_filter_lock
(
f
);
s
->
dtmf
=
0
;
s
->
pos
=
0
;
s
->
silence
=
TRAILLING_SILENCE
;
if
(
s
->
pos
<
min_duration
)
s
->
dur
=
min_duration
;
else
s
->
dur
=
0
;
ms_filter_unlock
(
f
);
return
0
;
}
...
...
@@ -180,7 +181,10 @@ static void write_dtmf(DtmfGenState *s , int16_t *sample, int nsamples){
sample
[
i
]
=
(
int16_t
)(
10000
.
0
*
sin
(
2
*
M_PI
*
(
float
)
s
->
pos
*
s
->
lowfreq
));
sample
[
i
]
+=
(
int16_t
)(
10000
.
0
*
sin
(
2
*
M_PI
*
(
float
)
s
->
pos
*
s
->
highfreq
));
}
if
(
s
->
pos
==
s
->
dur
){
for
(;
i
<
nsamples
;
++
i
){
sample
[
i
]
=
0
;
}
if
(
s
->
pos
>=
s
->
dur
){
s
->
pos
=
0
;
s
->
dtmf
=
0
;
s
->
silence
=
TRAILLING_SILENCE
;
...
...
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