Skip to content

Commit

Permalink
Chrome-wide echo cancellation: Normalize playback delay calculation
Browse files Browse the repository at this point in the history
Removing delay correction from audio::MixingGraphImpl::OnMoreData(), since
the delay is not corrected like that in other places, and so we can't
reliably compare it with the control group.

See https://bugs.chromium.org/p/chromium/issues/detail?id=1328769#c3 for
detail.

(cherry picked from commit 40a85a5)

Bug: 1328769
Change-Id: Ieb160b505c91b54aa07eacd7e10c04f3c8f0fbef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3689424
Auto-Submit: Olga Sharonova <olka@chromium.org>
Commit-Queue: Olga Sharonova <olka@chromium.org>
Reviewed-by: Sam Zackrisson <saza@chromium.org>
Commit-Queue: Sam Zackrisson <saza@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1010536}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3687722
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5060@{#657}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
Olga Sharonova authored and SumaliSonchai committed Jun 7, 2022
1 parent 108769b commit fbf2ac3
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions services/audio/mixing_graph_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,25 +229,21 @@ int MixingGraphImpl::OnMoreData(base::TimeDelta delay,
"MixingGraphImpl::OnMoreData", "delay", delay,
"delay_timestamp", delay_timestamp);

// The expected playout time is |delay_timestamp| + |delay|.
base::TimeDelta total_delay = delay_timestamp + delay - start_time;
if (total_delay < base::TimeDelta())
total_delay = base::TimeDelta();

uint32_t frames_delayed = media::AudioTimestampHelper::TimeToFrames(
total_delay, output_params_.sample_rate());
delay, output_params_.sample_rate());

{
base::AutoLock scoped_lock(lock_);
main_converter_.ConvertWithDelay(frames_delayed, dest);
}

SanitizeOutput(dest);

on_more_data_cb_.Run(*dest, total_delay);
on_more_data_cb_.Run(*dest, delay);

TRACE_EVENT_END2(TRACE_DISABLED_BY_DEFAULT("audio"),
"MixingGraphImpl::OnMoreData", "total_delay", total_delay,
"frames_delayed", frames_delayed);
TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("audio"),
"MixingGraphImpl::OnMoreData", "frames_delayed",
frames_delayed);
overtime_logger_->Log(start_time);
return dest->frames();
}
Expand Down

0 comments on commit fbf2ac3

Please sign in to comment.