Rewrite the RtcEventLog unit test.

Bug: webrtc:8111
Change-Id: I36780940b54bf500244c6755113153c84c997942
Reviewed-on: https://webrtc-review.googlesource.com/80660
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23736}
This commit is contained in:
Bjorn Terelius
2018-06-26 11:41:27 +02:00
committed by Commit Bot
parent 712678b4fe
commit f4db542a9b
45 changed files with 1790 additions and 1277 deletions

View File

@ -39,6 +39,7 @@ rtc_source_set("rtc_event_log_api") {
deps = [
"../api:libjingle_logging_api",
"../rtc_base:ptr_util",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_task_queue",
]
@ -66,6 +67,7 @@ rtc_source_set("rtc_event_pacing") {
deps = [
":rtc_event_log_api",
"../:typedefs",
"../rtc_base:ptr_util",
]
}
@ -85,6 +87,7 @@ rtc_source_set("rtc_event_audio") {
":rtc_event_log_api",
":rtc_stream_config",
"../modules/audio_coding:audio_network_adaptor_config",
"../rtc_base:ptr_util",
]
}
@ -105,6 +108,7 @@ rtc_source_set("rtc_event_bwe") {
deps = [
":rtc_event_log_api",
"../modules/remote_bitrate_estimator:remote_bitrate_estimator",
"../rtc_base:ptr_util",
]
}
@ -124,6 +128,7 @@ rtc_source_set("rtc_event_rtp_rtcp") {
":rtc_event_log_api",
"../api:array_view",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../rtc_base:ptr_util",
"../rtc_base:rtc_base_approved",
]
}
@ -139,6 +144,7 @@ rtc_source_set("rtc_event_video") {
deps = [
":rtc_event_log_api",
":rtc_stream_config",
"../rtc_base:ptr_util",
]
}
@ -314,6 +320,7 @@ if (rtc_enable_protobuf) {
"rtc_event_log/rtc_event_log_unittest_helper.h",
]
deps = [
":ice_log",
":rtc_event_audio",
":rtc_event_bwe",
":rtc_event_log_api",
@ -322,6 +329,7 @@ if (rtc_enable_protobuf) {
":rtc_event_log_impl_output",
":rtc_event_log_parser",
":rtc_event_log_proto",
":rtc_event_pacing",
":rtc_event_rtp_rtcp",
":rtc_event_video",
":rtc_stream_config",

View File

@ -11,7 +11,7 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_H_
#include <typedefs.h>
#include <memory>
#include "rtc_base/timeutils.h"
@ -57,7 +57,12 @@ class RtcEvent {
virtual bool IsConfigEvent() const = 0;
virtual std::unique_ptr<RtcEvent> Copy() const = 0;
const int64_t timestamp_us_;
protected:
explicit RtcEvent(int64_t timestamp_us) : timestamp_us_(timestamp_us) {}
};
} // namespace webrtc

View File

@ -9,6 +9,7 @@
*/
#include "logging/rtc_event_log/events/rtc_event_alr_state.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
@ -24,4 +25,8 @@ bool RtcEventAlrState::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventAlrState::Copy() const {
return rtc::MakeUnique<RtcEventAlrState>(in_alr_);
}
} // namespace webrtc

View File

@ -11,9 +11,9 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_ALR_STATE_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_ALR_STATE_H_
#include "logging/rtc_event_log/events/rtc_event.h"
#include <memory>
#include "typedefs.h" // NOLINT(build/include)
#include "logging/rtc_event_log/events/rtc_event.h"
namespace webrtc {
@ -26,6 +26,8 @@ class RtcEventAlrState final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const bool in_alr_;
};

View File

@ -13,6 +13,7 @@
#include <utility>
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
@ -30,4 +31,10 @@ bool RtcEventAudioNetworkAdaptation::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventAudioNetworkAdaptation::Copy() const {
auto config_copy = rtc::MakeUnique<AudioEncoderRuntimeConfig>(*config_);
return rtc::MakeUnique<RtcEventAudioNetworkAdaptation>(
std::move(config_copy));
}
} // namespace webrtc

View File

@ -29,6 +29,8 @@ class RtcEventAudioNetworkAdaptation final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const std::unique_ptr<const AudioEncoderRuntimeConfig> config_;
};

View File

@ -10,6 +10,8 @@
#include "logging/rtc_event_log/events/rtc_event_audio_playout.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
RtcEventAudioPlayout::RtcEventAudioPlayout(uint32_t ssrc) : ssrc_(ssrc) {}
@ -22,4 +24,8 @@ bool RtcEventAudioPlayout::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventAudioPlayout::Copy() const {
return rtc::MakeUnique<RtcEventAudioPlayout>(ssrc_);
}
} // namespace webrtc

View File

@ -11,6 +11,8 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_AUDIO_PLAYOUT_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_AUDIO_PLAYOUT_H_
#include <memory>
#include "logging/rtc_event_log/events/rtc_event.h"
namespace webrtc {
@ -24,6 +26,8 @@ class RtcEventAudioPlayout final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const uint32_t ssrc_;
};

View File

@ -13,6 +13,7 @@
#include <utility>
#include "logging/rtc_event_log/rtc_stream_config.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
@ -30,4 +31,10 @@ bool RtcEventAudioReceiveStreamConfig::IsConfigEvent() const {
return true;
}
std::unique_ptr<RtcEvent> RtcEventAudioReceiveStreamConfig::Copy() const {
auto config_copy = rtc::MakeUnique<rtclog::StreamConfig>(*config_);
return rtc::MakeUnique<RtcEventAudioReceiveStreamConfig>(
std::move(config_copy));
}
} // namespace webrtc

View File

@ -31,6 +31,8 @@ class RtcEventAudioReceiveStreamConfig final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const std::unique_ptr<const rtclog::StreamConfig> config_;
};

View File

@ -13,6 +13,7 @@
#include <utility>
#include "logging/rtc_event_log/rtc_stream_config.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
@ -30,4 +31,9 @@ bool RtcEventAudioSendStreamConfig::IsConfigEvent() const {
return true;
}
std::unique_ptr<RtcEvent> RtcEventAudioSendStreamConfig::Copy() const {
auto config_copy = rtc::MakeUnique<rtclog::StreamConfig>(*config_);
return rtc::MakeUnique<RtcEventAudioSendStreamConfig>(std::move(config_copy));
}
} // namespace webrtc

View File

@ -31,6 +31,8 @@ class RtcEventAudioSendStreamConfig final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const std::unique_ptr<const rtclog::StreamConfig> config_;
};

View File

@ -11,6 +11,7 @@
#include "logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h"
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
@ -29,4 +30,9 @@ bool RtcEventBweUpdateDelayBased::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventBweUpdateDelayBased::Copy() const {
return rtc::MakeUnique<RtcEventBweUpdateDelayBased>(bitrate_bps_,
detector_state_);
}
} // namespace webrtc

View File

@ -11,6 +11,8 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_BWE_UPDATE_DELAY_BASED_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_BWE_UPDATE_DELAY_BASED_H_
#include <memory>
#include "logging/rtc_event_log/events/rtc_event.h"
namespace webrtc {
@ -27,6 +29,8 @@ class RtcEventBweUpdateDelayBased final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const int32_t bitrate_bps_;
const BandwidthUsage detector_state_;
};

View File

@ -10,6 +10,8 @@
#include "logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
RtcEventBweUpdateLossBased::RtcEventBweUpdateLossBased(int32_t bitrate_bps,
@ -29,4 +31,9 @@ bool RtcEventBweUpdateLossBased::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventBweUpdateLossBased::Copy() const {
return rtc::MakeUnique<RtcEventBweUpdateLossBased>(
bitrate_bps_, fraction_loss_, total_packets_);
}
} // namespace webrtc

View File

@ -11,6 +11,8 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_BWE_UPDATE_LOSS_BASED_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_BWE_UPDATE_LOSS_BASED_H_
#include <memory>
#include "logging/rtc_event_log/events/rtc_event.h"
namespace webrtc {
@ -26,6 +28,8 @@ class RtcEventBweUpdateLossBased final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const int32_t bitrate_bps_;
const uint8_t fraction_loss_;
const int32_t total_packets_;

View File

@ -10,6 +10,8 @@
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
RtcEventIceCandidatePair::RtcEventIceCandidatePair(
@ -27,4 +29,8 @@ bool RtcEventIceCandidatePair::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventIceCandidatePair::Copy() const {
return rtc::MakeUnique<RtcEventIceCandidatePair>(type_, candidate_pair_id_);
}
} // namespace webrtc

View File

@ -11,9 +11,9 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_ICE_CANDIDATE_PAIR_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_ICE_CANDIDATE_PAIR_H_
#include "logging/rtc_event_log/events/rtc_event.h"
#include <memory>
#include <string>
#include "logging/rtc_event_log/events/rtc_event.h"
namespace webrtc {
@ -36,6 +36,8 @@ class RtcEventIceCandidatePair final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const IceCandidatePairEventType type_;
const uint32_t candidate_pair_id_;
};

View File

@ -10,6 +10,8 @@
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
IceCandidatePairDescription::IceCandidatePairDescription() {
@ -55,4 +57,9 @@ bool RtcEventIceCandidatePairConfig::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventIceCandidatePairConfig::Copy() const {
return rtc::MakeUnique<RtcEventIceCandidatePairConfig>(
type_, candidate_pair_id_, candidate_pair_desc_);
}
} // namespace webrtc

View File

@ -11,9 +11,9 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_ICE_CANDIDATE_PAIR_CONFIG_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_ICE_CANDIDATE_PAIR_CONFIG_H_
#include "logging/rtc_event_log/events/rtc_event.h"
#include <memory>
#include <string>
#include "logging/rtc_event_log/events/rtc_event.h"
namespace webrtc {
@ -92,6 +92,8 @@ class RtcEventIceCandidatePairConfig final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const IceCandidatePairConfigType type_;
const uint32_t candidate_pair_id_;
const IceCandidatePairDescription candidate_pair_desc_;

View File

@ -10,6 +10,8 @@
#include "logging/rtc_event_log/events/rtc_event_probe_cluster_created.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
RtcEventProbeClusterCreated::RtcEventProbeClusterCreated(int32_t id,
@ -29,4 +31,9 @@ bool RtcEventProbeClusterCreated::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventProbeClusterCreated::Copy() const {
return rtc::MakeUnique<RtcEventProbeClusterCreated>(id_, bitrate_bps_,
min_probes_, min_bytes_);
}
} // namespace webrtc

View File

@ -11,6 +11,8 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_PROBE_CLUSTER_CREATED_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_PROBE_CLUSTER_CREATED_H_
#include <memory>
#include "logging/rtc_event_log/events/rtc_event.h"
namespace webrtc {
@ -27,6 +29,8 @@ class RtcEventProbeClusterCreated final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const int32_t id_;
const int32_t bitrate_bps_;
const uint32_t min_probes_;

View File

@ -10,6 +10,8 @@
#include "logging/rtc_event_log/events/rtc_event_probe_result_failure.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
RtcEventProbeResultFailure::RtcEventProbeResultFailure(
@ -25,4 +27,8 @@ bool RtcEventProbeResultFailure::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventProbeResultFailure::Copy() const {
return rtc::MakeUnique<RtcEventProbeResultFailure>(id_, failure_reason_);
}
} // namespace webrtc

View File

@ -11,6 +11,8 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_PROBE_RESULT_FAILURE_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_PROBE_RESULT_FAILURE_H_
#include <memory>
#include "logging/rtc_event_log/events/rtc_event.h"
namespace webrtc {
@ -31,6 +33,8 @@ class RtcEventProbeResultFailure final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const int32_t id_;
const ProbeFailureReason failure_reason_;
};

View File

@ -10,6 +10,8 @@
#include "logging/rtc_event_log/events/rtc_event_probe_result_success.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
RtcEventProbeResultSuccess::RtcEventProbeResultSuccess(int32_t id,
@ -24,4 +26,8 @@ bool RtcEventProbeResultSuccess::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventProbeResultSuccess::Copy() const {
return rtc::MakeUnique<RtcEventProbeResultSuccess>(id_, bitrate_bps_);
}
} // namespace webrtc

View File

@ -11,6 +11,8 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_PROBE_RESULT_SUCCESS_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_PROBE_RESULT_SUCCESS_H_
#include <memory>
#include "logging/rtc_event_log/events/rtc_event.h"
namespace webrtc {
@ -24,6 +26,8 @@ class RtcEventProbeResultSuccess final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const int32_t id_;
const int32_t bitrate_bps_;
};

View File

@ -10,6 +10,8 @@
#include "logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
RtcEventRtcpPacketIncoming::RtcEventRtcpPacketIncoming(
@ -26,4 +28,9 @@ bool RtcEventRtcpPacketIncoming::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventRtcpPacketIncoming::Copy() const {
return rtc::MakeUnique<RtcEventRtcpPacketIncoming>(
rtc::ArrayView<const uint8_t>(packet_.data(), packet_.size()));
}
} // namespace webrtc

View File

@ -11,6 +11,8 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTCP_PACKET_INCOMING_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTCP_PACKET_INCOMING_H_
#include <memory>
#include "api/array_view.h"
#include "logging/rtc_event_log/events/rtc_event.h"
#include "rtc_base/buffer.h"
@ -26,6 +28,8 @@ class RtcEventRtcpPacketIncoming final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
rtc::Buffer packet_;
};

View File

@ -10,6 +10,8 @@
#include "logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
RtcEventRtcpPacketOutgoing::RtcEventRtcpPacketOutgoing(
@ -26,4 +28,9 @@ bool RtcEventRtcpPacketOutgoing::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventRtcpPacketOutgoing::Copy() const {
return rtc::MakeUnique<RtcEventRtcpPacketOutgoing>(
rtc::ArrayView<const uint8_t>(packet_.data(), packet_.size()));
}
} // namespace webrtc

View File

@ -11,6 +11,8 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTCP_PACKET_OUTGOING_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTCP_PACKET_OUTGOING_H_
#include <memory>
#include "api/array_view.h"
#include "logging/rtc_event_log/events/rtc_event.h"
#include "rtc_base/buffer.h"
@ -26,6 +28,8 @@ class RtcEventRtcpPacketOutgoing final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
rtc::Buffer packet_;
};

View File

@ -11,6 +11,7 @@
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
@ -20,6 +21,12 @@ RtcEventRtpPacketIncoming::RtcEventRtpPacketIncoming(
header_.CopyHeaderFrom(packet);
}
RtcEventRtpPacketIncoming::RtcEventRtpPacketIncoming(
const RtcEventRtpPacketIncoming& other)
: RtcEvent(other.timestamp_us_), packet_length_(other.packet_length_) {
header_.CopyHeaderFrom(other.header_);
}
RtcEventRtpPacketIncoming::~RtcEventRtpPacketIncoming() = default;
RtcEvent::Type RtcEventRtpPacketIncoming::GetType() const {
@ -30,4 +37,8 @@ bool RtcEventRtpPacketIncoming::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventRtpPacketIncoming::Copy() const {
return rtc::MakeUnique<RtcEventRtpPacketIncoming>(*this);
}
} // namespace webrtc

View File

@ -11,6 +11,8 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTP_PACKET_INCOMING_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTP_PACKET_INCOMING_H_
#include <memory>
#include "logging/rtc_event_log/events/rtc_event.h"
#include "modules/rtp_rtcp/source/rtp_packet.h"
@ -21,12 +23,15 @@ class RtpPacketReceived;
class RtcEventRtpPacketIncoming final : public RtcEvent {
public:
explicit RtcEventRtpPacketIncoming(const RtpPacketReceived& packet);
RtcEventRtpPacketIncoming(const RtcEventRtpPacketIncoming& other);
~RtcEventRtpPacketIncoming() override;
Type GetType() const override;
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
RtpPacket header_; // Only the packet's header will be stored here.
const size_t packet_length_; // Length before stripping away all but header.
};

View File

@ -11,6 +11,7 @@
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h"
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
@ -21,6 +22,14 @@ RtcEventRtpPacketOutgoing::RtcEventRtpPacketOutgoing(
header_.CopyHeaderFrom(packet);
}
RtcEventRtpPacketOutgoing::RtcEventRtpPacketOutgoing(
const RtcEventRtpPacketOutgoing& other)
: RtcEvent(other.timestamp_us_),
packet_length_(other.packet_length_),
probe_cluster_id_(other.probe_cluster_id_) {
header_.CopyHeaderFrom(other.header_);
}
RtcEventRtpPacketOutgoing::~RtcEventRtpPacketOutgoing() = default;
RtcEvent::Type RtcEventRtpPacketOutgoing::GetType() const {
@ -31,4 +40,8 @@ bool RtcEventRtpPacketOutgoing::IsConfigEvent() const {
return false;
}
std::unique_ptr<RtcEvent> RtcEventRtpPacketOutgoing::Copy() const {
return rtc::MakeUnique<RtcEventRtpPacketOutgoing>(*this);
}
} // namespace webrtc

View File

@ -11,6 +11,8 @@
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTP_PACKET_OUTGOING_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTP_PACKET_OUTGOING_H_
#include <memory>
#include "logging/rtc_event_log/events/rtc_event.h"
#include "modules/rtp_rtcp/source/rtp_packet.h"
@ -22,12 +24,15 @@ class RtcEventRtpPacketOutgoing final : public RtcEvent {
public:
RtcEventRtpPacketOutgoing(const RtpPacketToSend& packet,
int probe_cluster_id);
RtcEventRtpPacketOutgoing(const RtcEventRtpPacketOutgoing& other);
~RtcEventRtpPacketOutgoing() override;
Type GetType() const override;
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
RtpPacket header_; // Only the packet's header will be stored here.
const size_t packet_length_; // Length before stripping away all but header.
const int probe_cluster_id_;

View File

@ -12,6 +12,8 @@
#include <utility>
#include "rtc_base/ptr_util.h"
namespace webrtc {
RtcEventVideoReceiveStreamConfig::RtcEventVideoReceiveStreamConfig(
@ -28,4 +30,10 @@ bool RtcEventVideoReceiveStreamConfig::IsConfigEvent() const {
return true;
}
std::unique_ptr<RtcEvent> RtcEventVideoReceiveStreamConfig::Copy() const {
auto config_copy = rtc::MakeUnique<rtclog::StreamConfig>(*config_);
return rtc::MakeUnique<RtcEventVideoReceiveStreamConfig>(
std::move(config_copy));
}
} // namespace webrtc

View File

@ -28,6 +28,8 @@ class RtcEventVideoReceiveStreamConfig final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const std::unique_ptr<const rtclog::StreamConfig> config_;
};

View File

@ -12,6 +12,8 @@
#include <utility>
#include "rtc_base/ptr_util.h"
namespace webrtc {
RtcEventVideoSendStreamConfig::RtcEventVideoSendStreamConfig(
@ -28,4 +30,9 @@ bool RtcEventVideoSendStreamConfig::IsConfigEvent() const {
return true;
}
std::unique_ptr<RtcEvent> RtcEventVideoSendStreamConfig::Copy() const {
auto config_copy = rtc::MakeUnique<rtclog::StreamConfig>(*config_);
return rtc::MakeUnique<RtcEventVideoSendStreamConfig>(std::move(config_copy));
}
} // namespace webrtc

View File

@ -28,6 +28,8 @@ class RtcEventVideoSendStreamConfig final : public RtcEvent {
bool IsConfigEvent() const override;
std::unique_ptr<RtcEvent> Copy() const override;
const std::unique_ptr<const rtclog::StreamConfig> config_;
};

View File

@ -532,6 +532,8 @@ void ParsedRtcEventLogNew::StoreParsedEvent(const rtclog::Event& event) {
rtp_parser.Parse(&parsed_header, extension_map);
} else {
// Use the default extension map.
// TODO(terelius): This should be removed. GetRtpHeader will return the
// default map if the parser is configured for it.
// TODO(ivoc): Once configuration of audio streams is stored in the
// event log, this can be removed.
// Tracking bug: webrtc:6399

View File

@ -677,6 +677,23 @@ class ParsedRtcEventLogNew {
return outgoing_audio_ssrcs_;
}
// Stream configurations.
const std::vector<LoggedAudioRecvConfig>& audio_recv_configs() const {
return audio_recv_configs_;
}
const std::vector<LoggedAudioSendConfig>& audio_send_configs() const {
return audio_send_configs_;
}
const std::vector<LoggedVideoRecvConfig>& video_recv_configs() const {
return video_recv_configs_;
}
const std::vector<LoggedVideoSendConfig>& video_send_configs() const {
return video_send_configs_;
}
// Beginning and end of log segments.
const std::vector<LoggedStartEvent>& start_log_events() const {
return start_log_events_;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -11,83 +11,180 @@
#ifndef LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_UNITTEST_HELPER_H_
#define LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_UNITTEST_HELPER_H_
#include "call/call.h"
#include <memory>
#include "logging/rtc_event_log/events/rtc_event.h"
#include "logging/rtc_event_log/events/rtc_event_alr_state.h"
#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_ice_candidate_pair.h"
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.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/rtc_event_log_parser_new.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
#include "modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
#include "modules/rtp_rtcp/source/rtcp_packet/sender_report.h"
#include "rtc_base/random.h"
namespace webrtc {
class RtcEventLogTestHelper {
namespace test {
class EventGenerator {
public:
static void VerifyVideoReceiveStreamConfig(
const ParsedRtcEventLogNew& parsed_log,
size_t index,
const rtclog::StreamConfig& config);
static void VerifyVideoSendStreamConfig(
const ParsedRtcEventLogNew& parsed_log,
size_t index,
const rtclog::StreamConfig& config);
static void VerifyAudioReceiveStreamConfig(
const ParsedRtcEventLogNew& parsed_log,
size_t index,
const rtclog::StreamConfig& config);
static void VerifyAudioSendStreamConfig(
const ParsedRtcEventLogNew& parsed_log,
size_t index,
const rtclog::StreamConfig& config);
static void VerifyIncomingRtpEvent(const ParsedRtcEventLogNew& parsed_log,
size_t index,
const RtpPacketReceived& expected_packet);
static void VerifyOutgoingRtpEvent(const ParsedRtcEventLogNew& parsed_log,
size_t index,
const RtpPacketToSend& expected_packet);
static void VerifyRtcpEvent(const ParsedRtcEventLogNew& parsed_log,
size_t index,
PacketDirection direction,
const uint8_t* packet,
size_t total_size);
static void VerifyPlayoutEvent(const ParsedRtcEventLogNew& parsed_log,
size_t index,
uint32_t ssrc);
static void VerifyBweLossEvent(const ParsedRtcEventLogNew& parsed_log,
size_t index,
int32_t bitrate,
uint8_t fraction_loss,
int32_t total_packets);
static void VerifyBweDelayEvent(const ParsedRtcEventLogNew& parsed_log,
size_t index,
int32_t bitrate,
BandwidthUsage detector_state);
explicit EventGenerator(uint64_t seed) : prng_(seed) {}
static void VerifyAudioNetworkAdaptation(
const ParsedRtcEventLogNew& parsed_log,
size_t index,
const AudioEncoderRuntimeConfig& config);
std::unique_ptr<RtcEventAlrState> NewAlrState();
static void VerifyLogStartEvent(const ParsedRtcEventLogNew& parsed_log,
size_t index);
static void VerifyLogEndEvent(const ParsedRtcEventLogNew& parsed_log,
size_t index);
std::unique_ptr<RtcEventAudioPlayout> NewAudioPlayout(uint32_t ssrc);
static void VerifyBweProbeCluster(const ParsedRtcEventLogNew& parsed_log,
size_t index,
int32_t id,
int32_t bitrate_bps,
uint32_t min_probes,
uint32_t min_bytes);
std::unique_ptr<RtcEventAudioNetworkAdaptation> NewAudioNetworkAdaptation();
static void VerifyProbeResultSuccess(const ParsedRtcEventLogNew& parsed_log,
size_t index,
int32_t id,
int32_t bitrate_bps);
std::unique_ptr<RtcEventBweUpdateDelayBased> NewBweUpdateDelayBased();
static void VerifyProbeResultFailure(const ParsedRtcEventLogNew& parsed_log,
size_t index,
int32_t id,
ProbeFailureReason failure_reason);
std::unique_ptr<RtcEventBweUpdateLossBased> NewBweUpdateLossBased();
std::unique_ptr<RtcEventProbeClusterCreated> NewProbeClusterCreated();
std::unique_ptr<RtcEventProbeResultFailure> NewProbeResultFailure();
std::unique_ptr<RtcEventProbeResultSuccess> NewProbeResultSuccess();
std::unique_ptr<RtcEventIceCandidatePairConfig> NewIceCandidatePairConfig();
std::unique_ptr<RtcEventIceCandidatePair> NewIceCandidatePair();
std::unique_ptr<RtcEventRtcpPacketIncoming> NewRtcpPacketIncoming();
std::unique_ptr<RtcEventRtcpPacketOutgoing> NewRtcpPacketOutgoing();
void RandomizeRtpPacket(size_t packet_size,
uint32_t ssrc,
const RtpHeaderExtensionMap& extension_map,
RtpPacket* rtp_packet);
std::unique_ptr<RtcEventRtpPacketIncoming> NewRtpPacketIncoming(
uint32_t ssrc,
const RtpHeaderExtensionMap& extension_map);
std::unique_ptr<RtcEventRtpPacketOutgoing> NewRtpPacketOutgoing(
uint32_t ssrc,
const RtpHeaderExtensionMap& extension_map);
RtpHeaderExtensionMap NewRtpHeaderExtensionMap();
std::unique_ptr<RtcEventAudioReceiveStreamConfig> NewAudioReceiveStreamConfig(
uint32_t ssrc,
const RtpHeaderExtensionMap& extensions);
std::unique_ptr<RtcEventAudioSendStreamConfig> NewAudioSendStreamConfig(
uint32_t ssrc,
const RtpHeaderExtensionMap& extensions);
std::unique_ptr<RtcEventVideoReceiveStreamConfig> NewVideoReceiveStreamConfig(
uint32_t ssrc,
const RtpHeaderExtensionMap& extensions);
std::unique_ptr<RtcEventVideoSendStreamConfig> NewVideoSendStreamConfig(
uint32_t ssrc,
const RtpHeaderExtensionMap& extensions);
private:
rtcp::ReportBlock NewReportBlock();
rtcp::SenderReport NewSenderReport();
rtcp::ReceiverReport NewReceiverReport();
Random prng_;
};
bool VerifyLoggedAlrStateEvent(const RtcEventAlrState& original_event,
const LoggedAlrStateEvent& logged_event);
bool VerifyLoggedAudioPlayoutEvent(const RtcEventAudioPlayout& original_event,
const LoggedAudioPlayoutEvent& logged_event);
bool VerifyLoggedAudioNetworkAdaptationEvent(
const RtcEventAudioNetworkAdaptation& original_event,
const LoggedAudioNetworkAdaptationEvent& logged_event);
bool VerifyLoggedBweDelayBasedUpdate(
const RtcEventBweUpdateDelayBased& original_event,
const LoggedBweDelayBasedUpdate& logged_event);
bool VerifyLoggedBweLossBasedUpdate(
const RtcEventBweUpdateLossBased& original_event,
const LoggedBweLossBasedUpdate& logged_event);
bool VerifyLoggedBweProbeClusterCreatedEvent(
const RtcEventProbeClusterCreated& original_event,
const LoggedBweProbeClusterCreatedEvent& logged_event);
bool VerifyLoggedBweProbeFailureEvent(
const RtcEventProbeResultFailure& original_event,
const LoggedBweProbeFailureEvent& logged_event);
bool VerifyLoggedBweProbeSuccessEvent(
const RtcEventProbeResultSuccess& original_event,
const LoggedBweProbeSuccessEvent& logged_event);
bool VerifyLoggedIceCandidatePairConfig(
const RtcEventIceCandidatePairConfig& original_event,
const LoggedIceCandidatePairConfig& logged_event);
bool VerifyLoggedIceCandidatePairEvent(
const RtcEventIceCandidatePair& original_event,
const LoggedIceCandidatePairEvent& logged_event);
bool VerifyLoggedRtpPacketIncoming(
const RtcEventRtpPacketIncoming& original_event,
const LoggedRtpPacketIncoming& logged_event);
bool VerifyLoggedRtpPacketOutgoing(
const RtcEventRtpPacketOutgoing& original_event,
const LoggedRtpPacketOutgoing& logged_event);
bool VerifyLoggedRtcpPacketIncoming(
const RtcEventRtcpPacketIncoming& original_event,
const LoggedRtcpPacketIncoming& logged_event);
bool VerifyLoggedRtcpPacketOutgoing(
const RtcEventRtcpPacketOutgoing& original_event,
const LoggedRtcpPacketOutgoing& logged_event);
bool VerifyLoggedStartEvent(int64_t start_time_us,
const LoggedStartEvent& logged_event);
bool VerifyLoggedStopEvent(int64_t stop_time_us,
const LoggedStopEvent& logged_event);
bool VerifyLoggedAudioRecvConfig(
const RtcEventAudioReceiveStreamConfig& original_event,
const LoggedAudioRecvConfig& logged_event);
bool VerifyLoggedAudioSendConfig(
const RtcEventAudioSendStreamConfig& original_event,
const LoggedAudioSendConfig& logged_event);
bool VerifyLoggedVideoRecvConfig(
const RtcEventVideoReceiveStreamConfig& original_event,
const LoggedVideoRecvConfig& logged_event);
bool VerifyLoggedVideoSendConfig(
const RtcEventVideoSendStreamConfig& original_event,
const LoggedVideoSendConfig& logged_event);
} // namespace test
} // namespace webrtc
#endif // LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_UNITTEST_HELPER_H_

View File

@ -17,6 +17,8 @@ StreamConfig::StreamConfig() {}
StreamConfig::~StreamConfig() {}
StreamConfig::StreamConfig(const StreamConfig& other) = default;
bool StreamConfig::operator==(const StreamConfig& other) const {
return local_ssrc == other.local_ssrc && remote_ssrc == other.remote_ssrc &&
rtx_ssrc == other.rtx_ssrc && rsid == other.rsid &&
@ -24,6 +26,10 @@ bool StreamConfig::operator==(const StreamConfig& other) const {
rtp_extensions == other.rtp_extensions && codecs == other.codecs;
}
bool StreamConfig::operator!=(const StreamConfig& other) const {
return !(*this == other);
}
StreamConfig::Codec::Codec(const std::string& payload_name,
int payload_type,
int rtx_payload_type)

View File

@ -23,9 +23,11 @@ namespace rtclog {
struct StreamConfig {
StreamConfig();
StreamConfig(const StreamConfig& other);
~StreamConfig();
bool operator==(const StreamConfig& other) const;
bool operator!=(const StreamConfig& other) const;
uint32_t local_ssrc = 0;
uint32_t remote_ssrc = 0;