Allow the headset mode to be entered after the call has started

This CL adds a timeout for the detection of the headset mode that
allows it to be entered also for the cases where a headset is
inserted during the call.

Bug: chromium:826720,webrtc:9083
Change-Id: Ic3cb4cc0258997a74eccd1bcdf65765e44016ad8
Reviewed-on: https://webrtc-review.googlesource.com/65240
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22658}
This commit is contained in:
Per Åhgren 2018-03-28 18:13:41 +02:00 committed by Commit Bot
parent 251c7355aa
commit 8131eb0667
2 changed files with 14 additions and 0 deletions

View File

@ -167,6 +167,12 @@ void AecState::Update(
blocks_since_converged_filter_ =
converged_filter ? 0 : blocks_since_converged_filter_ + 1;
}
if (converged_filter) {
active_blocks_since_converged_filter_ = 0;
} else if (active_render_block) {
++active_blocks_since_converged_filter_;
}
bool recently_converged_filter =
blocks_since_converged_filter_ < 60 * kNumBlocksPerSecond;
@ -198,6 +204,13 @@ void AecState::Update(
converged_filter_seen_ = converged_filter_seen_ || converged_filter;
// If no filter convergence is seen for a long time, reset the estimated
// properties of the echo path.
if (active_blocks_since_converged_filter_ > 60 * kNumBlocksPerSecond) {
converged_filter_seen_ = false;
finite_erl_ = false;
}
// After an amount of active render samples for which an echo should have been
// detected in the capture signal if the ERL was not infinite, flag that a
// transparent mode should be entered.

View File

@ -175,6 +175,7 @@ class AecState {
bool external_delay_seen_ = false;
size_t converged_filter_count_ = 0;
bool finite_erl_ = false;
size_t active_blocks_since_converged_filter_ = 0;
RTC_DISALLOW_COPY_AND_ASSIGN(AecState);
};