mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-17 15:47:53 +01:00
Remove deprecated functions from RtcEventLog
The unified Log() interface replaces the many old LogX() functions. This helps hide dependencies between the modules which log different events. TBR=stefan@webrtc.org Bug: webrtc:8111 Change-Id: I5ea9fd50ba6da87d5867513c81c5e3bdb0524a32 Reviewed-on: https://webrtc-review.googlesource.com/2689 Commit-Queue: Elad Alon <eladalon@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Reviewed-by: Elad Alon <eladalon@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20159}
This commit is contained in:
parent
2f33a5671e
commit
5fd6e5ec1f
5 changed files with 10 additions and 598 deletions
|
@ -12,13 +12,8 @@
|
|||
#define LOGGING_RTC_EVENT_LOG_MOCK_MOCK_RTC_EVENT_LOG_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "logging/rtc_event_log/rtc_stream_config.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -30,76 +25,12 @@ class MockRtcEventLog : public RtcEventLog {
|
|||
}
|
||||
MOCK_METHOD1(StartLoggingProxy, bool(RtcEventLogOutput*));
|
||||
|
||||
MOCK_METHOD2(StartLogging,
|
||||
bool(const std::string& file_name, int64_t max_size_bytes));
|
||||
|
||||
MOCK_METHOD2(StartLogging,
|
||||
bool(rtc::PlatformFile log_file, int64_t max_size_bytes));
|
||||
|
||||
MOCK_METHOD0(StopLogging, void());
|
||||
|
||||
virtual void Log(std::unique_ptr<RtcEvent> event) {
|
||||
return LogProxy(event.get());
|
||||
}
|
||||
MOCK_METHOD1(LogProxy, void(RtcEvent*));
|
||||
|
||||
MOCK_METHOD1(LogVideoReceiveStreamConfig,
|
||||
void(const rtclog::StreamConfig& config));
|
||||
|
||||
MOCK_METHOD1(LogVideoSendStreamConfig,
|
||||
void(const rtclog::StreamConfig& config));
|
||||
|
||||
MOCK_METHOD1(LogAudioReceiveStreamConfig,
|
||||
void(const rtclog::StreamConfig& config));
|
||||
|
||||
MOCK_METHOD1(LogAudioSendStreamConfig,
|
||||
void(const rtclog::StreamConfig& config));
|
||||
MOCK_METHOD3(LogRtpHeader,
|
||||
void(PacketDirection direction,
|
||||
const uint8_t* header,
|
||||
size_t packet_length));
|
||||
|
||||
MOCK_METHOD4(LogRtpHeader,
|
||||
void(PacketDirection direction,
|
||||
const uint8_t* header,
|
||||
size_t packet_length,
|
||||
int probe_cluster_id));
|
||||
|
||||
MOCK_METHOD3(LogRtcpPacket,
|
||||
void(PacketDirection direction,
|
||||
const uint8_t* packet,
|
||||
size_t length));
|
||||
|
||||
MOCK_METHOD1(LogIncomingRtpHeader, void(const RtpPacketReceived& packet));
|
||||
|
||||
MOCK_METHOD2(LogOutgoingRtpHeader,
|
||||
void(const RtpPacketToSend& packet, int probe_cluster_id));
|
||||
|
||||
MOCK_METHOD1(LogIncomingRtcpPacket,
|
||||
void(rtc::ArrayView<const uint8_t> packet));
|
||||
|
||||
MOCK_METHOD1(LogOutgoingRtcpPacket,
|
||||
void(rtc::ArrayView<const uint8_t> packet));
|
||||
|
||||
MOCK_METHOD1(LogAudioPlayout, void(uint32_t ssrc));
|
||||
|
||||
MOCK_METHOD3(LogLossBasedBweUpdate,
|
||||
void(int32_t bitrate_bps,
|
||||
uint8_t fraction_loss,
|
||||
int32_t total_packets));
|
||||
|
||||
MOCK_METHOD2(LogDelayBasedBweUpdate,
|
||||
void(int32_t bitrate_bps, BandwidthUsage detector_state));
|
||||
|
||||
MOCK_METHOD1(LogAudioNetworkAdaptation,
|
||||
void(const AudioEncoderRuntimeConfig& config));
|
||||
|
||||
MOCK_METHOD4(LogProbeClusterCreated,
|
||||
void(int id, int bitrate_bps, int min_probes, int min_bytes));
|
||||
|
||||
MOCK_METHOD2(LogProbeResultSuccess, void(int id, int bitrate_bps));
|
||||
MOCK_METHOD2(LogProbeResultFailure,
|
||||
void(int id, ProbeFailureReason failure_reason));
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -19,44 +19,9 @@
|
|||
#include <vector>
|
||||
|
||||
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h"
|
||||
// TODO(eladalon): Remove events/* when the deprecated functions are removed.
|
||||
#include "logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_audio_playout.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_logging_started.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_logging_stopped.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_probe_cluster_created.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_probe_result_failure.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_probe_result_success.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h"
|
||||
#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.h"
|
||||
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
||||
#include "logging/rtc_event_log/rtc_stream_config.h"
|
||||
// TODO(eladalon): Remove these when deprecated functions are removed.
|
||||
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/byte_io.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/app.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/bye.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/extended_reports.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/psfb.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/sdes.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/sender_report.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/constructormagic.h"
|
||||
#include "rtc_base/event.h"
|
||||
|
@ -66,7 +31,6 @@
|
|||
#include "rtc_base/sequenced_task_checker.h"
|
||||
#include "rtc_base/task_queue.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
#include "typedefs.h" // NOLINT(build/include)
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -117,11 +81,6 @@ class RtcEventLogImpl final : public RtcEventLog {
|
|||
explicit RtcEventLogImpl(std::unique_ptr<RtcEventLogEncoder> event_encoder);
|
||||
~RtcEventLogImpl() override;
|
||||
|
||||
bool StartLogging(const std::string& file_name,
|
||||
int64_t max_size_bytes) override;
|
||||
bool StartLogging(rtc::PlatformFile platform_file,
|
||||
int64_t max_size_bytes) override;
|
||||
|
||||
// TODO(eladalon): We should change these name to reflect that what we're
|
||||
// actually starting/stopping is the output of the log, not the log itself.
|
||||
bool StartLogging(std::unique_ptr<RtcEventLogOutput> output) override;
|
||||
|
@ -129,47 +88,6 @@ class RtcEventLogImpl final : public RtcEventLog {
|
|||
|
||||
void Log(std::unique_ptr<RtcEvent> event) override;
|
||||
|
||||
void LogVideoReceiveStreamConfig(const rtclog::StreamConfig& config) override;
|
||||
void LogVideoSendStreamConfig(const rtclog::StreamConfig& config) override;
|
||||
void LogAudioReceiveStreamConfig(const rtclog::StreamConfig& config) override;
|
||||
void LogAudioSendStreamConfig(const rtclog::StreamConfig& config) override;
|
||||
// TODO(terelius): This can be removed as soon as the interface has been
|
||||
// updated.
|
||||
void LogRtpHeader(PacketDirection direction,
|
||||
const uint8_t* header,
|
||||
size_t packet_length) override;
|
||||
// TODO(terelius): This can be made private, non-virtual as soon as the
|
||||
// interface has been updated.
|
||||
void LogRtpHeader(PacketDirection direction,
|
||||
const uint8_t* header,
|
||||
size_t packet_length,
|
||||
int probe_cluster_id) override;
|
||||
void LogIncomingRtpHeader(const RtpPacketReceived& packet) override;
|
||||
void LogOutgoingRtpHeader(const RtpPacketToSend& packet,
|
||||
int probe_cluster_id) override;
|
||||
// TODO(terelius): This can be made private, non-virtual as soon as the
|
||||
// interface has been updated.
|
||||
void LogRtcpPacket(PacketDirection direction,
|
||||
const uint8_t* packet,
|
||||
size_t length) override;
|
||||
void LogIncomingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override;
|
||||
void LogOutgoingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override;
|
||||
void LogAudioPlayout(uint32_t ssrc) override;
|
||||
void LogLossBasedBweUpdate(int32_t bitrate_bps,
|
||||
uint8_t fraction_loss,
|
||||
int32_t total_packets) override;
|
||||
void LogDelayBasedBweUpdate(int32_t bitrate_bps,
|
||||
BandwidthUsage detector_state) override;
|
||||
void LogAudioNetworkAdaptation(
|
||||
const AudioEncoderRuntimeConfig& config) override;
|
||||
void LogProbeClusterCreated(int id,
|
||||
int bitrate_bps,
|
||||
int min_probes,
|
||||
int min_bytes) override;
|
||||
void LogProbeResultSuccess(int id, int bitrate_bps) override;
|
||||
void LogProbeResultFailure(int id,
|
||||
ProbeFailureReason failure_reason) override;
|
||||
|
||||
private:
|
||||
// Appends an event to the output protobuf string, returning true on success.
|
||||
// Fails and returns false in case the limit on output size prevents the
|
||||
|
@ -232,20 +150,6 @@ RtcEventLogImpl::~RtcEventLogImpl() {
|
|||
RTC_DCHECK_GE(count, 0);
|
||||
}
|
||||
|
||||
bool RtcEventLogImpl::StartLogging(const std::string& file_name,
|
||||
int64_t max_size_bytes) {
|
||||
RTC_CHECK(max_size_bytes > 0 || max_size_bytes == kUnlimitedOutput);
|
||||
return StartLogging(rtc::MakeUnique<RtcEventLogOutputFile>(
|
||||
file_name, rtc::saturated_cast<size_t>(max_size_bytes)));
|
||||
}
|
||||
|
||||
bool RtcEventLogImpl::StartLogging(rtc::PlatformFile platform_file,
|
||||
int64_t max_size_bytes) {
|
||||
RTC_CHECK(max_size_bytes > 0 || max_size_bytes == kUnlimitedOutput);
|
||||
return StartLogging(rtc::MakeUnique<RtcEventLogOutputFile>(
|
||||
platform_file, rtc::saturated_cast<size_t>(max_size_bytes)));
|
||||
}
|
||||
|
||||
bool RtcEventLogImpl::StartLogging(std::unique_ptr<RtcEventLogOutput> output) {
|
||||
RTC_DCHECK_CALLED_SEQUENTIALLY(&owner_sequence_checker_);
|
||||
|
||||
|
@ -310,124 +214,6 @@ void RtcEventLogImpl::Log(std::unique_ptr<RtcEvent> event) {
|
|||
std::move(event), event_handler));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogVideoReceiveStreamConfig(
|
||||
const rtclog::StreamConfig& config) {
|
||||
Log(rtc::MakeUnique<RtcEventVideoReceiveStreamConfig>(
|
||||
rtc::MakeUnique<rtclog::StreamConfig>(config)));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogVideoSendStreamConfig(
|
||||
const rtclog::StreamConfig& config) {
|
||||
Log(rtc::MakeUnique<RtcEventVideoSendStreamConfig>(
|
||||
rtc::MakeUnique<rtclog::StreamConfig>(config)));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogAudioReceiveStreamConfig(
|
||||
const rtclog::StreamConfig& config) {
|
||||
Log(rtc::MakeUnique<RtcEventAudioReceiveStreamConfig>(
|
||||
rtc::MakeUnique<rtclog::StreamConfig>(config)));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogAudioSendStreamConfig(
|
||||
const rtclog::StreamConfig& config) {
|
||||
Log(rtc::MakeUnique<RtcEventAudioSendStreamConfig>(
|
||||
rtc::MakeUnique<rtclog::StreamConfig>(config)));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogIncomingRtpHeader(const RtpPacketReceived& packet) {
|
||||
Log(rtc::MakeUnique<RtcEventRtpPacketIncoming>(packet));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogOutgoingRtpHeader(const RtpPacketToSend& packet,
|
||||
int probe_cluster_id) {
|
||||
Log(rtc::MakeUnique<RtcEventRtpPacketOutgoing>(packet, probe_cluster_id));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogRtpHeader(PacketDirection direction,
|
||||
const uint8_t* header,
|
||||
size_t packet_length) {
|
||||
LogRtpHeader(direction, header, packet_length, PacedPacketInfo::kNotAProbe);
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogRtpHeader(PacketDirection direction,
|
||||
const uint8_t* header,
|
||||
size_t packet_length,
|
||||
int probe_cluster_id) {
|
||||
// TODO(eladalon): This is highly inefficient. We're only doing this for
|
||||
// the deprecated interface. We should remove this soon.
|
||||
if (direction == PacketDirection::kIncomingPacket) {
|
||||
RtpPacketReceived packet;
|
||||
packet.Parse(header, packet_length);
|
||||
Log(rtc::MakeUnique<RtcEventRtpPacketIncoming>(packet));
|
||||
} else {
|
||||
RTC_CHECK_EQ(direction, PacketDirection::kOutgoingPacket);
|
||||
RtpPacketToSend packet(nullptr);
|
||||
packet.Parse(header, packet_length);
|
||||
Log(rtc::MakeUnique<RtcEventRtpPacketOutgoing>(packet, probe_cluster_id));
|
||||
}
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogIncomingRtcpPacket(
|
||||
rtc::ArrayView<const uint8_t> packet) {
|
||||
Log(rtc::MakeUnique<RtcEventRtcpPacketIncoming>(packet));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogOutgoingRtcpPacket(
|
||||
rtc::ArrayView<const uint8_t> packet) {
|
||||
Log(rtc::MakeUnique<RtcEventRtcpPacketOutgoing>(packet));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogRtcpPacket(PacketDirection direction,
|
||||
const uint8_t* packet,
|
||||
size_t length) {
|
||||
if (direction == PacketDirection::kIncomingPacket) {
|
||||
LogIncomingRtcpPacket(rtc::ArrayView<const uint8_t>(packet, length));
|
||||
} else {
|
||||
RTC_CHECK_EQ(direction, PacketDirection::kOutgoingPacket);
|
||||
LogOutgoingRtcpPacket(rtc::ArrayView<const uint8_t>(packet, length));
|
||||
}
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogAudioPlayout(uint32_t ssrc) {
|
||||
Log(rtc::MakeUnique<RtcEventAudioPlayout>(ssrc));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogLossBasedBweUpdate(int32_t bitrate_bps,
|
||||
uint8_t fraction_loss,
|
||||
int32_t total_packets) {
|
||||
Log(rtc::MakeUnique<RtcEventBweUpdateLossBased>(bitrate_bps, fraction_loss,
|
||||
total_packets));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogDelayBasedBweUpdate(int32_t bitrate_bps,
|
||||
BandwidthUsage detector_state) {
|
||||
Log(rtc::MakeUnique<RtcEventBweUpdateDelayBased>(bitrate_bps,
|
||||
detector_state));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogAudioNetworkAdaptation(
|
||||
const AudioEncoderRuntimeConfig& config) {
|
||||
Log(rtc::MakeUnique<RtcEventAudioNetworkAdaptation>(
|
||||
rtc::MakeUnique<AudioEncoderRuntimeConfig>(config)));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogProbeClusterCreated(int id,
|
||||
int bitrate_bps,
|
||||
int min_probes,
|
||||
int min_bytes) {
|
||||
Log(rtc::MakeUnique<RtcEventProbeClusterCreated>(id, bitrate_bps, min_probes,
|
||||
min_bytes));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogProbeResultSuccess(int id, int bitrate_bps) {
|
||||
Log(rtc::MakeUnique<RtcEventProbeResultSuccess>(id, bitrate_bps));
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogProbeResultFailure(int id,
|
||||
ProbeFailureReason failure_reason) {
|
||||
Log(rtc::MakeUnique<RtcEventProbeResultFailure>(id, failure_reason));
|
||||
}
|
||||
|
||||
bool RtcEventLogImpl::AppendEventToString(const RtcEvent& event,
|
||||
std::string* output_string) {
|
||||
RTC_DCHECK_RUN_ON(&task_queue_);
|
||||
|
|
|
@ -14,33 +14,13 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
// TODO(eladalon): Remove this include once LogIncomingRtcpPacket(), etc., have
|
||||
// been removed (they are currently deprecated).
|
||||
#include "api/array_view.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "logging/rtc_event_log/events/rtc_event.h"
|
||||
#include "logging/rtc_event_log/output/rtc_event_log_output.h"
|
||||
// TODO(eladalon): This is here because of ProbeFailureReason; remove this
|
||||
// dependency along with the deprecated LogProbeResultFailure().
|
||||
#include "logging/rtc_event_log/events/rtc_event_probe_result_failure.h"
|
||||
// TODO(eladalon): Remove this #include once the deprecated versions of
|
||||
// StartLogging() have been removed.
|
||||
#include "rtc_base/platform_file.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
namespace rtclog {
|
||||
class EventStream; // Storage class automatically generated from protobuf.
|
||||
// TODO(eladalon): Get rid of this when deprecated methods are removed.
|
||||
struct StreamConfig;
|
||||
} // namespace rtclog
|
||||
|
||||
class Clock;
|
||||
// TODO(eladalon): The following may be removed when the deprecated methods
|
||||
// are removed.
|
||||
struct AudioEncoderRuntimeConfig;
|
||||
class RtpPacketReceived;
|
||||
class RtpPacketToSend;
|
||||
enum class BandwidthUsage;
|
||||
|
||||
enum PacketDirection { kIncomingPacket = 0, kOutgoingPacket };
|
||||
|
||||
class RtcEventLog {
|
||||
|
@ -55,16 +35,12 @@ class RtcEventLog {
|
|||
virtual ~RtcEventLog() {}
|
||||
|
||||
// Factory method to create an RtcEventLog object.
|
||||
// TODO(eladalon): Get rid of the default value after internal projects fixed.
|
||||
static std::unique_ptr<RtcEventLog> Create(
|
||||
EncodingType encoding_type = EncodingType::Legacy);
|
||||
static std::unique_ptr<RtcEventLog> Create(EncodingType encoding_type);
|
||||
// TODO(nisse): webrtc::Clock is deprecated. Delete this method and
|
||||
// above forward declaration of Clock when
|
||||
// webrtc/system_wrappers/include/clock.h is deleted.
|
||||
// TODO(eladalon): Get rid of the default value after internal projects fixed.
|
||||
static std::unique_ptr<RtcEventLog> Create(
|
||||
const Clock* clock,
|
||||
EncodingType encoding_type = EncodingType::Legacy) {
|
||||
static std::unique_ptr<RtcEventLog> Create(const Clock* clock,
|
||||
EncodingType encoding_type) {
|
||||
return Create(encoding_type);
|
||||
}
|
||||
|
||||
|
@ -75,115 +51,12 @@ class RtcEventLog {
|
|||
// and may close itself once it has reached the maximum size.
|
||||
virtual bool StartLogging(std::unique_ptr<RtcEventLogOutput> output) = 0;
|
||||
|
||||
// Starts logging a maximum of max_size_bytes bytes to the specified file.
|
||||
// If the file already exists it will be overwritten.
|
||||
// If max_size_bytes <= 0, logging will be active until StopLogging is called.
|
||||
// The function has no effect and returns false if we can't start a new log
|
||||
// e.g. because we are already logging or the file cannot be opened.
|
||||
RTC_DEPRECATED virtual bool StartLogging(const std::string& file_name,
|
||||
int64_t max_size_bytes) = 0;
|
||||
|
||||
// Same as above. The RtcEventLog takes ownership of the file if the call
|
||||
// is successful, i.e. if it returns true.
|
||||
RTC_DEPRECATED virtual bool StartLogging(rtc::PlatformFile platform_file,
|
||||
int64_t max_size_bytes) = 0;
|
||||
|
||||
// Deprecated. Pass an explicit file size limit.
|
||||
RTC_DEPRECATED bool StartLogging(const std::string& file_name) {
|
||||
return StartLogging(file_name, 10000000);
|
||||
}
|
||||
|
||||
// Deprecated. Pass an explicit file size limit.
|
||||
RTC_DEPRECATED bool StartLogging(rtc::PlatformFile platform_file) {
|
||||
return StartLogging(platform_file, 10000000);
|
||||
}
|
||||
|
||||
// Stops logging to file and waits until the file has been closed, after
|
||||
// which it would be permissible to read and/or modify it.
|
||||
virtual void StopLogging() = 0;
|
||||
|
||||
// Log an RTC event (the type of event is determined by the subclass).
|
||||
virtual void Log(std::unique_ptr<RtcEvent> event) = 0;
|
||||
|
||||
// Logs configuration information for a video receive stream.
|
||||
RTC_DEPRECATED virtual void LogVideoReceiveStreamConfig(
|
||||
const rtclog::StreamConfig& config) = 0;
|
||||
|
||||
// Logs configuration information for a video send stream.
|
||||
RTC_DEPRECATED virtual void LogVideoSendStreamConfig(
|
||||
const rtclog::StreamConfig& config) = 0;
|
||||
|
||||
// Logs configuration information for an audio receive stream.
|
||||
RTC_DEPRECATED virtual void LogAudioReceiveStreamConfig(
|
||||
const rtclog::StreamConfig& config) = 0;
|
||||
|
||||
// Logs configuration information for an audio send stream.
|
||||
RTC_DEPRECATED virtual void LogAudioSendStreamConfig(
|
||||
const rtclog::StreamConfig& config) = 0;
|
||||
|
||||
RTC_DEPRECATED virtual void LogRtpHeader(PacketDirection direction,
|
||||
const uint8_t* header,
|
||||
size_t packet_length) {}
|
||||
|
||||
RTC_DEPRECATED virtual void LogRtpHeader(PacketDirection direction,
|
||||
const uint8_t* header,
|
||||
size_t packet_length,
|
||||
int probe_cluster_id) {}
|
||||
|
||||
// Logs the header of an incoming RTP packet. |packet_length|
|
||||
// is the total length of the packet, including both header and payload.
|
||||
RTC_DEPRECATED virtual void LogIncomingRtpHeader(
|
||||
const RtpPacketReceived& packet) = 0;
|
||||
|
||||
// Logs the header of an incoming RTP packet. |packet_length|
|
||||
// is the total length of the packet, including both header and payload.
|
||||
RTC_DEPRECATED virtual void LogOutgoingRtpHeader(
|
||||
const RtpPacketToSend& packet,
|
||||
int probe_cluster_id) = 0;
|
||||
|
||||
RTC_DEPRECATED virtual void LogRtcpPacket(PacketDirection direction,
|
||||
const uint8_t* header,
|
||||
size_t packet_length) {}
|
||||
|
||||
// Logs an incoming RTCP packet.
|
||||
RTC_DEPRECATED virtual void LogIncomingRtcpPacket(
|
||||
rtc::ArrayView<const uint8_t> packet) = 0;
|
||||
|
||||
// Logs an outgoing RTCP packet.
|
||||
RTC_DEPRECATED virtual void LogOutgoingRtcpPacket(
|
||||
rtc::ArrayView<const uint8_t> packet) = 0;
|
||||
|
||||
// Logs an audio playout event.
|
||||
RTC_DEPRECATED virtual void LogAudioPlayout(uint32_t ssrc) = 0;
|
||||
|
||||
// Logs a bitrate update from the bandwidth estimator based on packet loss.
|
||||
RTC_DEPRECATED virtual void LogLossBasedBweUpdate(int32_t bitrate_bps,
|
||||
uint8_t fraction_loss,
|
||||
int32_t total_packets) = 0;
|
||||
|
||||
// Logs a bitrate update from the bandwidth estimator based on delay changes.
|
||||
RTC_DEPRECATED virtual void LogDelayBasedBweUpdate(
|
||||
int32_t bitrate_bps,
|
||||
BandwidthUsage detector_state) = 0;
|
||||
|
||||
// Logs audio encoder re-configuration driven by audio network adaptor.
|
||||
RTC_DEPRECATED virtual void LogAudioNetworkAdaptation(
|
||||
const AudioEncoderRuntimeConfig& config) = 0;
|
||||
|
||||
// Logs when a probe cluster is created.
|
||||
RTC_DEPRECATED virtual void LogProbeClusterCreated(int id,
|
||||
int bitrate_bps,
|
||||
int min_probes,
|
||||
int min_bytes) = 0;
|
||||
|
||||
// Logs the result of a successful probing attempt.
|
||||
RTC_DEPRECATED virtual void LogProbeResultSuccess(int id,
|
||||
int bitrate_bps) = 0;
|
||||
|
||||
// Logs the result of an unsuccessful probing attempt.
|
||||
RTC_DEPRECATED virtual void LogProbeResultFailure(
|
||||
int id,
|
||||
ProbeFailureReason failure_reason) = 0;
|
||||
};
|
||||
|
||||
// No-op implementation is used if flag is not set, or in tests.
|
||||
|
@ -192,42 +65,8 @@ class RtcEventLogNullImpl : public RtcEventLog {
|
|||
bool StartLogging(std::unique_ptr<RtcEventLogOutput> output) override {
|
||||
return false;
|
||||
}
|
||||
bool StartLogging(const std::string& file_name,
|
||||
int64_t max_size_bytes) override {
|
||||
return false;
|
||||
}
|
||||
bool StartLogging(rtc::PlatformFile platform_file,
|
||||
int64_t max_size_bytes) override {
|
||||
return false;
|
||||
}
|
||||
void StopLogging() override {}
|
||||
void Log(std::unique_ptr<RtcEvent> event) override {}
|
||||
void LogVideoReceiveStreamConfig(
|
||||
const rtclog::StreamConfig& config) override {}
|
||||
void LogVideoSendStreamConfig(const rtclog::StreamConfig& config) override {}
|
||||
void LogAudioReceiveStreamConfig(
|
||||
const rtclog::StreamConfig& config) override {}
|
||||
void LogAudioSendStreamConfig(const rtclog::StreamConfig& config) override {}
|
||||
void LogIncomingRtpHeader(const RtpPacketReceived& packet) override {}
|
||||
void LogOutgoingRtpHeader(const RtpPacketToSend& packet,
|
||||
int probe_cluster_id) override {}
|
||||
void LogIncomingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override {}
|
||||
void LogOutgoingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override {}
|
||||
void LogAudioPlayout(uint32_t ssrc) override {}
|
||||
void LogLossBasedBweUpdate(int32_t bitrate_bps,
|
||||
uint8_t fraction_loss,
|
||||
int32_t total_packets) override {}
|
||||
void LogDelayBasedBweUpdate(int32_t bitrate_bps,
|
||||
BandwidthUsage detector_state) override {}
|
||||
void LogAudioNetworkAdaptation(
|
||||
const AudioEncoderRuntimeConfig& config) override {}
|
||||
void LogProbeClusterCreated(int id,
|
||||
int bitrate_bps,
|
||||
int min_probes,
|
||||
int min_bytes) override{};
|
||||
void LogProbeResultSuccess(int id, int bitrate_bps) override{};
|
||||
void LogProbeResultFailure(int id,
|
||||
ProbeFailureReason failure_reason) override{};
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "call/video_receive_stream.h"
|
||||
#include "call/video_send_stream.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_probe_result_failure.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "logging/rtc_event_log/rtc_stream_config.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
|
||||
|
@ -34,8 +35,11 @@ RTC_POP_IGNORING_WUNDEF()
|
|||
|
||||
namespace webrtc {
|
||||
|
||||
enum class BandwidthUsage;
|
||||
enum class MediaType;
|
||||
|
||||
struct AudioEncoderRuntimeConfig;
|
||||
|
||||
class ParsedRtcEventLog {
|
||||
friend class RtcEventLogTestHelper;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -20,24 +21,7 @@
|
|||
#include "audio/utility/audio_frame_operations.h"
|
||||
#include "call/rtp_transport_controller_send_interface.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
// TODO(eladalon): Remove events/* after removing the deprecated functions.
|
||||
#include "logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_audio_playout.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_logging_started.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_logging_stopped.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_probe_cluster_created.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_probe_result_failure.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_probe_result_success.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h"
|
||||
#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 "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h"
|
||||
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
||||
#include "modules/audio_device/include/audio_device.h"
|
||||
|
@ -86,18 +70,6 @@ class RtcEventLogProxy final : public webrtc::RtcEventLog {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool StartLogging(const std::string& file_name,
|
||||
int64_t max_size_bytes) override {
|
||||
RTC_NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StartLogging(rtc::PlatformFile log_file,
|
||||
int64_t max_size_bytes) override {
|
||||
RTC_NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
void StopLogging() override { RTC_NOTREACHED(); }
|
||||
|
||||
void Log(std::unique_ptr<RtcEvent> event) override {
|
||||
|
@ -107,126 +79,6 @@ class RtcEventLogProxy final : public webrtc::RtcEventLog {
|
|||
}
|
||||
}
|
||||
|
||||
void LogVideoReceiveStreamConfig(
|
||||
const webrtc::rtclog::StreamConfig&) override {
|
||||
RTC_NOTREACHED();
|
||||
}
|
||||
|
||||
void LogVideoSendStreamConfig(const webrtc::rtclog::StreamConfig&) override {
|
||||
RTC_NOTREACHED();
|
||||
}
|
||||
|
||||
void LogAudioReceiveStreamConfig(
|
||||
const webrtc::rtclog::StreamConfig& config) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(rtc::MakeUnique<RtcEventAudioReceiveStreamConfig>(
|
||||
rtc::MakeUnique<webrtc::rtclog::StreamConfig>(config)));
|
||||
}
|
||||
}
|
||||
|
||||
void LogAudioSendStreamConfig(
|
||||
const webrtc::rtclog::StreamConfig& config) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(rtc::MakeUnique<RtcEventAudioSendStreamConfig>(
|
||||
rtc::MakeUnique<webrtc::rtclog::StreamConfig>(config)));
|
||||
}
|
||||
}
|
||||
|
||||
void LogIncomingRtpHeader(const RtpPacketReceived& packet) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(rtc::MakeUnique<RtcEventRtpPacketIncoming>(packet));
|
||||
}
|
||||
}
|
||||
|
||||
void LogOutgoingRtpHeader(const RtpPacketToSend& packet,
|
||||
int probe_cluster_id) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(
|
||||
rtc::MakeUnique<RtcEventRtpPacketOutgoing>(packet, probe_cluster_id));
|
||||
}
|
||||
}
|
||||
|
||||
void LogIncomingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(rtc::MakeUnique<RtcEventRtcpPacketIncoming>(packet));
|
||||
}
|
||||
}
|
||||
|
||||
void LogOutgoingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(rtc::MakeUnique<RtcEventRtcpPacketOutgoing>(packet));
|
||||
}
|
||||
}
|
||||
|
||||
void LogAudioPlayout(uint32_t ssrc) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(rtc::MakeUnique<RtcEventAudioPlayout>(ssrc));
|
||||
}
|
||||
}
|
||||
|
||||
void LogLossBasedBweUpdate(int32_t bitrate_bps,
|
||||
uint8_t fraction_loss,
|
||||
int32_t total_packets) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(rtc::MakeUnique<RtcEventBweUpdateLossBased>(
|
||||
bitrate_bps, fraction_loss, total_packets));
|
||||
}
|
||||
}
|
||||
|
||||
void LogDelayBasedBweUpdate(int32_t bitrate_bps,
|
||||
BandwidthUsage detector_state) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(rtc::MakeUnique<RtcEventBweUpdateDelayBased>(
|
||||
bitrate_bps, detector_state));
|
||||
}
|
||||
}
|
||||
|
||||
void LogAudioNetworkAdaptation(
|
||||
const AudioEncoderRuntimeConfig& config) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(rtc::MakeUnique<RtcEventAudioNetworkAdaptation>(
|
||||
rtc::MakeUnique<AudioEncoderRuntimeConfig>(config)));
|
||||
}
|
||||
}
|
||||
|
||||
void LogProbeClusterCreated(int id,
|
||||
int bitrate_bps,
|
||||
int min_probes,
|
||||
int min_bytes) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(rtc::MakeUnique<RtcEventProbeClusterCreated>(
|
||||
id, bitrate_bps, min_probes, min_bytes));
|
||||
}
|
||||
};
|
||||
|
||||
void LogProbeResultSuccess(int id, int bitrate_bps) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(
|
||||
rtc::MakeUnique<RtcEventProbeResultSuccess>(id, bitrate_bps));
|
||||
}
|
||||
};
|
||||
|
||||
void LogProbeResultFailure(int id,
|
||||
ProbeFailureReason failure_reason) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->Log(
|
||||
rtc::MakeUnique<RtcEventProbeResultFailure>(id, failure_reason));
|
||||
}
|
||||
};
|
||||
|
||||
void SetEventLog(RtcEventLog* event_log) {
|
||||
rtc::CritScope lock(&crit_);
|
||||
event_log_ = event_log;
|
||||
|
|
Loading…
Reference in a new issue