Commit 24abc909 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Move MediaStreamAudioProcessor out of the Blink exposed API

... down to renderer/platform/mediastream.

The .cc and test_.cc respective files also got moved from
renderer/platform/export/mediastream to renderer/platform/mediastrea/.

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

Change-Id: Ia981d447b28e2b7ad5bcadba3abb13ebc4111f2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1739388
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#684348}
parent 81c87131
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "third_party/webrtc/rtc_base/ref_counted_object.h"
namespace content { namespace content {
......
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
#include <vector> #include <vector>
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/scoped_refptr.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "media/base/audio_parameters.h" #include "media/base/audio_parameters.h"
#include "media/base/audio_push_fifo.h" #include "media/base/audio_push_fifo.h"
#include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_level_calculator.h" #include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_level_calculator.h"
#include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor.h"
#include "third_party/blink/public/platform/modules/mediastream/web_media_stream_audio_sink.h" #include "third_party/blink/public/platform/modules/mediastream/web_media_stream_audio_sink.h"
#include "third_party/webrtc/api/media_stream_interface.h" #include "third_party/webrtc/api/media_stream_interface.h"
#include "third_party/webrtc/pc/media_stream_track.h" #include "third_party/webrtc/pc/media_stream_track.h"
......
...@@ -144,7 +144,6 @@ source_set("blink_headers") { ...@@ -144,7 +144,6 @@ source_set("blink_headers") {
"platform/modules/mediastream/aec_dump_agent_impl_delegate.h", "platform/modules/mediastream/aec_dump_agent_impl_delegate.h",
"platform/modules/mediastream/media_stream_audio_deliverer.h", "platform/modules/mediastream/media_stream_audio_deliverer.h",
"platform/modules/mediastream/media_stream_audio_level_calculator.h", "platform/modules/mediastream/media_stream_audio_level_calculator.h",
"platform/modules/mediastream/media_stream_audio_processor.h",
"platform/modules/mediastream/media_stream_audio_processor_options.h", "platform/modules/mediastream/media_stream_audio_processor_options.h",
"platform/modules/mediastream/media_stream_audio_source.h", "platform/modules/mediastream/media_stream_audio_source.h",
"platform/modules/mediastream/media_stream_audio_track.h", "platform/modules/mediastream/media_stream_audio_track.h",
......
...@@ -18,13 +18,13 @@ ...@@ -18,13 +18,13 @@
#include "media/webrtc/audio_processor_controls.h" #include "media/webrtc/audio_processor_controls.h"
#include "media/webrtc/webrtc_switches.h" #include "media/webrtc/webrtc_switches.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-blink.h" #include "third_party/blink/public/mojom/mediastream/media_stream.mojom-blink.h"
#include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor.h"
#include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h" #include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h"
#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/web/modules/mediastream/media_stream_constraints_util.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_constraints_util.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/modules/mediastream/media_stream_local_frame_wrapper.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_local_frame_wrapper.h"
#include "third_party/blink/renderer/platform/mediastream/audio_service_audio_processor_proxy.h" #include "third_party/blink/renderer/platform/mediastream/audio_service_audio_processor_proxy.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_audio_processor.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.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/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/webrtc/media/base/media_channel.h" #include "third_party/webrtc/media/base/media_channel.h"
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "services/service_manager/public/cpp/interface_provider.h" #include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/common/mediastream/media_stream_controls.h" #include "third_party/blink/public/common/mediastream/media_stream_controls.h"
#include "third_party/blink/public/common/mediastream/media_stream_request.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h"
#include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor.h"
#include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_source.h" #include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_source.h"
#include "third_party/blink/public/platform/modules/mediastream/webrtc_uma_histograms.h" #include "third_party/blink/public/platform/modules/mediastream/webrtc_uma_histograms.h"
#include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h" #include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h"
...@@ -43,6 +42,7 @@ ...@@ -43,6 +42,7 @@
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.h"
#include "third_party/blink/renderer/modules/mediastream/user_media_client_impl.h" #include "third_party/blink/renderer/modules/mediastream/user_media_client_impl.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_audio_processor.h"
#include "third_party/blink/renderer/platform/video_capture/local_video_capturer_source.h" #include "third_party/blink/renderer/platform/video_capture/local_video_capturer_source.h"
#include "third_party/blink/renderer/platform/wtf/wtf_size_t.h" #include "third_party/blink/renderer/platform/wtf/wtf_size_t.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
......
...@@ -473,7 +473,6 @@ jumbo_component("platform") { ...@@ -473,7 +473,6 @@ jumbo_component("platform") {
"exported/file_path_conversion.cc", "exported/file_path_conversion.cc",
"exported/interface_registry.cc", "exported/interface_registry.cc",
"exported/mediastream/media_stream_audio_level_calculator.cc", "exported/mediastream/media_stream_audio_level_calculator.cc",
"exported/mediastream/media_stream_audio_processor.cc",
"exported/mediastream/media_stream_audio_processor_options.cc", "exported/mediastream/media_stream_audio_processor_options.cc",
"exported/mediastream/media_stream_audio_source.cc", "exported/mediastream/media_stream_audio_source.cc",
"exported/mediastream/media_stream_audio_track.cc", "exported/mediastream/media_stream_audio_track.cc",
...@@ -1193,6 +1192,8 @@ jumbo_component("platform") { ...@@ -1193,6 +1192,8 @@ jumbo_component("platform") {
"mediastream/aec_dump_agent_impl.h", "mediastream/aec_dump_agent_impl.h",
"mediastream/audio_service_audio_processor_proxy.cc", "mediastream/audio_service_audio_processor_proxy.cc",
"mediastream/audio_service_audio_processor_proxy.h", "mediastream/audio_service_audio_processor_proxy.h",
"mediastream/media_stream_audio_processor.cc",
"mediastream/media_stream_audio_processor.h",
"mediastream/media_stream_component.cc", "mediastream/media_stream_component.cc",
"mediastream/media_stream_component.h", "mediastream/media_stream_component.h",
"mediastream/media_stream_descriptor.cc", "mediastream/media_stream_descriptor.cc",
...@@ -1641,7 +1642,6 @@ jumbo_source_set("blink_platform_unittests_sources") { ...@@ -1641,7 +1642,6 @@ jumbo_source_set("blink_platform_unittests_sources") {
"bindings/runtime_call_stats_test.cc", "bindings/runtime_call_stats_test.cc",
"exported/file_path_conversion_test.cc", "exported/file_path_conversion_test.cc",
"exported/mediastream/media_stream_audio_processor_options_test.cc", "exported/mediastream/media_stream_audio_processor_options_test.cc",
"exported/mediastream/media_stream_audio_processor_test.cc",
"exported/mediastream/media_stream_audio_test.cc", "exported/mediastream/media_stream_audio_test.cc",
"exported/mediastream/webrtc_uma_histograms_test.cc", "exported/mediastream/webrtc_uma_histograms_test.cc",
"exported/video_capture/web_video_capture_impl_manager_test.cc", "exported/video_capture/web_video_capture_impl_manager_test.cc",
...@@ -1760,6 +1760,7 @@ jumbo_source_set("blink_platform_unittests_sources") { ...@@ -1760,6 +1760,7 @@ jumbo_source_set("blink_platform_unittests_sources") {
"loader/cors/cors_test.cc", "loader/cors/cors_test.cc",
"mac/graphics_context_canvas_test.mm", "mac/graphics_context_canvas_test.mm",
"media/webaudiosourceprovider_impl_test.cc", "media/webaudiosourceprovider_impl_test.cc",
"mediastream/media_stream_audio_processor_test.cc",
"mhtml/mhtml_parser_test.cc", "mhtml/mhtml_parser_test.cc",
"mojo/big_string_mojom_traits_test.cc", "mojo/big_string_mojom_traits_test.cc",
"mojo/geometry_mojom_traits_test.cc", "mojo/geometry_mojom_traits_test.cc",
......
include_rules = [ include_rules = [
"+base/metrics/field_trial.h",
"+base/path_service.h",
"+base/strings/string_number_conversions.h",
"+media/base", "+media/base",
"+media/webrtc/webrtc_switches.h",
] ]
specific_include_rules = { specific_include_rules = {
......
...@@ -6,11 +6,18 @@ include_rules = [ ...@@ -6,11 +6,18 @@ include_rules = [
"+third_party/blink/renderer/platform/mediastream", "+third_party/blink/renderer/platform/mediastream",
# Dependencies. # Dependencies.
"+media/base/audio_processing.h", "+base/atomicops.h",
"+base/metrics/field_trial.h",
"+base/path_service.h",
"+base/strings/string_number_conversions.h",
"+media/base",
"+media/webrtc/audio_delay_stats_reporter.h",
"+media/webrtc/audio_processor_controls.h",
"+media/webrtc/webrtc_switches.h",
"+third_party/blink/renderer/platform/audio", "+third_party/blink/renderer/platform/audio",
"+third_party/blink/renderer/platform/heap", "+third_party/blink/renderer/platform/heap",
"+third_party/blink/renderer/platform/platform_export.h", "+third_party/blink/renderer/platform/platform_export.h",
"+third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h",
"+third_party/blink/renderer/platform/wtf/uuid.h", "+third_party/blink/renderer/platform/wtf/uuid.h",
"+third_party/blink/renderer/platform/wtf", "+third_party/blink/renderer/platform/wtf",
"+media/webrtc/audio_processor_controls.h",
] ]
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_audio_processor.h"
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIASTREAM_MEDIA_STREAM_AUDIO_PROCESSOR_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_MEDIASTREAM_MEDIA_STREAM_AUDIO_PROCESSOR_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIASTREAM_MEDIA_STREAM_AUDIO_PROCESSOR_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_MEDIASTREAM_MEDIA_STREAM_AUDIO_PROCESSOR_H_
#include <memory> #include <memory>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "third_party/blink/public/platform/modules/mediastream/aec_dump_agent_impl_delegate.h" #include "third_party/blink/public/platform/modules/mediastream/aec_dump_agent_impl_delegate.h"
#include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor_options.h" #include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor_options.h"
#include "third_party/blink/public/platform/modules/webrtc/webrtc_source.h" #include "third_party/blink/public/platform/modules/webrtc/webrtc_source.h"
#include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/webrtc/api/media_stream_interface.h" #include "third_party/webrtc/api/media_stream_interface.h"
#include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h"
#include "third_party/webrtc/rtc_base/task_queue.h" #include "third_party/webrtc/rtc_base/task_queue.h"
...@@ -48,11 +48,8 @@ using webrtc::AudioProcessorInterface; ...@@ -48,11 +48,8 @@ using webrtc::AudioProcessorInterface;
// processing components like AGC, AEC and NS. It enables the components based // processing components like AGC, AEC and NS. It enables the components based
// on the getUserMedia constraints, processes the data and outputs it in a unit // on the getUserMedia constraints, processes the data and outputs it in a unit
// of 10 ms data chunk. // of 10 ms data chunk.
// class PLATFORM_EXPORT MediaStreamAudioProcessor
// TODO(crbug.com/704136): Move this class out of the Blink exposed API : public WebRtcPlayoutDataSource::Sink,
// when all users of it have been Onion souped.
class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor
: public blink::WebRtcPlayoutDataSource::Sink,
public AudioProcessorInterface, public AudioProcessorInterface,
public AecDumpAgentImplDelegate { public AecDumpAgentImplDelegate {
public: public:
...@@ -62,9 +59,8 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor ...@@ -62,9 +59,8 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor
// //
// Threading note: The constructor assumes it is being run on the main render // Threading note: The constructor assumes it is being run on the main render
// thread. // thread.
MediaStreamAudioProcessor( MediaStreamAudioProcessor(const AudioProcessingProperties& properties,
const blink::AudioProcessingProperties& properties, WebRtcPlayoutDataSource* playout_data_source);
blink::WebRtcPlayoutDataSource* playout_data_source);
// Called when the format of the capture data has changed. // Called when the format of the capture data has changed.
// Called on the main render thread. The caller is responsible for stopping // Called on the main render thread. The caller is responsible for stopping
...@@ -117,8 +113,7 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor ...@@ -117,8 +113,7 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor
// based on |properties|. If the audio signal would not be modified, there is // based on |properties|. If the audio signal would not be modified, there is
// no need to instantiate a MediaStreamAudioProcessor and feed audio through // no need to instantiate a MediaStreamAudioProcessor and feed audio through
// it. Doing so would waste a non-trivial amount of memory and CPU resources. // it. Doing so would waste a non-trivial amount of memory and CPU resources.
static bool WouldModifyAudio( static bool WouldModifyAudio(const AudioProcessingProperties& properties);
const blink::AudioProcessingProperties& properties);
protected: protected:
~MediaStreamAudioProcessor() override; ~MediaStreamAudioProcessor() override;
...@@ -129,7 +124,7 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor ...@@ -129,7 +124,7 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor
FRIEND_TEST_ALL_PREFIXES(MediaStreamAudioProcessorTest, FRIEND_TEST_ALL_PREFIXES(MediaStreamAudioProcessorTest,
GetAecDumpMessageFilter); GetAecDumpMessageFilter);
// blink::WebRtcPlayoutDataSource::Sink implementation. // WebRtcPlayoutDataSource::Sink implementation.
void OnPlayoutData(media::AudioBus* audio_bus, void OnPlayoutData(media::AudioBus* audio_bus,
int sample_rate, int sample_rate,
int audio_delay_milliseconds) override; int audio_delay_milliseconds) override;
...@@ -141,7 +136,7 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor ...@@ -141,7 +136,7 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor
// Helper to initialize the WebRtc AudioProcessing. // Helper to initialize the WebRtc AudioProcessing.
void InitializeAudioProcessingModule( void InitializeAudioProcessingModule(
const blink::AudioProcessingProperties& properties); const AudioProcessingProperties& properties);
// Helper to initialize the capture converter. // Helper to initialize the capture converter.
void InitializeCaptureFifo(const media::AudioParameters& input_format); void InitializeCaptureFifo(const media::AudioParameters& input_format);
...@@ -185,11 +180,11 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor ...@@ -185,11 +180,11 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor
media::AudioParameters input_format_; media::AudioParameters input_format_;
media::AudioParameters output_format_; media::AudioParameters output_format_;
// Raw pointer to the blink::WebRtcPlayoutDataSource, which is valid for the // Raw pointer to the WebRtcPlayoutDataSource, which is valid for the
// lifetime of RenderThread. // lifetime of RenderThread.
// //
// TODO(crbug.com/704136): Replace with Member at some point. // TODO(crbug.com/704136): Replace with Member at some point.
blink::WebRtcPlayoutDataSource* playout_data_source_; WebRtcPlayoutDataSource* playout_data_source_;
// Task runner for the main render thread. // Task runner for the main render thread.
const scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_; const scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_;
...@@ -224,4 +219,4 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor ...@@ -224,4 +219,4 @@ class BLINK_PLATFORM_EXPORT MediaStreamAudioProcessor
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIASTREAM_MEDIA_STREAM_AUDIO_PROCESSOR_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_MEDIASTREAM_MEDIA_STREAM_AUDIO_PROCESSOR_H_
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/mediastream/media_stream_request.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h"
#include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor.h"
#include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor_options.h" #include "third_party/blink/public/platform/modules/mediastream/media_stream_audio_processor_options.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" #include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/public/platform/web_media_constraints.h" #include "third_party/blink/public/platform/web_media_constraints.h"
#include "third_party/blink/public/web/modules/mediastream/mock_constraint_factory.h" #include "third_party/blink/public/web/modules/mediastream/mock_constraint_factory.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/media_stream_audio_processor.h"
#include "third_party/webrtc/api/media_stream_interface.h" #include "third_party/webrtc/api/media_stream_interface.h"
#include "third_party/webrtc/rtc_base/ref_counted_object.h" #include "third_party/webrtc/rtc_base/ref_counted_object.h"
......
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