Commit fbd4b763 authored by Chris Hamilton's avatar Chris Hamilton Committed by Commit Bot

Fix pepper audio input.

The migration in https://crrev.com/5075457e9b changed the task runner
that |main_task_runner_| was bound to. This in turn caused the
check

  base::ThreadTaskRunnerHandle::Get().get() != main_task_runner_

to always return true, meaning stream events were never processed.

Modifying this to check

  main_task_runner_->BelongsToCurrentThread()

fixes the infinite dispatch issue.

BUG=1150822

Change-Id: Ia5699d94424ff56a6ce6f0333370c17ff2b786ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2559313Reviewed-by: default avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Chris Hamilton <chrisha@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830861}
parent 498f4a02
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/check_op.h" #include "base/check_op.h"
#include "base/location.h" #include "base/location.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/child/child_process.h" #include "content/child/child_process.h"
#include "content/renderer/pepper/pepper_audio_input_host.h" #include "content/renderer/pepper/pepper_audio_input_host.h"
...@@ -90,7 +89,10 @@ void PepperPlatformAudioInput::OnStreamCreated( ...@@ -90,7 +89,10 @@ void PepperPlatformAudioInput::OnStreamCreated(
#endif #endif
DCHECK_GT(shared_memory_region.GetSize(), 0u); DCHECK_GT(shared_memory_region.GetSize(), 0u);
if (base::ThreadTaskRunnerHandle::Get().get() != main_task_runner_.get()) { // If we're not on the main thread then bounce over to it. Don't use
// base::ThreadTaskRunnerHandle::Get() as |main_task_runner_| will never
// match that. See crbug.com/1150822.
if (!main_task_runner_->BelongsToCurrentThread()) {
// If shutdown has occurred, |client_| will be NULL and the handles will be // If shutdown has occurred, |client_| will be NULL and the handles will be
// cleaned up on the main thread. // cleaned up on the main thread.
main_task_runner_->PostTask( main_task_runner_->PostTask(
......
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