mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Delete obsolete RtcEventLogOutputFile constructor
Followup to https://webrtc-review.googlesource.com/c/src/+/134460. Bug: webrtc:6463 Change-Id: Ib6574b02b21fddc598c1f67c7e2b515f01d33204 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/139887 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28206}
This commit is contained in:
parent
12561e06ce
commit
dec9f74b8d
5 changed files with 18 additions and 31 deletions
|
@ -18,17 +18,6 @@
|
|||
|
||||
namespace webrtc {
|
||||
|
||||
namespace {
|
||||
|
||||
FileWrapper FileWrapperFromPlatformFile(rtc::PlatformFile platform_file) {
|
||||
if (platform_file == rtc::kInvalidPlatformFileValue)
|
||||
return FileWrapper();
|
||||
|
||||
return FileWrapper(rtc::FdopenPlatformFileForWriting(platform_file));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// Together with the assumption of no single Write() would ever be called on
|
||||
// an input with length greater-than-or-equal-to (max(size_t) / 2), this
|
||||
// guarantees no overflow of the check for remaining file capacity in Write().
|
||||
|
@ -60,11 +49,6 @@ RtcEventLogOutputFile::RtcEventLogOutputFile(FileWrapper file,
|
|||
}
|
||||
}
|
||||
|
||||
RtcEventLogOutputFile::RtcEventLogOutputFile(rtc::PlatformFile platform_file,
|
||||
size_t max_size_bytes)
|
||||
: RtcEventLogOutputFile(FileWrapperFromPlatformFile(platform_file),
|
||||
max_size_bytes) {}
|
||||
|
||||
bool RtcEventLogOutputFile::IsActive() const {
|
||||
return IsActiveInternal();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <string>
|
||||
|
||||
#include "api/rtc_event_log_output.h"
|
||||
#include "rtc_base/platform_file.h" // Can't neatly forward PlatformFile.
|
||||
#include "rtc_base/system/file_wrapper.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -33,10 +32,6 @@ class RtcEventLogOutputFile final : public RtcEventLogOutput {
|
|||
// of the FILE*, and closes it on destruction.
|
||||
RtcEventLogOutputFile(FILE* file, size_t max_size_bytes);
|
||||
|
||||
// TODO(bugs.webrtc.org/6463): Deprecated, delete together with the
|
||||
// corresponding PeerConnection::StartRtcEventLog override.
|
||||
RtcEventLogOutputFile(rtc::PlatformFile file, size_t max_size_bytes);
|
||||
|
||||
~RtcEventLogOutputFile() override = default;
|
||||
|
||||
bool IsActive() const override;
|
||||
|
|
|
@ -451,6 +451,12 @@ static const char kDtlsSdesFallbackSdp[] =
|
|||
"inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 "
|
||||
"dummy_session_params\r\n";
|
||||
|
||||
class RtcEventLogOutputNull final : public RtcEventLogOutput {
|
||||
public:
|
||||
bool IsActive() const override { return true; }
|
||||
bool Write(const std::string& output) override { return true; }
|
||||
};
|
||||
|
||||
using ::cricket::StreamParams;
|
||||
using ::testing::Exactly;
|
||||
using ::testing::Values;
|
||||
|
@ -3453,11 +3459,9 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||
// The RtcEventLog will be reset when the PeerConnection is closed.
|
||||
pc_->Close();
|
||||
|
||||
rtc::PlatformFile file = 0;
|
||||
int64_t max_size_bytes = 1024;
|
||||
EXPECT_FALSE(pc_->StartRtcEventLog(
|
||||
absl::make_unique<webrtc::RtcEventLogOutputFile>(file, max_size_bytes),
|
||||
webrtc::RtcEventLog::kImmediateOutput));
|
||||
EXPECT_FALSE(
|
||||
pc_->StartRtcEventLog(absl::make_unique<webrtc::RtcEventLogOutputNull>(),
|
||||
webrtc::RtcEventLog::kImmediateOutput));
|
||||
pc_->StopRtcEventLog();
|
||||
}
|
||||
|
||||
|
|
|
@ -750,8 +750,13 @@ static jboolean JNI_PeerConnection_StartRtcEventLog(
|
|||
const size_t max_size = (max_size_bytes < 0)
|
||||
? RtcEventLog::kUnlimitedOutput
|
||||
: rtc::saturated_cast<size_t>(max_size_bytes);
|
||||
FILE* f = fdopen(file_descriptor, "wb");
|
||||
if (!f) {
|
||||
close(file_descriptor);
|
||||
return false;
|
||||
}
|
||||
return ExtractNativePC(jni, j_pc)->StartRtcEventLog(
|
||||
absl::make_unique<RtcEventLogOutputFile>(file_descriptor, max_size));
|
||||
absl::make_unique<RtcEventLogOutputFile>(f, max_size));
|
||||
}
|
||||
|
||||
static void JNI_PeerConnection_StopRtcEventLog(
|
||||
|
|
|
@ -536,9 +536,8 @@ void PeerConnectionDelegateAdapter::OnRemoveTrack(
|
|||
RTCLogError(@"Event logging already started.");
|
||||
return NO;
|
||||
}
|
||||
int fd = open(filePath.UTF8String, O_WRONLY | O_CREAT | O_TRUNC,
|
||||
S_IRUSR | S_IWUSR);
|
||||
if (fd < 0) {
|
||||
FILE *f = fopen(filePath.UTF8String, "wb");
|
||||
if (!f) {
|
||||
RTCLogError(@"Error opening file: %@. Error: %d", filePath, errno);
|
||||
return NO;
|
||||
}
|
||||
|
@ -547,7 +546,7 @@ void PeerConnectionDelegateAdapter::OnRemoveTrack(
|
|||
rtc::saturated_cast<size_t>(maxSizeInBytes);
|
||||
|
||||
_hasStartedRtcEventLog = _peerConnection->StartRtcEventLog(
|
||||
absl::make_unique<webrtc::RtcEventLogOutputFile>(fd, max_size));
|
||||
absl::make_unique<webrtc::RtcEventLogOutputFile>(f, max_size));
|
||||
return _hasStartedRtcEventLog;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue