From e4ac723bdc75ed7cfc5bfa15cfb09b0c966ab361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Mon, 24 Jun 2019 09:39:56 +0200 Subject: [PATCH] Delete deprecated version of PeerConnectionFactoryInterface::StartAecDump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:6463 Change-Id: Ia60c34f7e1c9f3bb3f18417c7b621ba033e2ab5d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/141668 Reviewed-by: Karl Wiberg Reviewed-by: Kári Helgason Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#28395} --- api/DEPS | 3 --- api/peer_connection_factory_proxy.h | 1 - api/peer_connection_interface.h | 5 ----- pc/peer_connection_factory.cc | 11 ----------- pc/peer_connection_factory.h | 1 - sdk/android/src/jni/pc/peer_connection_factory.cc | 10 ++++++++-- .../api/peerconnection/RTCPeerConnectionFactory.mm | 8 ++++---- 7 files changed, 12 insertions(+), 27 deletions(-) diff --git a/api/DEPS b/api/DEPS index 32440b1c91..f49cd810be 100644 --- a/api/DEPS +++ b/api/DEPS @@ -122,7 +122,6 @@ specific_include_rules = { "+p2p/base/port_allocator.h", "+rtc_base/bitrate_allocation_strategy.h", "+rtc_base/network.h", - "+rtc_base/platform_file.h", "+rtc_base/rtc_certificate.h", "+rtc_base/rtc_certificate_generator.h", "+rtc_base/socket_address.h", @@ -148,8 +147,6 @@ specific_include_rules = { "+rtc_base/logging.h", ], "rtc_event_log_output_file.h": [ - # TODO(bugs.webrtc.org/6463): Delete this dependency. - "+rtc_base/platform_file.h", # For private member and constructor. "+rtc_base/system/file_wrapper.h", ], diff --git a/api/peer_connection_factory_proxy.h b/api/peer_connection_factory_proxy.h index b61a78291c..e33fb457ae 100644 --- a/api/peer_connection_factory_proxy.h +++ b/api/peer_connection_factory_proxy.h @@ -57,7 +57,6 @@ PROXY_METHOD2(rtc::scoped_refptr, const std::string&, AudioSourceInterface*) PROXY_METHOD2(bool, StartAecDump, FILE*, int64_t) -PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t) PROXY_METHOD0(void, StopAecDump) END_PROXY_MAP() diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h index c2e2f50cdc..92b0561113 100644 --- a/api/peer_connection_interface.h +++ b/api/peer_connection_interface.h @@ -108,7 +108,6 @@ // TODO(nisse): The interface for bitrate allocation strategy belongs in api/. #include "rtc_base/bitrate_allocation_strategy.h" #include "rtc_base/network.h" -#include "rtc_base/platform_file.h" #include "rtc_base/rtc_certificate.h" #include "rtc_base/rtc_certificate_generator.h" #include "rtc_base/socket_address.h" @@ -1412,10 +1411,6 @@ class PeerConnectionFactoryInterface : public rtc::RefCountInterface { virtual bool StartAecDump(FILE* file, int64_t max_size_bytes) { return false; } - // TODO(webrtc:6463): Deprecated; PlatformFile will soon be deleted. - virtual bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) { - return false; - } // Stops logging the AEC dump. virtual void StopAecDump() = 0; diff --git a/pc/peer_connection_factory.cc b/pc/peer_connection_factory.cc index e3da4cfce6..36f9aac477 100644 --- a/pc/peer_connection_factory.cc +++ b/pc/peer_connection_factory.cc @@ -214,17 +214,6 @@ bool PeerConnectionFactory::StartAecDump(FILE* file, int64_t max_size_bytes) { return channel_manager_->StartAecDump(FileWrapper(file), max_size_bytes); } -bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file, - int64_t max_size_bytes) { - RTC_DCHECK(signaling_thread_->IsCurrent()); - FILE* f = rtc::FdopenPlatformFileForWriting(file); - if (!f) { - rtc::ClosePlatformFile(file); - return false; - } - return StartAecDump(f, max_size_bytes); -} - void PeerConnectionFactory::StopAecDump() { RTC_DCHECK(signaling_thread_->IsCurrent()); channel_manager_->StopAecDump(); diff --git a/pc/peer_connection_factory.h b/pc/peer_connection_factory.h index 6f68a26c77..9160730149 100644 --- a/pc/peer_connection_factory.h +++ b/pc/peer_connection_factory.h @@ -70,7 +70,6 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface { AudioSourceInterface* audio_source) override; bool StartAecDump(FILE* file, int64_t max_size_bytes) override; - bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) override; void StopAecDump() override; virtual std::unique_ptr diff --git a/sdk/android/src/jni/pc/peer_connection_factory.cc b/sdk/android/src/jni/pc/peer_connection_factory.cc index aa71fc04c1..1446576f62 100644 --- a/sdk/android/src/jni/pc/peer_connection_factory.cc +++ b/sdk/android/src/jni/pc/peer_connection_factory.cc @@ -420,10 +420,16 @@ jlong JNI_PeerConnectionFactory_CreateAudioTrack( static jboolean JNI_PeerConnectionFactory_StartAecDump( JNIEnv* jni, jlong native_factory, - jint file, + jint file_descriptor, jint filesize_limit_bytes) { + FILE* f = fdopen(file_descriptor, "wb"); + if (!f) { + close(file_descriptor); + return false; + } + return PeerConnectionFactoryFromJava(native_factory) - ->StartAecDump(file, filesize_limit_bytes); + ->StartAecDump(f, filesize_limit_bytes); } static void JNI_PeerConnectionFactory_StopAecDump(JNIEnv* jni, diff --git a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm index 7fcd3c507b..366c56acdb 100644 --- a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm +++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm @@ -310,12 +310,12 @@ RTCLogError(@"Aec dump already started."); return NO; } - int fd = open(filePath.UTF8String, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); - if (fd < 0) { - RTCLogError(@"Error opening file: %@. Error: %d", filePath, errno); + FILE *f = fopen(filePath.UTF8String, "wb"); + if (!f) { + RTCLogError(@"Error opening file: %@. Error: %s", filePath, strerror(errno)); return NO; } - _hasStartedAecDump = _nativeFactory->StartAecDump(fd, maxSizeInBytes); + _hasStartedAecDump = _nativeFactory->StartAecDump(f, maxSizeInBytes); return _hasStartedAecDump; }