Commit 7a7b211a authored by Oskar Sundbom's avatar Oskar Sundbom Committed by Commit Bot

Remove DC component from BeepingSource

The current generator is maintaining a value of 0 when silent and
varying between 0 and 128 when beeping. As it generates unsigned 8 bit
audio, this means it's stuck at the lowest value when silent, rather
than at the mid-point. This has confused a test.

Bug: 892534
Change-Id: I4bf5d676ef58e0443716213a5650baacf3f11b8c
Reviewed-on: https://chromium-review.googlesource.com/c/1430074Reviewed-by: default avatarMax Morin <maxmorin@chromium.org>
Commit-Queue: Oskar Sundbom <ossu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626103}
parent 822effcf
......@@ -263,7 +263,7 @@ int BeepingSource::OnMoreData(base::TimeDelta /* delay */,
// Accumulate the time from the last beep.
interval_from_last_beep_ += base::TimeTicks::Now() - last_callback_time_;
memset(buffer_.get(), 0, buffer_size_);
memset(buffer_.get(), 128, buffer_size_);
bool should_beep = false;
BeepContext* beep_context = GetBeepContext();
if (beep_context->automatic_beep()) {
......@@ -291,7 +291,7 @@ int BeepingSource::OnMoreData(base::TimeDelta /* delay */,
int position = 0;
while (position + high_bytes <= buffer_size_) {
// Write high values first.
memset(buffer_.get() + position, 128, high_bytes);
memset(buffer_.get() + position, 255, high_bytes);
// Then leave low values in the buffer with |high_bytes|.
position += high_bytes * 2;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment