Commit d0f8f24b authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Switch media_stream_audio_processor.cc to use Blink's cross thread mechanisms

This is a follow up of [1].

[1] https://crrev.com/c/1710237

BUG=704136,923394
R=guidou@chromium.org

Change-Id: I34829b50b263f47cd8d4b6fc9b41df60b57ede0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715164
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681274}
parent bc5b06fa
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "base/bind.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
...@@ -32,6 +31,8 @@ ...@@ -32,6 +31,8 @@
#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/web/modules/webrtc/webrtc_audio_device_impl.h" #include "third_party/blink/public/web/modules/webrtc/webrtc_audio_device_impl.h"
#include "third_party/blink/renderer/platform/mediastream/aec_dump_agent_impl.h" #include "third_party/blink/renderer/platform/mediastream/aec_dump_agent_impl.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/webrtc/api/audio/echo_canceller3_config.h" #include "third_party/webrtc/api/audio/echo_canceller3_config.h"
#include "third_party/webrtc/api/audio/echo_canceller3_config_json.h" #include "third_party/webrtc/api/audio/echo_canceller3_config_json.h"
#include "third_party/webrtc/api/audio/echo_canceller3_factory.h" #include "third_party/webrtc/api/audio/echo_canceller3_factory.h"
...@@ -39,6 +40,17 @@ ...@@ -39,6 +40,17 @@
#include "third_party/webrtc/modules/audio_processing/typing_detection.h" #include "third_party/webrtc/modules/audio_processing/typing_detection.h"
#include "third_party/webrtc_overrides/task_queue_factory.h" #include "third_party/webrtc_overrides/task_queue_factory.h"
namespace WTF {
template <typename T>
struct CrossThreadCopier<rtc::scoped_refptr<T>> {
STATIC_ONLY(CrossThreadCopier);
using Type = rtc::scoped_refptr<T>;
static Type Copy(Type pointer) { return pointer; }
};
} // namespace WTF
namespace blink { namespace blink {
using EchoCancellationType = using EchoCancellationType =
...@@ -727,10 +739,10 @@ int MediaStreamAudioProcessor::ProcessData(const float* const* process_ptrs, ...@@ -727,10 +739,10 @@ int MediaStreamAudioProcessor::ProcessData(const float* const* process_ptrs,
base::subtle::Release_Store(&typing_detected_, typing_detected); base::subtle::Release_Store(&typing_detected_, typing_detected);
} }
main_thread_runner_->PostTask( PostCrossThreadTask(
FROM_HERE, *main_thread_runner_, FROM_HERE,
base::BindOnce(&MediaStreamAudioProcessor::UpdateAecStats, CrossThreadBindOnce(&MediaStreamAudioProcessor::UpdateAecStats,
rtc::scoped_refptr<MediaStreamAudioProcessor>(this))); rtc::scoped_refptr<MediaStreamAudioProcessor>(this)));
// Return 0 if the volume hasn't been changed, and otherwise the new volume. // Return 0 if the volume hasn't been changed, and otherwise the new volume.
const int recommended_volume = ap->recommended_stream_analog_level(); const int recommended_volume = ap->recommended_stream_analog_level();
......
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