From 29e62c84ac453ef8d83482287789cdfdd0842605 Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Wed, 12 Feb 2025 17:02:06 +0100 Subject: [PATCH] Delete deprecated CreatePeerConnection functions Bug: webrtc:41480877 Change-Id: I6bc64031187d6cba8a66a97984bd92ae29521ebe Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376420 Commit-Queue: Danil Chapovalov Auto-Submit: Danil Chapovalov Reviewed-by: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#43886} --- api/BUILD.gn | 2 - api/peer_connection_interface.cc | 45 ------------------- api/peer_connection_interface.h | 26 +---------- .../mock_peer_connection_factory_interface.h | 15 ------- 4 files changed, 1 insertion(+), 87 deletions(-) diff --git a/api/BUILD.gn b/api/BUILD.gn index 6b82e9076c..010695ac33 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -1338,9 +1338,7 @@ if (rtc_include_tests) { ":rtc_error", ":rtp_parameters", ":scoped_refptr", - "../p2p:port_allocator", "../rtc_base:refcount", - "../rtc_base:rtc_certificate_generator", "../test:test_support", "//third_party/abseil-cpp/absl/strings:string_view", ] diff --git a/api/peer_connection_interface.cc b/api/peer_connection_interface.cc index 695267ca9e..947ecc62a6 100644 --- a/api/peer_connection_interface.cc +++ b/api/peer_connection_interface.cc @@ -10,16 +10,7 @@ #include "api/peer_connection_interface.h" -#include -#include - -#include "api/media_types.h" -#include "api/rtc_error.h" -#include "api/rtp_parameters.h" -#include "api/scoped_refptr.h" -#include "p2p/base/port_allocator.h" #include "pc/media_factory.h" -#include "rtc_base/rtc_certificate_generator.h" namespace webrtc { @@ -78,40 +69,4 @@ PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies( PeerConnectionFactoryDependencies::~PeerConnectionFactoryDependencies() = default; -rtc::scoped_refptr -PeerConnectionFactoryInterface::CreatePeerConnection( - const PeerConnectionInterface::RTCConfiguration& configuration, - std::unique_ptr allocator, - std::unique_ptr cert_generator, - PeerConnectionObserver* observer) { - PeerConnectionDependencies dependencies(observer); - dependencies.allocator = std::move(allocator); - dependencies.cert_generator = std::move(cert_generator); - auto result = - CreatePeerConnectionOrError(configuration, std::move(dependencies)); - if (!result.ok()) { - return nullptr; - } - return result.MoveValue(); -} - -rtc::scoped_refptr -PeerConnectionFactoryInterface::CreatePeerConnection( - const PeerConnectionInterface::RTCConfiguration& configuration, - PeerConnectionDependencies dependencies) { - auto result = - CreatePeerConnectionOrError(configuration, std::move(dependencies)); - if (!result.ok()) { - return nullptr; - } - return result.MoveValue(); -} - -RTCErrorOr> -PeerConnectionFactoryInterface::CreatePeerConnectionOrError( - const PeerConnectionInterface::RTCConfiguration& /* configuration */, - PeerConnectionDependencies /* dependencies */) { - return RTCError(RTCErrorType::INTERNAL_ERROR); -} - } // namespace webrtc diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h index 9bd250ec45..4b9d6e1fd8 100644 --- a/api/peer_connection_interface.h +++ b/api/peer_connection_interface.h @@ -1539,34 +1539,10 @@ class RTC_EXPORT PeerConnectionFactoryInterface // The preferred way to create a new peer connection. Simply provide the // configuration and a PeerConnectionDependencies structure. - // TODO(benwright): Make pure virtual once downstream mock PC factory classes - // are updated. virtual RTCErrorOr> CreatePeerConnectionOrError( const PeerConnectionInterface::RTCConfiguration& configuration, - PeerConnectionDependencies dependencies); - // Deprecated creator - does not return an error code on error. - // TODO(bugs.webrtc.org:12238): Deprecate and remove. - ABSL_DEPRECATED("Use CreatePeerConnectionOrError") - virtual rtc::scoped_refptr CreatePeerConnection( - const PeerConnectionInterface::RTCConfiguration& configuration, - PeerConnectionDependencies dependencies); - - // Deprecated; `allocator` and `cert_generator` may be null, in which case - // default implementations will be used. - // - // `observer` must not be null. - // - // Note that this method does not take ownership of `observer`; it's the - // responsibility of the caller to delete it. It can be safely deleted after - // Close has been called on the returned PeerConnection, which ensures no - // more observer callbacks will be invoked. - ABSL_DEPRECATED("Use CreatePeerConnectionOrError") - virtual rtc::scoped_refptr CreatePeerConnection( - const PeerConnectionInterface::RTCConfiguration& configuration, - std::unique_ptr allocator, - std::unique_ptr cert_generator, - PeerConnectionObserver* observer); + PeerConnectionDependencies dependencies) = 0; // Returns the capabilities of an RTP sender of type `kind`. // If for some reason you pass in MEDIA_TYPE_DATA, returns an empty structure. diff --git a/api/test/mock_peer_connection_factory_interface.h b/api/test/mock_peer_connection_factory_interface.h index 4551266f20..2d46fe63e3 100644 --- a/api/test/mock_peer_connection_factory_interface.h +++ b/api/test/mock_peer_connection_factory_interface.h @@ -13,7 +13,6 @@ #include #include -#include #include #include "absl/strings/string_view.h" @@ -24,9 +23,7 @@ #include "api/rtc_error.h" #include "api/rtp_parameters.h" #include "api/scoped_refptr.h" -#include "p2p/base/port_allocator.h" #include "rtc_base/ref_counted_object.h" -#include "rtc_base/rtc_certificate_generator.h" #include "test/gmock.h" namespace webrtc { @@ -40,23 +37,11 @@ class MockPeerConnectionFactoryInterface } MOCK_METHOD(void, SetOptions, (const Options&), (override)); - MOCK_METHOD(rtc::scoped_refptr, - CreatePeerConnection, - (const PeerConnectionInterface::RTCConfiguration&, - PeerConnectionDependencies), - (override)); MOCK_METHOD(RTCErrorOr>, CreatePeerConnectionOrError, (const PeerConnectionInterface::RTCConfiguration&, PeerConnectionDependencies), (override)); - MOCK_METHOD(rtc::scoped_refptr, - CreatePeerConnection, - (const PeerConnectionInterface::RTCConfiguration&, - std::unique_ptr, - std::unique_ptr, - PeerConnectionObserver*), - (override)); MOCK_METHOD(RtpCapabilities, GetRtpSenderCapabilities, (cricket::MediaType),