Delete deprecated StartRtcEventLog override with PlatformFile

Bug: webrtc:6463
Change-Id: I57c2372a232d72b054d8e3e4f423e11b3fb22430
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/134460
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28131}
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 784101e..d389298 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -907,6 +907,7 @@
         ":videotoolbox_objc",
         "../api:create_peerconnection_factory",
         "../api:libjingle_peerconnection_api",
+        "../api:rtc_event_log_output_file",
         "../api:rtc_stats_api",
         "../api:scoped_refptr",
         "../api/audio_codecs:audio_codecs_api",
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index 722d0b9..69f59d9 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -777,6 +777,7 @@
       ":native_api_stacktrace",
       "..:media_constraints",
       "../../api:libjingle_peerconnection_api",
+      "../../api:rtc_event_log_output_file",
       "../../api/video_codecs:video_codecs_api",
       "../../logging:rtc_event_log_api",
       "../../logging:rtc_event_log_impl_base",
diff --git a/sdk/android/src/jni/pc/peer_connection.cc b/sdk/android/src/jni/pc/peer_connection.cc
index bd50f5b..98c3dd0 100644
--- a/sdk/android/src/jni/pc/peer_connection.cc
+++ b/sdk/android/src/jni/pc/peer_connection.cc
@@ -34,11 +34,13 @@
 
 #include "absl/memory/memory.h"
 #include "api/peer_connection_interface.h"
+#include "api/rtc_event_log_output_file.h"
 #include "api/rtp_receiver_interface.h"
 #include "api/rtp_sender_interface.h"
 #include "api/rtp_transceiver_interface.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
+#include "rtc_base/numerics/safe_conversions.h"
 #include "sdk/android/generated_peerconnection_jni/jni/PeerConnection_jni.h"
 #include "sdk/android/native_api/jni/java_types.h"
 #include "sdk/android/src/jni/jni_helpers.h"
@@ -741,8 +743,12 @@
     const JavaParamRef<jobject>& j_pc,
     int file_descriptor,
     int max_size_bytes) {
-  return ExtractNativePC(jni, j_pc)->StartRtcEventLog(file_descriptor,
-                                                      max_size_bytes);
+  // TODO(eladalon): It would be better to not allow negative values into PC.
+  const size_t max_size = (max_size_bytes < 0)
+                              ? RtcEventLog::kUnlimitedOutput
+                              : rtc::saturated_cast<size_t>(max_size_bytes);
+  return ExtractNativePC(jni, j_pc)->StartRtcEventLog(
+      absl::make_unique<RtcEventLogOutputFile>(file_descriptor, max_size));
 }
 
 static void JNI_PeerConnection_StopRtcEventLog(
diff --git a/sdk/objc/api/peerconnection/RTCPeerConnection.mm b/sdk/objc/api/peerconnection/RTCPeerConnection.mm
index 8189aec..bed85f9 100644
--- a/sdk/objc/api/peerconnection/RTCPeerConnection.mm
+++ b/sdk/objc/api/peerconnection/RTCPeerConnection.mm
@@ -30,7 +30,9 @@
 
 #include "api/jsep_ice_candidate.h"
 #include "api/media_transport_interface.h"
+#include "api/rtc_event_log_output_file.h"
 #include "rtc_base/checks.h"
+#include "rtc_base/numerics/safe_conversions.h"
 
 NSString * const kRTCPeerConnectionErrorDomain =
     @"org.webrtc.RTCPeerConnection";
@@ -540,8 +542,12 @@
     RTCLogError(@"Error opening file: %@. Error: %d", filePath, errno);
     return NO;
   }
-  _hasStartedRtcEventLog =
-      _peerConnection->StartRtcEventLog(fd, maxSizeInBytes);
+  // TODO(eladalon): It would be better to not allow negative values into PC.
+  const size_t max_size = (maxSizeInBytes < 0) ? webrtc::RtcEventLog::kUnlimitedOutput :
+                                                 rtc::saturated_cast<size_t>(maxSizeInBytes);
+
+  _hasStartedRtcEventLog = _peerConnection->StartRtcEventLog(
+      absl::make_unique<webrtc::RtcEventLogOutputFile>(fd, max_size));
   return _hasStartedRtcEventLog;
 }