Replace most explicit `new RefCountedObject...` with make_ref_counted
Bug: webrtc:12701
Change-Id: Iab91f1e96715eed7f9ddcfe1ca55510a18c817eb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/224544
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35786}
diff --git a/examples/unityplugin/simple_peer_connection.cc b/examples/unityplugin/simple_peer_connection.cc
index 34abbe2..16c580e 100644
--- a/examples/unityplugin/simple_peer_connection.cc
+++ b/examples/unityplugin/simple_peer_connection.cc
@@ -99,7 +99,7 @@
: public webrtc::SetSessionDescriptionObserver {
public:
static DummySetSessionDescriptionObserver* Create() {
- return new rtc::RefCountedObject<DummySetSessionDescriptionObserver>();
+ return rtc::make_ref_counted<DummySetSessionDescriptionObserver>();
}
virtual void OnSuccess() { RTC_LOG(LS_INFO) << __FUNCTION__; }
virtual void OnFailure(webrtc::RTCError error) {
@@ -446,10 +446,9 @@
RTC_DCHECK(texture_helper != nullptr)
<< "Cannot get the Surface Texture Helper.";
- rtc::scoped_refptr<webrtc::jni::AndroidVideoTrackSource> source(
- new rtc::RefCountedObject<webrtc::jni::AndroidVideoTrackSource>(
- g_signaling_thread.get(), env, /* is_screencast= */ false,
- /* align_timestamps= */ true));
+ auto source = rtc::make_ref_counted<webrtc::jni::AndroidVideoTrackSource>(
+ g_signaling_thread.get(), env, /*is_screencast=*/false,
+ /*align_timestamps=*/true);
// link with VideoCapturer (Camera);
jmethodID link_camera_method = webrtc::GetStaticMethodID(
diff --git a/examples/unityplugin/unity_plugin_apis.cc b/examples/unityplugin/unity_plugin_apis.cc
index 34c28d9..672330f 100644
--- a/examples/unityplugin/unity_plugin_apis.cc
+++ b/examples/unityplugin/unity_plugin_apis.cc
@@ -27,7 +27,7 @@
const char* credential,
bool mandatory_receive_video) {
g_peer_connection_map[g_peer_connection_id] =
- new rtc::RefCountedObject<SimplePeerConnection>();
+ rtc::make_ref_counted<SimplePeerConnection>();
if (!g_peer_connection_map[g_peer_connection_id]->InitializePeerConnection(
turn_urls, no_of_urls, username, credential, mandatory_receive_video))