Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mediastreamer2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
mediastreamer2
Commits
a93ef32f
Commit
a93ef32f
authored
Apr 01, 2011
by
jehan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.linphone.org:mediastreamer2
parents
b7f56a4f
8b9173fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
5 deletions
+46
-5
speexec.c
src/speexec.c
+46
-5
No files found.
src/speexec.c
View file @
a93ef32f
...
...
@@ -52,6 +52,47 @@ void audio_flow_controller_set_target(AudioFlowController *ctl, int samples_to_d
ctl
->
current_dropped
=
0
;
}
static
void
discard_well_choosed_samples
(
mblk_t
*
m
,
int
nsamples
,
int
todrop
){
int
i
;
int16_t
*
samples
=
(
int16_t
*
)
m
->
b_rptr
;
int
min_diff
=
32768
;
int
pos
;
if
(
todrop
*
16
>
nsamples
){
ms_warning
(
"Too many samples to drop, using basic algorithm"
);
m
->
b_wptr
-=
todrop
*
2
;
return
;
}
#ifdef TWO_SAMPLES_CRITERIA
for
(
i
=
0
;
i
<
nsamples
-
1
;
++
i
){
int
tmp
=
abs
((
int
)
samples
[
i
]
-
(
int
)
samples
[
i
+
1
]);
#else
for
(
i
=
0
;
i
<
nsamples
-
2
;
++
i
){
int
tmp
=
abs
((
int
)
samples
[
i
]
-
(
int
)
samples
[
i
+
1
])
+
abs
((
int
)
samples
[
i
+
1
]
-
(
int
)
samples
[
i
+
2
]);
#endif
if
(
tmp
<=
min_diff
){
pos
=
i
;
min_diff
=
tmp
;
}
}
/*ms_message("min_diff=%i at pos %i",min_diff, pos);*/
#ifdef TWO_SAMPLES_CRITERIA
memmove
(
samples
+
pos
,
samples
+
pos
+
1
,(
nsamples
-
pos
-
1
)
*
2
);
#else
memmove
(
samples
+
pos
+
1
,
samples
+
pos
+
2
,(
nsamples
-
pos
-
2
)
*
2
);
#endif
todrop
--
;
m
->
b_wptr
-=
2
;
nsamples
--
;
if
(
todrop
>
0
){
/*repeat the same process again*/
discard_well_choosed_samples
(
m
,
nsamples
,
todrop
);
}
}
mblk_t
*
audio_flow_controller_process
(
AudioFlowController
*
ctl
,
mblk_t
*
m
){
if
(
ctl
->
total_samples
>
0
&&
ctl
->
target_samples
>
0
){
int
nsamples
=
(
m
->
b_wptr
-
m
->
b_rptr
)
/
2
;
...
...
@@ -63,8 +104,8 @@ mblk_t * audio_flow_controller_process(AudioFlowController *ctl, mblk_t *m){
todrop
=
th_dropped
-
ctl
->
current_dropped
;
if
(
todrop
>
0
){
if
(
todrop
>
nsamples
)
todrop
=
nsamples
;
m
->
b_wptr
-=
todrop
*
2
;
/
/ms_message("th_dropped=%i, current_dropped=%i, %i samples dropped.",th_dropped,ctl->current_dropped,todrop);
discard_well_choosed_samples
(
m
,
nsamples
,
todrop
)
;
/
*ms_message("th_dropped=%i, current_dropped=%i, %i samples dropped.",th_dropped,ctl->current_dropped,todrop);*/
ctl
->
current_dropped
+=
todrop
;
}
}
...
...
@@ -316,12 +357,12 @@ static int speex_ec_get_bypass_mode(MSFilter *f, void *arg) {
}
static
MSFilterMethod
speex_ec_methods
[]
=
{
{
MS_FILTER_SET_SAMPLE_RATE
,
speex_ec_set_sr
},
{
MS_FILTER_SET_SAMPLE_RATE
,
speex_ec_set_sr
},
{
MS_ECHO_CANCELLER_SET_TAIL_LENGTH
,
speex_ec_set_tail_length
},
{
MS_ECHO_CANCELLER_SET_DELAY
,
speex_ec_set_delay
},
{
MS_ECHO_CANCELLER_SET_FRAMESIZE
,
speex_ec_set_framesize
},
{
MS_ECHO_CANCELLER_SET_BYPASS_MODE
,
speex_ec_set_bypass_mode
},
{
MS_ECHO_CANCELLER_GET_BYPASS_MODE
,
speex_ec_get_bypass_mode
},
{
MS_ECHO_CANCELLER_SET_BYPASS_MODE
,
speex_ec_set_bypass_mode
},
{
MS_ECHO_CANCELLER_GET_BYPASS_MODE
,
speex_ec_get_bypass_mode
}
};
#ifdef _MSC_VER
...
...
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