Promote RtcEventLogOutputFile to api/
Preparation for deleting PeerConnectionInterface::StartRtcEventLog method with a PlatformFile argument. Bug: webrtc:6463 Change-Id: Ia9fa1d99a3d87f3bf193e73382690b782ffea65c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135285 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27879}
This commit is contained in:
parent
26ab9d6855
commit
d8b9ed77cf
20
api/BUILD.gn
20
api/BUILD.gn
@ -348,6 +348,22 @@ rtc_source_set("libjingle_logging_api") {
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("rtc_event_log_output_file") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
"rtc_event_log_output_file.cc",
|
||||
"rtc_event_log_output_file.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":libjingle_logging_api",
|
||||
"../logging:rtc_event_log_api",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"../rtc_base/system:file_wrapper",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("ortc_api") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
@ -804,6 +820,7 @@ if (rtc_include_tests) {
|
||||
"array_view_unittest.cc",
|
||||
"function_view_unittest.cc",
|
||||
"rtc_error_unittest.cc",
|
||||
"rtc_event_log_output_file_unittest.cc",
|
||||
"rtp_parameters_unittest.cc",
|
||||
"test/loopback_media_transport_unittest.cc",
|
||||
]
|
||||
@ -813,13 +830,16 @@ if (rtc_include_tests) {
|
||||
":function_view",
|
||||
":libjingle_peerconnection_api",
|
||||
":loopback_media_transport",
|
||||
":rtc_event_log_output_file",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:gunit_helpers",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"../test:fileutils",
|
||||
"../test:test_support",
|
||||
"task_queue:task_queue_default_factory_unittests",
|
||||
"units:units_unittests",
|
||||
"video:video_unittests",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
7
api/DEPS
7
api/DEPS
@ -148,7 +148,12 @@ specific_include_rules = {
|
||||
"rtc_error\.h": [
|
||||
"+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",
|
||||
],
|
||||
"rtp_receiver_interface\.h": [
|
||||
"+rtc_base/ref_count.h",
|
||||
],
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
||||
#include "api/rtc_event_log_output_file.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
62
api/rtc_event_log_output_file.h
Normal file
62
api/rtc_event_log_output_file.h
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef API_RTC_EVENT_LOG_OUTPUT_FILE_H_
|
||||
#define API_RTC_EVENT_LOG_OUTPUT_FILE_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#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 {
|
||||
|
||||
class RtcEventLogOutputFile final : public RtcEventLogOutput {
|
||||
public:
|
||||
static const size_t kMaxReasonableFileSize; // Explanation at declaration.
|
||||
|
||||
// Unlimited/limited-size output file (by filename).
|
||||
explicit RtcEventLogOutputFile(const std::string& file_name);
|
||||
RtcEventLogOutputFile(const std::string& file_name, size_t max_size_bytes);
|
||||
|
||||
// Limited-size output file (by FILE*). This class takes ownership
|
||||
// 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;
|
||||
|
||||
bool Write(const std::string& output) override;
|
||||
|
||||
private:
|
||||
RtcEventLogOutputFile(FileWrapper file, size_t max_size_bytes);
|
||||
|
||||
// IsActive() can be called either from outside or from inside, but we don't
|
||||
// want to incur the overhead of a virtual function call if called from inside
|
||||
// some other function of this class.
|
||||
inline bool IsActiveInternal() const;
|
||||
|
||||
// Maximum size, or zero for no limit.
|
||||
const size_t max_size_bytes_;
|
||||
size_t written_bytes_{0};
|
||||
FileWrapper file_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_RTC_EVENT_LOG_OUTPUT_FILE_H_
|
||||
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
||||
#include "api/rtc_event_log_output_file.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
@ -422,6 +422,7 @@ if (rtc_include_tests) {
|
||||
":call_interfaces",
|
||||
":simulated_network",
|
||||
":video_stream_api",
|
||||
"../api:rtc_event_log_output_file",
|
||||
"../api:simulated_network_api",
|
||||
"../api/audio_codecs:builtin_audio_encoder_factory",
|
||||
"../api/task_queue",
|
||||
@ -431,7 +432,6 @@ if (rtc_include_tests) {
|
||||
"../api/video_codecs:video_codecs_api",
|
||||
"../logging:rtc_event_log_api",
|
||||
"../logging:rtc_event_log_impl_base",
|
||||
"../logging:rtc_event_log_impl_output",
|
||||
"../modules/audio_coding",
|
||||
"../modules/audio_device",
|
||||
"../modules/audio_device:audio_device_impl",
|
||||
|
||||
@ -13,10 +13,10 @@
|
||||
#include <memory>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/rtc_event_log_output_file.h"
|
||||
#include "api/task_queue/default_task_queue_factory.h"
|
||||
#include "api/task_queue/task_queue_factory.h"
|
||||
#include "call/fake_network_pipe.h"
|
||||
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log_factory.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/flags.h"
|
||||
|
||||
@ -21,7 +21,6 @@ group("logging") {
|
||||
":rtc_event_bwe",
|
||||
":rtc_event_log_impl_base",
|
||||
":rtc_event_log_impl_encoder",
|
||||
":rtc_event_log_impl_output",
|
||||
":rtc_event_pacing",
|
||||
":rtc_event_rtp_rtcp",
|
||||
":rtc_event_video",
|
||||
@ -208,7 +207,6 @@ rtc_static_library("rtc_event_log_impl_encoder") {
|
||||
":rtc_event_generic_packet_events",
|
||||
":rtc_event_log2_proto",
|
||||
":rtc_event_log_api",
|
||||
":rtc_event_log_impl_output",
|
||||
":rtc_event_log_proto",
|
||||
":rtc_event_pacing",
|
||||
":rtc_event_rtp_rtcp",
|
||||
@ -228,18 +226,14 @@ rtc_static_library("rtc_event_log_impl_encoder") {
|
||||
}
|
||||
}
|
||||
|
||||
# TODO(bugs.webrtc.org/6463): For backwards compatibility; delete as
|
||||
# soon as downstream dependencies are updated.
|
||||
rtc_source_set("rtc_event_log_impl_output") {
|
||||
sources = [
|
||||
"rtc_event_log/output/rtc_event_log_output_file.cc",
|
||||
"rtc_event_log/output/rtc_event_log_output_file.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":rtc_event_log_api",
|
||||
"../api:libjingle_logging_api",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"../rtc_base/system:file_wrapper",
|
||||
"../api:rtc_event_log_output_file",
|
||||
]
|
||||
}
|
||||
|
||||
@ -361,7 +355,6 @@ if (rtc_enable_protobuf) {
|
||||
"rtc_event_log/encoder/delta_encoding_unittest.cc",
|
||||
"rtc_event_log/encoder/rtc_event_log_encoder_common_unittest.cc",
|
||||
"rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc",
|
||||
"rtc_event_log/output/rtc_event_log_output_file_unittest.cc",
|
||||
"rtc_event_log/rtc_event_log_unittest.cc",
|
||||
"rtc_event_log/rtc_event_log_unittest_helper.cc",
|
||||
"rtc_event_log/rtc_event_log_unittest_helper.h",
|
||||
@ -376,7 +369,6 @@ if (rtc_enable_protobuf) {
|
||||
":rtc_event_log_api",
|
||||
":rtc_event_log_impl_base",
|
||||
":rtc_event_log_impl_encoder",
|
||||
":rtc_event_log_impl_output",
|
||||
":rtc_event_log_parser",
|
||||
":rtc_event_log_proto",
|
||||
":rtc_event_pacing",
|
||||
@ -385,6 +377,7 @@ if (rtc_enable_protobuf) {
|
||||
":rtc_stream_config",
|
||||
"../api:array_view",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:rtc_event_log_output_file",
|
||||
"../api:rtp_headers",
|
||||
"../api/task_queue:default_task_queue_factory",
|
||||
"../call",
|
||||
|
||||
@ -11,52 +11,9 @@
|
||||
#ifndef LOGGING_RTC_EVENT_LOG_OUTPUT_RTC_EVENT_LOG_OUTPUT_FILE_H_
|
||||
#define LOGGING_RTC_EVENT_LOG_OUTPUT_RTC_EVENT_LOG_OUTPUT_FILE_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
// TODO(bugs.webrtc.org/6463): For backwards compatibility; delete as soon as
|
||||
// downstream dependencies are updated.
|
||||
|
||||
#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 {
|
||||
|
||||
class RtcEventLogOutputFile final : public RtcEventLogOutput {
|
||||
public:
|
||||
static const size_t kMaxReasonableFileSize; // Explanation at declaration.
|
||||
|
||||
// Unlimited/limited-size output file (by filename).
|
||||
explicit RtcEventLogOutputFile(const std::string& file_name);
|
||||
RtcEventLogOutputFile(const std::string& file_name, size_t max_size_bytes);
|
||||
|
||||
// Limited-size output file (by FILE*). This class takes ownership
|
||||
// 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;
|
||||
|
||||
bool Write(const std::string& output) override;
|
||||
|
||||
private:
|
||||
RtcEventLogOutputFile(FileWrapper file, size_t max_size_bytes);
|
||||
|
||||
// IsActive() can be called either from outside or from inside, but we don't
|
||||
// want to incur the overhead of a virtual function call if called from inside
|
||||
// some other function of this class.
|
||||
inline bool IsActiveInternal() const;
|
||||
|
||||
// Maximum size, or zero for no limit.
|
||||
const size_t max_size_bytes_;
|
||||
size_t written_bytes_{0};
|
||||
FileWrapper file_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
#include "api/rtc_event_log_output_file.h"
|
||||
|
||||
#endif // LOGGING_RTC_EVENT_LOG_OUTPUT_RTC_EVENT_LOG_OUTPUT_FILE_H_
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/rtc_event_log_output_file.h"
|
||||
#include "api/task_queue/default_task_queue_factory.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_audio_playout.h"
|
||||
@ -39,7 +40,6 @@
|
||||
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_video_send_stream_config.h"
|
||||
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log_factory.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log_parser.h"
|
||||
|
||||
@ -198,6 +198,7 @@ rtc_static_library("peerconnection") {
|
||||
"../api:fec_controller_api",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:network_state_predictor_api",
|
||||
"../api:rtc_event_log_output_file",
|
||||
"../api:rtc_stats_api",
|
||||
"../api:scoped_refptr",
|
||||
"../api/task_queue",
|
||||
@ -208,7 +209,6 @@ rtc_static_library("peerconnection") {
|
||||
"../common_video",
|
||||
"../logging:ice_log",
|
||||
"../logging:rtc_event_log_api",
|
||||
"../logging:rtc_event_log_impl_output",
|
||||
"../media:rtc_data",
|
||||
"../media:rtc_media_base",
|
||||
"../modules/rtp_rtcp:rtp_rtcp_format",
|
||||
@ -536,6 +536,7 @@ if (rtc_include_tests) {
|
||||
":pc_test_utils",
|
||||
"../api:callfactory_api",
|
||||
"../api:fake_media_transport",
|
||||
"../api:rtc_event_log_output_file",
|
||||
"../api:rtc_stats_api",
|
||||
"../api/audio_codecs:audio_codecs_api",
|
||||
"../api/audio_codecs:builtin_audio_decoder_factory",
|
||||
@ -548,7 +549,6 @@ if (rtc_include_tests) {
|
||||
"../call:call_interfaces",
|
||||
"../logging:rtc_event_log_api",
|
||||
"../logging:rtc_event_log_impl_base",
|
||||
"../logging:rtc_event_log_impl_output",
|
||||
"../media:rtc_audio_video",
|
||||
"../media:rtc_data", # TODO(phoglund): AFAIK only used for one sctp constant.
|
||||
"../media:rtc_media_base",
|
||||
|
||||
@ -25,12 +25,12 @@
|
||||
#include "api/media_stream_proxy.h"
|
||||
#include "api/media_stream_track_proxy.h"
|
||||
#include "api/rtc_error.h"
|
||||
#include "api/rtc_event_log_output_file.h"
|
||||
#include "api/rtp_parameters.h"
|
||||
#include "api/uma_metrics.h"
|
||||
#include "api/video/builtin_video_bitrate_allocator_factory.h"
|
||||
#include "call/call.h"
|
||||
#include "logging/rtc_event_log/ice_logger.h"
|
||||
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "media/base/rid_description.h"
|
||||
#include "media/sctp/sctp_transport.h"
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "api/peer_connection_interface.h"
|
||||
#include "api/rtc_error.h"
|
||||
#include "api/rtc_event_log_output.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"
|
||||
@ -42,7 +43,6 @@
|
||||
#include "api/video_codecs/builtin_video_encoder_factory.h"
|
||||
#include "api/video_codecs/video_decoder_factory.h"
|
||||
#include "api/video_codecs/video_encoder_factory.h"
|
||||
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log_factory.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log_factory_interface.h"
|
||||
|
||||
@ -256,6 +256,7 @@ if (rtc_include_tests) {
|
||||
"../../../api:audio_quality_analyzer_api",
|
||||
"../../../api:libjingle_peerconnection_api",
|
||||
"../../../api:peer_connection_quality_test_fixture_api",
|
||||
"../../../api:rtc_event_log_output_file",
|
||||
"../../../api:scoped_refptr",
|
||||
"../../../api:video_quality_analyzer_api",
|
||||
"../../../api/task_queue",
|
||||
@ -263,7 +264,6 @@ if (rtc_include_tests) {
|
||||
"../../../api/units:time_delta",
|
||||
"../../../api/units:timestamp",
|
||||
"../../../logging:rtc_event_log_api",
|
||||
"../../../logging:rtc_event_log_impl_output",
|
||||
"../../../pc:pc_test_utils",
|
||||
"../../../pc:peerconnection",
|
||||
"../../../rtc_base",
|
||||
|
||||
@ -16,11 +16,11 @@
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/media_stream_interface.h"
|
||||
#include "api/peer_connection_interface.h"
|
||||
#include "api/rtc_event_log_output_file.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/task_queue/default_task_queue_factory.h"
|
||||
#include "api/test/video_quality_analyzer_interface.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "pc/sdp_utils.h"
|
||||
#include "pc/test/mock_peer_connection_observers.h"
|
||||
|
||||
@ -83,6 +83,7 @@ if (rtc_include_tests) {
|
||||
"../:video_test_common",
|
||||
"../../api:fec_controller_api",
|
||||
"../../api:libjingle_peerconnection_api",
|
||||
"../../api:rtc_event_log_output_file",
|
||||
"../../api:transport_api",
|
||||
"../../api/audio_codecs:builtin_audio_decoder_factory",
|
||||
"../../api/audio_codecs:builtin_audio_encoder_factory",
|
||||
@ -105,7 +106,6 @@ if (rtc_include_tests) {
|
||||
"../../common_video",
|
||||
"../../logging:rtc_event_log_api",
|
||||
"../../logging:rtc_event_log_impl_base",
|
||||
"../../logging:rtc_event_log_impl_output",
|
||||
"../../media:rtc_audio_video",
|
||||
"../../media:rtc_internal_video_codecs",
|
||||
"../../media:rtc_media_base",
|
||||
|
||||
@ -246,6 +246,7 @@ if (rtc_include_tests) {
|
||||
deps = [
|
||||
":frame_dumping_decoder",
|
||||
"../api:fec_controller_api",
|
||||
"../api:rtc_event_log_output_file",
|
||||
"../api:test_dependency_factory",
|
||||
"../api:video_quality_test_fixture_api",
|
||||
"../api/task_queue",
|
||||
@ -258,7 +259,6 @@ if (rtc_include_tests) {
|
||||
"../common_video",
|
||||
"../logging:rtc_event_log_api",
|
||||
"../logging:rtc_event_log_impl_base",
|
||||
"../logging:rtc_event_log_impl_output",
|
||||
"../media:rtc_audio_video",
|
||||
"../media:rtc_encoder_simulcast_proxy",
|
||||
"../media:rtc_internal_video_codecs",
|
||||
|
||||
@ -17,11 +17,11 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/rtc_event_log_output_file.h"
|
||||
#include "api/task_queue/default_task_queue_factory.h"
|
||||
#include "api/video/builtin_video_bitrate_allocator_factory.h"
|
||||
#include "call/fake_network_pipe.h"
|
||||
#include "call/simulated_network.h"
|
||||
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
||||
#include "media/engine/adm_helpers.h"
|
||||
#include "media/engine/encoder_simulcast_proxy.h"
|
||||
#include "media/engine/fake_video_codec_factory.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user