Commit f05f36fd authored by Henrik Grunell's avatar Henrik Grunell Committed by Commit Bot

Fix AEC3 override to set once only when creating MediaStreamAudioProcessor.

* Add AecDumpMessageFilter::GetOverrideAec3().
* Don't set aec3 in AecDumpMessageFilter::AddDelegate().
* Instead, get the override value before init in MSAP.
* In init, the override value is already honored, although that was always not set before this fix.

Bug: 791016
Change-Id: I0d58ab3dac13321b4a686b6f726c449930b185d5
Reviewed-on: https://chromium-review.googlesource.com/803486Reviewed-by: default avatarMax Morin <maxmorin@chromium.org>
Commit-Queue: Henrik Grunell <grunell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520958}
parent c700d60c
......@@ -48,10 +48,6 @@ void AecDumpMessageFilter::AddDelegate(
int id = delegate_id_counter_++;
delegates_[id] = delegate;
if (override_aec3_) {
delegate->OnAec3Enable(*override_aec3_);
}
io_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&AecDumpMessageFilter::RegisterAecDumpConsumer, this, id));
......@@ -72,6 +68,11 @@ void AecDumpMessageFilter::RemoveDelegate(
id));
}
base::Optional<bool> AecDumpMessageFilter::GetOverrideAec3() const {
DCHECK(main_task_runner_->BelongsToCurrentThread());
return override_aec3_;
}
void AecDumpMessageFilter::Send(IPC::Message* message) {
DCHECK(io_task_runner_->BelongsToCurrentThread());
if (sender_)
......
......@@ -8,6 +8,7 @@
#include <memory>
#include "base/macros.h"
#include "base/optional.h"
#include "content/common/content_export.h"
#include "content/renderer/render_thread_impl.h"
#include "ipc/ipc_platform_file.h"
......@@ -40,10 +41,13 @@ class CONTENT_EXPORT AecDumpMessageFilter : public IPC::MessageFilter {
// Getter for the one AecDumpMessageFilter object.
static scoped_refptr<AecDumpMessageFilter> Get();
// Adds a delegate that receives the enable and disable notifications.
// Adds a delegate that receives the enable and disable notifications. Must be
// called on the main task runner (|main_task_runner| in constructor). All
// calls on |delegate| are done on the main task runner.
void AddDelegate(AecDumpMessageFilter::AecDumpDelegate* delegate);
// Removes a delegate.
// Removes a delegate. Must be called on the main task runner
// (|main_task_runner| in constructor).
void RemoveDelegate(AecDumpMessageFilter::AecDumpDelegate* delegate);
// IO task runner associated with this message filter.
......@@ -51,6 +55,10 @@ class CONTENT_EXPORT AecDumpMessageFilter : public IPC::MessageFilter {
return io_task_runner_;
}
// Returns the AEC3 setting. Must be called on the main task runner
// (|main_task_runner| in constructor).
base::Optional<bool> GetOverrideAec3() const;
protected:
~AecDumpMessageFilter() override;
......
......@@ -320,12 +320,17 @@ MediaStreamAudioProcessor::MediaStreamAudioProcessor(
DCHECK(main_thread_runner_);
capture_thread_checker_.DetachFromThread();
render_thread_checker_.DetachFromThread();
InitializeAudioProcessingModule(properties);
aec_dump_message_filter_ = AecDumpMessageFilter::Get();
// In unit tests not creating a message filter, |aec_dump_message_filter_|
// will be NULL. We can just ignore that. Other unit tests and browser tests
// ensure that we do get the filter when we should.
// will be null. We can just ignore that below. Other unit tests and browser
// tests ensure that we do get the filter when we should.
aec_dump_message_filter_ = AecDumpMessageFilter::Get();
if (aec_dump_message_filter_)
override_aec3_ = aec_dump_message_filter_->GetOverrideAec3();
InitializeAudioProcessingModule(properties);
if (aec_dump_message_filter_.get())
aec_dump_message_filter_->AddDelegate(this);
......
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