Deprecate call_factory and media_engine in PeerConnectionFactoryDependencies

Bug: webrtc:15574
Change-Id: Ia97ad0853196fea5c20fc0c0d58a9305b72c515b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/326001
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41088}
This commit is contained in:
Danil Chapovalov 2023-11-06 15:32:56 +01:00 committed by WebRTC LUCI CQ
parent 0873faae00
commit 2b58ec2938
6 changed files with 30 additions and 9 deletions

View File

@ -34,7 +34,9 @@ class CallFactoryInterface {
virtual std::unique_ptr<Call> CreateCall(const CallConfig& config) = 0;
};
RTC_EXPORT std::unique_ptr<CallFactoryInterface> CreateCallFactory();
[[deprecated("bugs.webrtc.org/15574")]] //
RTC_EXPORT std::unique_ptr<CallFactoryInterface>
CreateCallFactory();
} // namespace webrtc

View File

@ -60,8 +60,13 @@ PeerConnectionDependencies::~PeerConnectionDependencies() = default;
PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies() =
default;
// TODO(bugs.webrtc.org/15574): Remove pragma once call_factory and media_engine
// are removed from PeerConnectionFactoryDependencies
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies(
PeerConnectionFactoryDependencies&&) = default;
#pragma clang diagnostic pop
PeerConnectionFactoryDependencies::~PeerConnectionFactoryDependencies() =
default;

View File

@ -1432,10 +1432,10 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final {
// called without a `port_allocator`.
std::unique_ptr<rtc::PacketSocketFactory> packet_socket_factory;
std::unique_ptr<TaskQueueFactory> task_queue_factory;
// TODO(bugs.webrtc.org/15574): Deprecate `media_engine` and `call_factory`
// when chromium and webrtc are updated to use `media_factory` instead.
std::unique_ptr<cricket::MediaEngineInterface> media_engine;
std::unique_ptr<CallFactoryInterface> call_factory;
// TODO(bugs.webrtc.org/15574): Delete `media_engine` and `call_factory`
// after 2023-12-01
[[deprecated]] std::unique_ptr<cricket::MediaEngineInterface> media_engine;
[[deprecated]] std::unique_ptr<CallFactoryInterface> call_factory;
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory;
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory;
std::unique_ptr<NetworkStatePredictorFactoryInterface>

View File

@ -63,10 +63,9 @@ struct MediaEngineDependencies {
// CreateMediaEngine may be called on any thread, though the engine is
// only expected to be used on one thread, internally called the "worker
// thread". This is the thread Init must be called on.
// TODO(bugs.webrtc.org/15574): Deprecate this helper in favor of creating
// media engine with `PeerConnectionFactoryDependencies::media_factory`.
RTC_EXPORT std::unique_ptr<MediaEngineInterface> CreateMediaEngine(
MediaEngineDependencies dependencies);
[[deprecated("bugs.webrtc.org/15574")]] //
RTC_EXPORT std::unique_ptr<MediaEngineInterface>
CreateMediaEngine(MediaEngineDependencies dependencies);
// Verify that extension IDs are within 1-byte extension range and are not
// overlapping, and that they form a legal change from previously registerd

View File

@ -322,6 +322,9 @@ TEST(WebRtcMediaEngineTest, FilterRtpExtensionsRemoveRedundantBwe3) {
EXPECT_EQ(RtpExtension::kTimestampOffsetUri, filtered[0].uri);
}
// Deprecated as part of the bugs.webrtc.org/15574 effort.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
TEST(WebRtcMediaEngineTest, Create) {
MediaEngineDependencies deps;
webrtc::DeprecatedSetMediaEngineDefaults(&deps);
@ -333,5 +336,6 @@ TEST(WebRtcMediaEngineTest, Create) {
EXPECT_TRUE(engine);
}
#pragma clang diagnostic pop
} // namespace cricket

View File

@ -79,12 +79,17 @@ std::unique_ptr<SctpTransportFactoryInterface> MaybeCreateSctpFactory(
// Static
rtc::scoped_refptr<ConnectionContext> ConnectionContext::Create(
PeerConnectionFactoryDependencies* dependencies) {
// TODO(bugs.webrtc.org/15574): Remove when call_factory and media_engine
// are removed from PeerConnectionFactoryDependencies
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (dependencies->media_factory != nullptr) {
RTC_CHECK(dependencies->media_engine == nullptr)
<< "media_factory replaces media_engine. Do not set media_engine.";
RTC_CHECK(dependencies->call_factory == nullptr)
<< "media_factory replaces call_factory. Do not set call_factory.";
}
#pragma clang diagnostic pop
return rtc::scoped_refptr<ConnectionContext>(
new ConnectionContext(dependencies));
@ -109,13 +114,19 @@ ConnectionContext::ConnectionContext(
media_engine_(
dependencies->media_factory != nullptr
? dependencies->media_factory->CreateMediaEngine(*dependencies)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
: std::move(dependencies->media_engine)),
#pragma clang diagnostic pop
network_monitor_factory_(
std::move(dependencies->network_monitor_factory)),
default_network_manager_(std::move(dependencies->network_manager)),
call_factory_(dependencies->media_factory != nullptr
? std::move(dependencies->media_factory)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
: std::move(dependencies->call_factory)),
#pragma clang diagnostic pop
default_socket_factory_(std::move(dependencies->packet_socket_factory)),
sctp_factory_(
MaybeCreateSctpFactory(std::move(dependencies->sctp_factory),