Commit 7f3a130c authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Reorganize blink/public/platform/modules/peerconnection code

This CL is a follow up of guidou's remark in [1].

[1] https://crrev.com/c/1778669/1#message-7497fe86eae4a796099d9e76acfce6cc7312f69a

It basically:

- moves rtc_video_decoder_factory.h and rtc_video_encoder_factory.h
  from third_party/blink/public/platform/modules/peerconnection to
  third_party/blink/renderer/platform/peerconnection/.

- add util files rtc_video_decoder_factory_util.h and
  rtc_video_encoder_factory_util.h to
  third_party/blink/public/platform/modules/peerconnection.

- change content/renderer/media/webrtc/video_codec_factory.cc
  code accordingly.

BUG=787254
R=guidou@chromium.org, haraken@chromium.org

Change-Id: I601be5a4f2dd74f40d42d2ac1a766a76d4a0e1c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1782429
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693101}
parent d352eddd
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "media/base/media_switches.h" #include "media/base/media_switches.h"
#include "third_party/blink/public/platform/modules/peerconnection/rtc_video_decoder_factory.h" #include "third_party/blink/public/platform/modules/peerconnection/rtc_video_decoder_factory_util.h"
#include "third_party/blink/public/platform/modules/peerconnection/rtc_video_encoder_factory.h" #include "third_party/blink/public/platform/modules/peerconnection/rtc_video_encoder_factory_util.h"
#include "third_party/webrtc/api/video_codecs/video_decoder_software_fallback_wrapper.h" #include "third_party/webrtc/api/video_codecs/video_decoder_software_fallback_wrapper.h"
#include "third_party/webrtc/api/video_codecs/video_encoder_software_fallback_wrapper.h" #include "third_party/webrtc/api/video_codecs/video_encoder_software_fallback_wrapper.h"
#include "third_party/webrtc/media/base/codec.h" #include "third_party/webrtc/media/base/codec.h"
...@@ -181,7 +181,7 @@ std::unique_ptr<webrtc::VideoEncoderFactory> CreateWebrtcVideoEncoderFactory( ...@@ -181,7 +181,7 @@ std::unique_ptr<webrtc::VideoEncoderFactory> CreateWebrtcVideoEncoderFactory(
const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
if (gpu_factories && gpu_factories->IsGpuVideoAcceleratorEnabled() && if (gpu_factories && gpu_factories->IsGpuVideoAcceleratorEnabled() &&
!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { !cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) {
encoder_factory.reset(new blink::RTCVideoEncoderFactory(gpu_factories)); encoder_factory = blink::CreateRTCVideoEncoderFactory(gpu_factories);
} }
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -199,7 +199,7 @@ std::unique_ptr<webrtc::VideoDecoderFactory> CreateWebrtcVideoDecoderFactory( ...@@ -199,7 +199,7 @@ std::unique_ptr<webrtc::VideoDecoderFactory> CreateWebrtcVideoDecoderFactory(
const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
if (gpu_factories && gpu_factories->IsGpuVideoAcceleratorEnabled() && if (gpu_factories && gpu_factories->IsGpuVideoAcceleratorEnabled() &&
!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) { !cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) {
decoder_factory.reset(new blink::RTCVideoDecoderFactory(gpu_factories)); decoder_factory = blink::CreateRTCVideoDecoderFactory(gpu_factories);
} }
return std::make_unique<DecoderAdapter>(std::move(decoder_factory)); return std::make_unique<DecoderAdapter>(std::move(decoder_factory));
......
...@@ -159,8 +159,8 @@ source_set("blink_headers") { ...@@ -159,8 +159,8 @@ source_set("blink_headers") {
"platform/modules/peerconnection/audio_codec_factory.h", "platform/modules/peerconnection/audio_codec_factory.h",
"platform/modules/peerconnection/rtc_event_log_output_sink.h", "platform/modules/peerconnection/rtc_event_log_output_sink.h",
"platform/modules/peerconnection/rtc_event_log_output_sink_proxy_util.h", "platform/modules/peerconnection/rtc_event_log_output_sink_proxy_util.h",
"platform/modules/peerconnection/rtc_video_decoder_factory.h", "platform/modules/peerconnection/rtc_video_decoder_factory_util.h",
"platform/modules/peerconnection/rtc_video_encoder_factory.h", "platform/modules/peerconnection/rtc_video_encoder_factory_util.h",
"platform/modules/peerconnection/two_keys_adapter_map.h", "platform/modules/peerconnection/two_keys_adapter_map.h",
"platform/modules/peerconnection/webrtc_audio_sink.h", "platform/modules/peerconnection/webrtc_audio_sink.h",
"platform/modules/peerconnection/webrtc_util.h", "platform/modules/peerconnection/webrtc_util.h",
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PEERCONNECTION_RTC_VIDEO_DECODER_FACTORY_UTIL_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PEERCONNECTION_RTC_VIDEO_DECODER_FACTORY_UTIL_H_
#include <memory>
#include "third_party/blink/public/platform/web_common.h"
namespace media {
class GpuVideoAcceleratorFactories;
}
namespace webrtc {
class VideoDecoderFactory;
}
namespace blink {
// TODO(crbug.com/787254): Remove this API when its clients are Onion souped.
BLINK_PLATFORM_EXPORT std::unique_ptr<webrtc::VideoDecoderFactory>
CreateRTCVideoDecoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories);
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PEERCONNECTION_RTC_VIDEO_DECODER_FACTORY_UTIL_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PEERCONNECTION_RTC_VIDEO_ENCODER_FACTORY_UTIL_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PEERCONNECTION_RTC_VIDEO_ENCODER_FACTORY_UTIL_H_
#include <memory>
#include "third_party/blink/public/platform/web_common.h"
namespace media {
class GpuVideoAcceleratorFactories;
}
namespace webrtc {
class VideoEncoderFactory;
}
namespace blink {
// TODO(crbug.com/787254): Remove this API when its clients are Onion souped.
BLINK_PLATFORM_EXPORT std::unique_ptr<webrtc::VideoEncoderFactory>
CreateRTCVideoEncoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories);
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PEERCONNECTION_RTC_VIDEO_ENCODER_FACTORY_UTIL_H_
...@@ -1239,9 +1239,11 @@ jumbo_component("platform") { ...@@ -1239,9 +1239,11 @@ jumbo_component("platform") {
"peerconnection/rtc_video_decoder_adapter.cc", "peerconnection/rtc_video_decoder_adapter.cc",
"peerconnection/rtc_video_decoder_adapter.h", "peerconnection/rtc_video_decoder_adapter.h",
"peerconnection/rtc_video_decoder_factory.cc", "peerconnection/rtc_video_decoder_factory.cc",
"peerconnection/rtc_video_decoder_factory.h",
"peerconnection/rtc_video_encoder.cc", "peerconnection/rtc_video_encoder.cc",
"peerconnection/rtc_video_encoder.h", "peerconnection/rtc_video_encoder.h",
"peerconnection/rtc_video_encoder_factory.cc", "peerconnection/rtc_video_encoder_factory.cc",
"peerconnection/rtc_video_encoder_factory.h",
"peerconnection/rtc_void_request.h", "peerconnection/rtc_void_request.h",
"peerconnection/webrtc_audio_sink.cc", "peerconnection/webrtc_audio_sink.cc",
"peerconnection/webrtc_video_track_source.cc", "peerconnection/webrtc_video_track_source.cc",
......
...@@ -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/peerconnection/rtc_video_decoder_factory.h" #include "third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.h"
#include <memory> #include <memory>
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "media/video/gpu_video_accelerator_factories.h" #include "media/video/gpu_video_accelerator_factories.h"
#include "third_party/blink/public/platform/modules/peerconnection/rtc_video_decoder_factory_util.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_adapter.h" #include "third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_adapter.h"
namespace blink { namespace blink {
...@@ -58,6 +59,11 @@ class ScopedVideoDecoder : public webrtc::VideoDecoder { ...@@ -58,6 +59,11 @@ class ScopedVideoDecoder : public webrtc::VideoDecoder {
} // namespace } // namespace
std::unique_ptr<webrtc::VideoDecoderFactory> CreateRTCVideoDecoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories) {
return std::make_unique<RTCVideoDecoderFactory>(gpu_factories);
}
RTCVideoDecoderFactory::RTCVideoDecoderFactory( RTCVideoDecoderFactory::RTCVideoDecoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories) media::GpuVideoAcceleratorFactories* gpu_factories)
: gpu_factories_(gpu_factories) { : gpu_factories_(gpu_factories) {
......
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
// 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_PEERCONNECTION_RTC_VIDEO_DECODER_FACTORY_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_VIDEO_DECODER_FACTORY_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PEERCONNECTION_RTC_VIDEO_DECODER_FACTORY_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_VIDEO_DECODER_FACTORY_H_
#include "base/macros.h" #include "base/macros.h"
#include "third_party/blink/public/platform/web_common.h"
#include "third_party/webrtc/api/video_codecs/video_decoder_factory.h" #include "third_party/webrtc/api/video_codecs/video_decoder_factory.h"
#include "third_party/webrtc/modules/video_coding/include/video_codec_interface.h" #include "third_party/webrtc/modules/video_coding/include/video_codec_interface.h"
...@@ -21,11 +20,7 @@ class GpuVideoAcceleratorFactories; ...@@ -21,11 +20,7 @@ class GpuVideoAcceleratorFactories;
namespace blink { namespace blink {
// TODO(wuchengli): add unittest. // TODO(wuchengli): add unittest.
// class RTCVideoDecoderFactory : public webrtc::VideoDecoderFactory {
// TODO(crbug.com/787254): Move this class out of the Blink exposed API when its
// clients get Onion soup'ed. Also, switch away from using std::vector.
class BLINK_PLATFORM_EXPORT RTCVideoDecoderFactory
: public webrtc::VideoDecoderFactory {
public: public:
explicit RTCVideoDecoderFactory( explicit RTCVideoDecoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories); media::GpuVideoAcceleratorFactories* gpu_factories);
...@@ -46,4 +41,4 @@ class BLINK_PLATFORM_EXPORT RTCVideoDecoderFactory ...@@ -46,4 +41,4 @@ class BLINK_PLATFORM_EXPORT RTCVideoDecoderFactory
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PEERCONNECTION_RTC_VIDEO_DECODER_FACTORY_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_VIDEO_DECODER_FACTORY_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/peerconnection/rtc_video_encoder_factory.h" #include "third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_factory.h"
#include <memory> #include <memory>
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "media/media_buildflags.h" #include "media/media_buildflags.h"
#include "media/video/gpu_video_accelerator_factories.h" #include "media/video/gpu_video_accelerator_factories.h"
#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/modules/peerconnection/rtc_video_encoder_factory_util.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.h" #include "third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.h"
#include "third_party/webrtc/api/video_codecs/sdp_video_format.h" #include "third_party/webrtc/api/video_codecs/sdp_video_format.h"
#include "third_party/webrtc/api/video_codecs/video_encoder.h" #include "third_party/webrtc/api/video_codecs/video_encoder.h"
...@@ -103,6 +104,11 @@ bool IsSameFormat(const webrtc::SdpVideoFormat& format1, ...@@ -103,6 +104,11 @@ bool IsSameFormat(const webrtc::SdpVideoFormat& format1,
} // anonymous namespace } // anonymous namespace
std::unique_ptr<webrtc::VideoEncoderFactory> CreateRTCVideoEncoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories) {
return std::make_unique<RTCVideoEncoderFactory>(gpu_factories);
}
RTCVideoEncoderFactory::RTCVideoEncoderFactory( RTCVideoEncoderFactory::RTCVideoEncoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories) media::GpuVideoAcceleratorFactories* gpu_factories)
: gpu_factories_(gpu_factories) { : gpu_factories_(gpu_factories) {
......
...@@ -2,15 +2,14 @@ ...@@ -2,15 +2,14 @@
// 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_PEERCONNECTION_RTC_VIDEO_ENCODER_FACTORY_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_VIDEO_ENCODER_FACTORY_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PEERCONNECTION_RTC_VIDEO_ENCODER_FACTORY_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_VIDEO_ENCODER_FACTORY_H_
#include <vector> #include <vector>
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "media/base/video_codecs.h" #include "media/base/video_codecs.h"
#include "third_party/blink/public/platform/web_common.h"
#include "third_party/webrtc/api/video_codecs/video_encoder_factory.h" #include "third_party/webrtc/api/video_codecs/video_encoder_factory.h"
namespace media { namespace media {
...@@ -21,11 +20,7 @@ namespace blink { ...@@ -21,11 +20,7 @@ namespace blink {
// This class creates RTCVideoEncoder instances (each wrapping a // This class creates RTCVideoEncoder instances (each wrapping a
// media::VideoEncodeAccelerator) on behalf of the WebRTC stack. // media::VideoEncodeAccelerator) on behalf of the WebRTC stack.
// class RTCVideoEncoderFactory : public webrtc::VideoEncoderFactory {
// TODO(crbug.com/787254): Move this class out of the Blink exposed API
// when all users of it have been Onion souped.
class BLINK_PLATFORM_EXPORT RTCVideoEncoderFactory
: public webrtc::VideoEncoderFactory {
public: public:
explicit RTCVideoEncoderFactory( explicit RTCVideoEncoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories); media::GpuVideoAcceleratorFactories* gpu_factories);
...@@ -52,4 +47,4 @@ class BLINK_PLATFORM_EXPORT RTCVideoEncoderFactory ...@@ -52,4 +47,4 @@ class BLINK_PLATFORM_EXPORT RTCVideoEncoderFactory
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_PEERCONNECTION_RTC_VIDEO_ENCODER_FACTORY_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_VIDEO_ENCODER_FACTORY_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