Delete deprecated call_factory and media_engine

from PeerConnectionFactoryDependencies

Bug: webrtc:15574
Change-Id: Id0ead8086ddd41f6792e2a3c224d8705cd797d49
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/326003
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41309}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index dd54224..ee16257 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -319,7 +319,6 @@
     ":array_view",
     ":async_dns_resolver",
     ":audio_options_api",
-    ":callfactory_api",
     ":candidate",
     ":dtls_transport_interface",
     ":fec_controller_api",
diff --git a/api/peer_connection_interface.cc b/api/peer_connection_interface.cc
index 33d9755..dedfd35 100644
--- a/api/peer_connection_interface.cc
+++ b/api/peer_connection_interface.cc
@@ -60,13 +60,8 @@
 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;
diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h
index 5286cc9..74c4702 100644
--- a/api/peer_connection_interface.h
+++ b/api/peer_connection_interface.h
@@ -84,7 +84,6 @@
 #include "api/audio_codecs/audio_decoder_factory.h"
 #include "api/audio_codecs/audio_encoder_factory.h"
 #include "api/audio_options.h"
-#include "api/call/call_factory_interface.h"
 #include "api/candidate.h"
 #include "api/crypto/crypto_options.h"
 #include "api/data_channel_interface.h"
@@ -1425,10 +1424,6 @@
   // 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): 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>
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index b816b9c..e9549cd 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -317,7 +317,6 @@
 rtc_source_set("media_factory") {
   sources = [ "media_factory.h" ]
   deps = [
-    "../api:callfactory_api",
     "../api/environment",
     "../call:call_interfaces",
     "../media:rtc_media_base",
@@ -1541,6 +1540,7 @@
     "../p2p:rtc_p2p",
     "../pc:audio_track",
     "../pc:connection_context",
+    "../pc:media_factory",
     "../pc:media_stream",
     "../pc:rtp_parameters_conversion",
     "../pc:session_description",
diff --git a/pc/connection_context.cc b/pc/connection_context.cc
index 75d95a9..df4522b 100644
--- a/pc/connection_context.cc
+++ b/pc/connection_context.cc
@@ -81,18 +81,6 @@
 rtc::scoped_refptr<ConnectionContext> ConnectionContext::Create(
     const Environment& env,
     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(env, dependencies));
 }
@@ -117,19 +105,11 @@
           dependencies->media_factory != nullptr
               ? dependencies->media_factory->CreateMediaEngine(env_,
                                                                *dependencies)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-              : std::move(dependencies->media_engine)),
-#pragma clang diagnostic pop
+              : nullptr),
       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
+      call_factory_(std::move(dependencies->media_factory)),
       default_socket_factory_(std::move(dependencies->packet_socket_factory)),
       sctp_factory_(
           MaybeCreateSctpFactory(std::move(dependencies->sctp_factory),
diff --git a/pc/connection_context.h b/pc/connection_context.h
index e66df9f..893a3b0 100644
--- a/pc/connection_context.h
+++ b/pc/connection_context.h
@@ -96,7 +96,7 @@
     RTC_DCHECK_RUN_ON(signaling_thread_);
     return default_socket_factory_.get();
   }
-  CallFactoryInterface* call_factory() {
+  MediaFactory* call_factory() {
     RTC_DCHECK_RUN_ON(worker_thread());
     return call_factory_.get();
   }
@@ -143,7 +143,7 @@
       RTC_GUARDED_BY(signaling_thread_);
   std::unique_ptr<rtc::NetworkManager> default_network_manager_
       RTC_GUARDED_BY(signaling_thread_);
-  std::unique_ptr<CallFactoryInterface> const call_factory_
+  std::unique_ptr<MediaFactory> const call_factory_
       RTC_GUARDED_BY(worker_thread());
 
   std::unique_ptr<rtc::PacketSocketFactory> default_socket_factory_
diff --git a/pc/media_factory.h b/pc/media_factory.h
index 2ca2a1f..c867846 100644
--- a/pc/media_factory.h
+++ b/pc/media_factory.h
@@ -13,7 +13,6 @@
 
 #include <memory>
 
-#include "api/call/call_factory_interface.h"
 #include "api/environment/environment.h"
 #include "call/call.h"
 #include "call/call_config.h"
@@ -31,13 +30,11 @@
 
 // Interface repsponsible for constructing media specific classes for
 // PeerConnectionFactory and PeerConnection.
-// TODO(bugs.webrtc.org/15574): Delete CallFactoryInterface inheritance
-// when call_factory is removed from PeerConnectionFactoryDependencies.
-class MediaFactory : public CallFactoryInterface {
+class MediaFactory {
  public:
   virtual ~MediaFactory() = default;
 
-  std::unique_ptr<Call> CreateCall(const CallConfig& config) override = 0;
+  virtual std::unique_ptr<Call> CreateCall(const CallConfig& config) = 0;
   virtual std::unique_ptr<cricket::MediaEngineInterface> CreateMediaEngine(
       const Environment& env,
       PeerConnectionFactoryDependencies& dependencies) = 0;
diff --git a/pc/peer_connection_factory.cc b/pc/peer_connection_factory.cc
index db2f031..8ce44d3 100644
--- a/pc/peer_connection_factory.cc
+++ b/pc/peer_connection_factory.cc
@@ -14,7 +14,6 @@
 #include <utility>
 
 #include "absl/strings/match.h"
-#include "api/call/call_factory_interface.h"
 #include "api/environment/environment.h"
 #include "api/environment/environment_factory.h"
 #include "api/fec_controller.h"
@@ -34,6 +33,7 @@
 #include "p2p/client/basic_port_allocator.h"
 #include "pc/audio_track.h"
 #include "pc/local_audio_source.h"
+#include "pc/media_factory.h"
 #include "pc/media_stream.h"
 #include "pc/media_stream_proxy.h"
 #include "pc/media_stream_track_proxy.h"