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}
This commit is contained in:
@ -171,11 +171,6 @@ PeerConnectionInterface::peer_connection_state() {
|
||||
return PeerConnectionInterface::PeerConnectionState::kFailed;
|
||||
}
|
||||
|
||||
bool PeerConnectionInterface::StartRtcEventLog(rtc::PlatformFile file,
|
||||
int64_t max_size_bytes) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PeerConnectionInterface::StartRtcEventLog(
|
||||
std::unique_ptr<RtcEventLogOutput> output,
|
||||
int64_t output_period_ms) {
|
||||
|
||||
@ -1076,14 +1076,6 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
||||
|
||||
virtual IceGatheringState ice_gathering_state() = 0;
|
||||
|
||||
// Starts RtcEventLog using existing file. Takes ownership of |file| and
|
||||
// passes it on to Call, which will take the ownership. If the
|
||||
// operation fails the file will be closed.
|
||||
// The logging will stop when |max_size_bytes| is reached or when the
|
||||
// StopRtcEventLog function is called.
|
||||
// TODO(eladalon): Deprecate and remove this.
|
||||
virtual bool StartRtcEventLog(rtc::PlatformFile file, int64_t max_size_bytes);
|
||||
|
||||
// Start RtcEventLog using an existing output-sink. Takes ownership of
|
||||
// |output| and passes it on to Call, which will take the ownership. If the
|
||||
// operation fails the output will be closed and deallocated. The event log
|
||||
|
||||
@ -131,7 +131,6 @@ PROXY_METHOD0(IceConnectionState, ice_connection_state)
|
||||
PROXY_METHOD0(IceConnectionState, standardized_ice_connection_state)
|
||||
PROXY_METHOD0(PeerConnectionState, peer_connection_state)
|
||||
PROXY_METHOD0(IceGatheringState, ice_gathering_state)
|
||||
PROXY_METHOD2(bool, StartRtcEventLog, rtc::PlatformFile, int64_t)
|
||||
PROXY_METHOD2(bool,
|
||||
StartRtcEventLog,
|
||||
std::unique_ptr<RtcEventLogOutput>,
|
||||
|
||||
@ -124,7 +124,6 @@ class MockPeerConnectionInterface
|
||||
MOCK_METHOD0(signaling_state, SignalingState());
|
||||
MOCK_METHOD0(ice_connection_state, IceConnectionState());
|
||||
MOCK_METHOD0(ice_gathering_state, IceGatheringState());
|
||||
MOCK_METHOD2(StartRtcEventLog, bool(rtc::PlatformFile, int64_t));
|
||||
MOCK_METHOD2(StartRtcEventLog,
|
||||
bool(std::unique_ptr<RtcEventLogOutput>, int64_t));
|
||||
MOCK_METHOD0(StopRtcEventLog, void());
|
||||
|
||||
@ -54,7 +54,6 @@
|
||||
#include "rtc_base/bind.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "rtc_base/string_encode.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "rtc_base/trace_event.h"
|
||||
@ -3756,21 +3755,6 @@ PeerConnection::GetFirstAudioTransceiver() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool PeerConnection::StartRtcEventLog(rtc::PlatformFile file,
|
||||
int64_t 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);
|
||||
int64_t output_period_ms = webrtc::RtcEventLog::kImmediateOutput;
|
||||
if (field_trial::IsEnabled("WebRTC-RtcEventLogNewFormat")) {
|
||||
output_period_ms = 5000;
|
||||
}
|
||||
return StartRtcEventLog(
|
||||
absl::make_unique<RtcEventLogOutputFile>(file, max_size),
|
||||
output_period_ms);
|
||||
}
|
||||
|
||||
bool PeerConnection::StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output,
|
||||
int64_t output_period_ms) {
|
||||
// TODO(eladalon): In C++14, this can be done with a lambda.
|
||||
@ -3788,8 +3772,11 @@ bool PeerConnection::StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output,
|
||||
|
||||
bool PeerConnection::StartRtcEventLog(
|
||||
std::unique_ptr<RtcEventLogOutput> output) {
|
||||
return StartRtcEventLog(std::move(output),
|
||||
webrtc::RtcEventLog::kImmediateOutput);
|
||||
int64_t output_period_ms = webrtc::RtcEventLog::kImmediateOutput;
|
||||
if (field_trial::IsEnabled("WebRTC-RtcEventLogNewFormat")) {
|
||||
output_period_ms = 5000;
|
||||
}
|
||||
return StartRtcEventLog(std::move(output), output_period_ms);
|
||||
}
|
||||
|
||||
void PeerConnection::StopRtcEventLog() {
|
||||
|
||||
@ -209,8 +209,6 @@ class PeerConnection : public PeerConnectionInternal,
|
||||
|
||||
rtc::scoped_refptr<SctpTransportInterface> GetSctpTransport() const override;
|
||||
|
||||
RTC_DEPRECATED bool StartRtcEventLog(rtc::PlatformFile file,
|
||||
int64_t max_size_bytes) override;
|
||||
bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output,
|
||||
int64_t output_period_ms) override;
|
||||
bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output) override;
|
||||
|
||||
@ -3443,30 +3443,6 @@ TEST_P(PeerConnectionInterfaceTest, CurrentAndPendingDescriptions) {
|
||||
EXPECT_EQ(local_answer_ptr, pc_->current_local_description());
|
||||
}
|
||||
|
||||
// Tests that it won't crash when calling StartRtcEventLog or StopRtcEventLog
|
||||
// after the PeerConnection is closed.
|
||||
// This version tests the StartRtcEventLog version that receives a file.
|
||||
TEST_P(PeerConnectionInterfaceTest,
|
||||
StartAndStopLoggingToFileAfterPeerConnectionClosed) {
|
||||
CreatePeerConnection();
|
||||
// The RtcEventLog will be reset when the PeerConnection is closed.
|
||||
pc_->Close();
|
||||
|
||||
auto test_info = ::testing::UnitTest::GetInstance()->current_test_info();
|
||||
std::string filename = webrtc::test::OutputPath() +
|
||||
test_info->test_case_name() + test_info->name();
|
||||
rtc::PlatformFile file = rtc::CreatePlatformFile(filename);
|
||||
|
||||
constexpr int64_t max_size_bytes = 1024;
|
||||
|
||||
EXPECT_FALSE(pc_->StartRtcEventLog(file, max_size_bytes));
|
||||
pc_->StopRtcEventLog();
|
||||
|
||||
// Cleanup.
|
||||
rtc::ClosePlatformFile(file);
|
||||
rtc::RemoveFile(filename);
|
||||
}
|
||||
|
||||
// Tests that it won't crash when calling StartRtcEventLog or StopRtcEventLog
|
||||
// after the PeerConnection is closed.
|
||||
// This version tests the StartRtcEventLog version that receives an object
|
||||
|
||||
@ -209,11 +209,6 @@ class FakePeerConnectionBase : public PeerConnectionInternal {
|
||||
return IceGatheringState::kIceGatheringNew;
|
||||
}
|
||||
|
||||
bool StartRtcEventLog(rtc::PlatformFile file,
|
||||
int64_t max_size_bytes) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output,
|
||||
int64_t output_period_ms) override {
|
||||
return false;
|
||||
|
||||
@ -907,6 +907,7 @@ if (is_ios || is_mac) {
|
||||
":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",
|
||||
|
||||
@ -777,6 +777,7 @@ if (is_android) {
|
||||
":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",
|
||||
|
||||
@ -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 @@ static jboolean JNI_PeerConnection_StartRtcEventLog(
|
||||
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(
|
||||
|
||||
@ -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 @@ void PeerConnectionDelegateAdapter::OnRemoveTrack(
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user