Delete deprecated CreatePeerConnection functions

Bug: webrtc:41480877
Change-Id: I6bc64031187d6cba8a66a97984bd92ae29521ebe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376420
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43886}
This commit is contained in:
Danil Chapovalov 2025-02-12 17:02:06 +01:00 committed by WebRTC LUCI CQ
parent d964a5444a
commit 29e62c84ac
4 changed files with 1 additions and 87 deletions

View File

@ -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",
]

View File

@ -10,16 +10,7 @@
#include "api/peer_connection_interface.h"
#include <memory>
#include <utility>
#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<PeerConnectionInterface>
PeerConnectionFactoryInterface::CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
std::unique_ptr<cricket::PortAllocator> allocator,
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> 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<PeerConnectionInterface>
PeerConnectionFactoryInterface::CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
PeerConnectionDependencies dependencies) {
auto result =
CreatePeerConnectionOrError(configuration, std::move(dependencies));
if (!result.ok()) {
return nullptr;
}
return result.MoveValue();
}
RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>
PeerConnectionFactoryInterface::CreatePeerConnectionOrError(
const PeerConnectionInterface::RTCConfiguration& /* configuration */,
PeerConnectionDependencies /* dependencies */) {
return RTCError(RTCErrorType::INTERNAL_ERROR);
}
} // namespace webrtc

View File

@ -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<rtc::scoped_refptr<PeerConnectionInterface>>
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<PeerConnectionInterface> 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<PeerConnectionInterface> CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
std::unique_ptr<cricket::PortAllocator> allocator,
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> 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.

View File

@ -13,7 +13,6 @@
#include <cstdint>
#include <cstdio>
#include <memory>
#include <string>
#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<PeerConnectionInterface>,
CreatePeerConnection,
(const PeerConnectionInterface::RTCConfiguration&,
PeerConnectionDependencies),
(override));
MOCK_METHOD(RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>,
CreatePeerConnectionOrError,
(const PeerConnectionInterface::RTCConfiguration&,
PeerConnectionDependencies),
(override));
MOCK_METHOD(rtc::scoped_refptr<PeerConnectionInterface>,
CreatePeerConnection,
(const PeerConnectionInterface::RTCConfiguration&,
std::unique_ptr<cricket::PortAllocator>,
std::unique_ptr<rtc::RTCCertificateGeneratorInterface>,
PeerConnectionObserver*),
(override));
MOCK_METHOD(RtpCapabilities,
GetRtpSenderCapabilities,
(cricket::MediaType),