mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 22:00:47 +01:00
In RtcEventLogEncoderNewFormat use propagated instead of global field trials
Bug: webrtc:10335 Change-Id: Id407a7bc25375cadccba4cf4ae0c771f22a19a0e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/333581 Reviewed-by: Björn Terelius <terelius@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41644}
This commit is contained in:
parent
c0741e9f12
commit
14b016fbf9
5 changed files with 131 additions and 68 deletions
|
@ -353,6 +353,7 @@ rtc_library("rtc_event_log_impl_encoder") {
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":rtc_event_number_encodings",
|
":rtc_event_number_encodings",
|
||||||
|
"../api:field_trials_view",
|
||||||
"../api:rtp_headers",
|
"../api:rtp_headers",
|
||||||
"../api:rtp_parameters",
|
"../api:rtp_parameters",
|
||||||
"../api/transport:network_control",
|
"../api/transport:network_control",
|
||||||
|
@ -362,7 +363,6 @@ rtc_library("rtc_event_log_impl_encoder") {
|
||||||
"../rtc_base:checks",
|
"../rtc_base:checks",
|
||||||
"../rtc_base:logging",
|
"../rtc_base:logging",
|
||||||
"../rtc_base:safe_conversions",
|
"../rtc_base:safe_conversions",
|
||||||
"../system_wrappers:field_trial",
|
|
||||||
]
|
]
|
||||||
absl_deps = [
|
absl_deps = [
|
||||||
"//third_party/abseil-cpp/absl/memory",
|
"//third_party/abseil-cpp/absl/memory",
|
||||||
|
@ -617,6 +617,7 @@ if (rtc_enable_protobuf) {
|
||||||
"../api/environment:environment_factory",
|
"../api/environment:environment_factory",
|
||||||
"../api/rtc_event_log",
|
"../api/rtc_event_log",
|
||||||
"../api/rtc_event_log:rtc_event_log_factory",
|
"../api/rtc_event_log:rtc_event_log_factory",
|
||||||
|
"../api/transport:field_trial_based_config",
|
||||||
"../api/units:time_delta",
|
"../api/units:time_delta",
|
||||||
"../api/units:timestamp",
|
"../api/units:timestamp",
|
||||||
"../call",
|
"../call",
|
||||||
|
|
|
@ -10,8 +10,11 @@
|
||||||
|
|
||||||
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h"
|
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h"
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "absl/types/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/array_view.h"
|
#include "api/array_view.h"
|
||||||
|
#include "api/field_trials_view.h"
|
||||||
#include "api/network_state_predictor.h"
|
#include "api/network_state_predictor.h"
|
||||||
#include "logging/rtc_event_log/dependency_descriptor_encoder_decoder.h"
|
#include "logging/rtc_event_log/dependency_descriptor_encoder_decoder.h"
|
||||||
#include "logging/rtc_event_log/encoder/blob_encoding.h"
|
#include "logging/rtc_event_log/encoder/blob_encoding.h"
|
||||||
|
@ -62,7 +65,6 @@
|
||||||
#include "modules/rtp_rtcp/source/rtp_packet.h"
|
#include "modules/rtp_rtcp/source/rtp_packet.h"
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
#include "rtc_base/logging.h"
|
#include "rtc_base/logging.h"
|
||||||
#include "system_wrappers/include/field_trial.h"
|
|
||||||
|
|
||||||
// *.pb.h files are generated at build-time by the protobuf compiler.
|
// *.pb.h files are generated at build-time by the protobuf compiler.
|
||||||
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
|
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
|
||||||
|
@ -381,10 +383,12 @@ void EncodeRtcpPacket(rtc::ArrayView<const EventType*> batch,
|
||||||
}
|
}
|
||||||
proto_batch->set_raw_packet_blobs(EncodeBlobs(scrubed_packets));
|
proto_batch->set_raw_packet_blobs(EncodeBlobs(scrubed_packets));
|
||||||
}
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
template <typename EventType, typename ProtoType>
|
template <typename Batch, typename ProtoType>
|
||||||
void EncodeRtpPacket(const std::vector<const EventType*>& batch,
|
void RtcEventLogEncoderNewFormat::EncodeRtpPacket(const Batch& batch,
|
||||||
ProtoType* proto_batch) {
|
ProtoType* proto_batch) {
|
||||||
|
using EventType = std::remove_pointer_t<typename Batch::value_type>;
|
||||||
if (batch.empty()) {
|
if (batch.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -459,8 +463,7 @@ void EncodeRtpPacket(const std::vector<const EventType*>& batch,
|
||||||
{
|
{
|
||||||
// TODO(webrtc:14975) Remove this kill switch after DD in RTC event log has
|
// TODO(webrtc:14975) Remove this kill switch after DD in RTC event log has
|
||||||
// been rolled out.
|
// been rolled out.
|
||||||
if (!webrtc::field_trial::IsDisabled(
|
if (encode_dependency_descriptor_) {
|
||||||
"WebRTC-RtcEventLogEncodeDependencyDescriptor")) {
|
|
||||||
std::vector<rtc::ArrayView<const uint8_t>> raw_dds(batch.size());
|
std::vector<rtc::ArrayView<const uint8_t>> raw_dds(batch.size());
|
||||||
bool has_dd = false;
|
bool has_dd = false;
|
||||||
for (size_t i = 0; i < batch.size(); ++i) {
|
for (size_t i = 0; i < batch.size(); ++i) {
|
||||||
|
@ -674,15 +677,13 @@ void EncodeRtpPacket(const std::vector<const EventType*>& batch,
|
||||||
proto_batch->set_voice_activity_deltas(encoded_deltas);
|
proto_batch->set_voice_activity_deltas(encoded_deltas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace
|
|
||||||
|
|
||||||
RtcEventLogEncoderNewFormat::RtcEventLogEncoderNewFormat() {
|
RtcEventLogEncoderNewFormat::RtcEventLogEncoderNewFormat(
|
||||||
encode_neteq_set_minimum_delay_kill_switch_ = false;
|
const FieldTrialsView& field_trials)
|
||||||
if (webrtc::field_trial::IsEnabled(
|
: encode_neteq_set_minimum_delay_kill_switch_(field_trials.IsEnabled(
|
||||||
"WebRTC-RtcEventLogEncodeNetEqSetMinimumDelayKillSwitch")) {
|
"WebRTC-RtcEventLogEncodeNetEqSetMinimumDelayKillSwitch")),
|
||||||
encode_neteq_set_minimum_delay_kill_switch_ = true;
|
encode_dependency_descriptor_(!field_trials.IsDisabled(
|
||||||
}
|
"WebRTC-RtcEventLogEncodeDependencyDescriptor")) {}
|
||||||
}
|
|
||||||
|
|
||||||
std::string RtcEventLogEncoderNewFormat::EncodeLogStart(int64_t timestamp_us,
|
std::string RtcEventLogEncoderNewFormat::EncodeLogStart(int64_t timestamp_us,
|
||||||
int64_t utc_time_us) {
|
int64_t utc_time_us) {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/array_view.h"
|
#include "api/array_view.h"
|
||||||
|
#include "api/field_trials_view.h"
|
||||||
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder.h"
|
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
@ -59,7 +60,7 @@ class RtcEventGenericPacketSent;
|
||||||
|
|
||||||
class RtcEventLogEncoderNewFormat final : public RtcEventLogEncoder {
|
class RtcEventLogEncoderNewFormat final : public RtcEventLogEncoder {
|
||||||
public:
|
public:
|
||||||
RtcEventLogEncoderNewFormat();
|
explicit RtcEventLogEncoderNewFormat(const FieldTrialsView& field_trials);
|
||||||
~RtcEventLogEncoderNewFormat() override = default;
|
~RtcEventLogEncoderNewFormat() override = default;
|
||||||
|
|
||||||
std::string EncodeBatch(
|
std::string EncodeBatch(
|
||||||
|
@ -71,8 +72,6 @@ class RtcEventLogEncoderNewFormat final : public RtcEventLogEncoder {
|
||||||
std::string EncodeLogEnd(int64_t timestamp_us) override;
|
std::string EncodeLogEnd(int64_t timestamp_us) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool encode_neteq_set_minimum_delay_kill_switch_ = false;
|
|
||||||
|
|
||||||
// Encoding entry-point for the various RtcEvent subclasses.
|
// Encoding entry-point for the various RtcEvent subclasses.
|
||||||
void EncodeAlrState(rtc::ArrayView<const RtcEventAlrState*> batch,
|
void EncodeAlrState(rtc::ArrayView<const RtcEventAlrState*> batch,
|
||||||
rtclog2::EventStream* event_stream);
|
rtclog2::EventStream* event_stream);
|
||||||
|
@ -157,6 +156,11 @@ class RtcEventLogEncoderNewFormat final : public RtcEventLogEncoder {
|
||||||
void EncodeVideoSendStreamConfig(
|
void EncodeVideoSendStreamConfig(
|
||||||
rtc::ArrayView<const RtcEventVideoSendStreamConfig*> batch,
|
rtc::ArrayView<const RtcEventVideoSendStreamConfig*> batch,
|
||||||
rtclog2::EventStream* event_stream);
|
rtclog2::EventStream* event_stream);
|
||||||
|
template <typename Batch, typename ProtoType>
|
||||||
|
void EncodeRtpPacket(const Batch& batch, ProtoType* proto_batch);
|
||||||
|
|
||||||
|
const bool encode_neteq_set_minimum_delay_kill_switch_;
|
||||||
|
const bool encode_dependency_descriptor_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
|
#include "api/transport/field_trial_based_config.h"
|
||||||
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h"
|
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h"
|
||||||
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h"
|
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h"
|
||||||
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.h"
|
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.h"
|
||||||
|
@ -40,10 +41,14 @@
|
||||||
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
|
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
|
||||||
#include "rtc_base/fake_clock.h"
|
#include "rtc_base/fake_clock.h"
|
||||||
#include "rtc_base/random.h"
|
#include "rtc_base/random.h"
|
||||||
|
#include "test/explicit_key_value_config.h"
|
||||||
#include "test/field_trial.h"
|
#include "test/field_trial.h"
|
||||||
#include "test/gtest.h"
|
#include "test/gtest.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
using test::ExplicitKeyValueConfig;
|
||||||
|
|
||||||
class RtcEventLogEncoderTest
|
class RtcEventLogEncoderTest
|
||||||
: public ::testing::TestWithParam<
|
: public ::testing::TestWithParam<
|
||||||
std::tuple<int, RtcEventLog::EncodingType, size_t, bool>> {
|
std::tuple<int, RtcEventLog::EncodingType, size_t, bool>> {
|
||||||
|
@ -55,22 +60,26 @@ class RtcEventLogEncoderTest
|
||||||
event_count_(std::get<2>(GetParam())),
|
event_count_(std::get<2>(GetParam())),
|
||||||
force_repeated_fields_(std::get<3>(GetParam())),
|
force_repeated_fields_(std::get<3>(GetParam())),
|
||||||
gen_(seed_ * 880001UL),
|
gen_(seed_ * 880001UL),
|
||||||
verifier_(encoding_type_) {
|
verifier_(encoding_type_) {}
|
||||||
|
~RtcEventLogEncoderTest() override = default;
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> CreateEncoder() {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder;
|
||||||
switch (encoding_type_) {
|
switch (encoding_type_) {
|
||||||
case RtcEventLog::EncodingType::Legacy:
|
case RtcEventLog::EncodingType::Legacy:
|
||||||
encoder_ = std::make_unique<RtcEventLogEncoderLegacy>();
|
encoder = std::make_unique<RtcEventLogEncoderLegacy>();
|
||||||
break;
|
break;
|
||||||
case RtcEventLog::EncodingType::NewFormat:
|
case RtcEventLog::EncodingType::NewFormat:
|
||||||
encoder_ = std::make_unique<RtcEventLogEncoderNewFormat>();
|
encoder = std::make_unique<RtcEventLogEncoderNewFormat>(
|
||||||
|
FieldTrialBasedConfig());
|
||||||
break;
|
break;
|
||||||
case RtcEventLog::EncodingType::ProtoFree:
|
case RtcEventLog::EncodingType::ProtoFree:
|
||||||
encoder_ = std::make_unique<RtcEventLogEncoderV3>();
|
encoder = std::make_unique<RtcEventLogEncoderV3>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
encoded_ =
|
encoded_ = encoder->EncodeLogStart(rtc::TimeMillis(), rtc::TimeUTCMillis());
|
||||||
encoder_->EncodeLogStart(rtc::TimeMillis(), rtc::TimeUTCMillis());
|
return encoder;
|
||||||
}
|
}
|
||||||
~RtcEventLogEncoderTest() override = default;
|
|
||||||
|
|
||||||
// ANA events have some optional fields, so we want to make sure that we get
|
// ANA events have some optional fields, so we want to make sure that we get
|
||||||
// correct behavior both when all of the values are there, as well as when
|
// correct behavior both when all of the values are there, as well as when
|
||||||
|
@ -92,7 +101,6 @@ class RtcEventLogEncoderTest
|
||||||
void TestRtpPackets();
|
void TestRtpPackets();
|
||||||
|
|
||||||
std::deque<std::unique_ptr<RtcEvent>> history_;
|
std::deque<std::unique_ptr<RtcEvent>> history_;
|
||||||
std::unique_ptr<RtcEventLogEncoder> encoder_;
|
|
||||||
ParsedRtcEventLog parsed_log_;
|
ParsedRtcEventLog parsed_log_;
|
||||||
const uint64_t seed_;
|
const uint64_t seed_;
|
||||||
Random prng_;
|
Random prng_;
|
||||||
|
@ -108,12 +116,13 @@ void RtcEventLogEncoderTest::TestRtcEventAudioNetworkAdaptation(
|
||||||
const std::vector<std::unique_ptr<RtcEventAudioNetworkAdaptation>>&
|
const std::vector<std::unique_ptr<RtcEventAudioNetworkAdaptation>>&
|
||||||
events) {
|
events) {
|
||||||
ASSERT_TRUE(history_.empty()) << "Function should be called once per test.";
|
ASSERT_TRUE(history_.empty()) << "Function should be called once per test.";
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
for (auto& event : events) {
|
for (auto& event : events) {
|
||||||
history_.push_back(event->Copy());
|
history_.push_back(event->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& ana_configs = parsed_log_.audio_network_adaptation_events();
|
const auto& ana_configs = parsed_log_.audio_network_adaptation_events();
|
||||||
|
|
||||||
|
@ -172,6 +181,7 @@ void RtcEventLogEncoderTest::TestRtpPackets() {
|
||||||
const std::vector<uint32_t> kSsrcPool = {0x00000000, 0x12345678, 0xabcdef01,
|
const std::vector<uint32_t> kSsrcPool = {0x00000000, 0x12345678, 0xabcdef01,
|
||||||
0xffffffff, 0x20171024, 0x19840730,
|
0xffffffff, 0x20171024, 0x19840730,
|
||||||
0x19831230};
|
0x19831230};
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
// TODO(terelius): Test extensions for legacy encoding, too.
|
// TODO(terelius): Test extensions for legacy encoding, too.
|
||||||
RtpHeaderExtensionMap extension_map;
|
RtpHeaderExtensionMap extension_map;
|
||||||
|
@ -193,7 +203,7 @@ void RtcEventLogEncoderTest::TestRtpPackets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode and parse.
|
// Encode and parse.
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
// For each SSRC, make sure the RTP packets associated with it to have been
|
// For each SSRC, make sure the RTP packets associated with it to have been
|
||||||
|
@ -213,6 +223,7 @@ void RtcEventLogEncoderTest::TestRtpPackets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventAlrState) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventAlrState) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::vector<std::unique_ptr<RtcEventAlrState>> events(event_count_);
|
std::vector<std::unique_ptr<RtcEventAlrState>> events(event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
events[i] = (i == 0 || !force_repeated_fields_) ? gen_.NewAlrState()
|
events[i] = (i == 0 || !force_repeated_fields_) ? gen_.NewAlrState()
|
||||||
|
@ -220,7 +231,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAlrState) {
|
||||||
history_.push_back(events[i]->Copy());
|
history_.push_back(events[i]->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& alr_state_events = parsed_log_.alr_state_events();
|
const auto& alr_state_events = parsed_log_.alr_state_events();
|
||||||
|
|
||||||
|
@ -234,6 +245,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRouteChange) {
|
||||||
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
|
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::vector<std::unique_ptr<RtcEventRouteChange>> events(event_count_);
|
std::vector<std::unique_ptr<RtcEventRouteChange>> events(event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
events[i] = (i == 0 || !force_repeated_fields_) ? gen_.NewRouteChange()
|
events[i] = (i == 0 || !force_repeated_fields_) ? gen_.NewRouteChange()
|
||||||
|
@ -241,7 +253,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRouteChange) {
|
||||||
history_.push_back(events[i]->Copy());
|
history_.push_back(events[i]->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& route_change_events = parsed_log_.route_change_events();
|
const auto& route_change_events = parsed_log_.route_change_events();
|
||||||
|
|
||||||
|
@ -252,6 +264,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRouteChange) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventRemoteEstimate) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventRemoteEstimate) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::vector<std::unique_ptr<RtcEventRemoteEstimate>> events(event_count_);
|
std::vector<std::unique_ptr<RtcEventRemoteEstimate>> events(event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
events[i] = (i == 0 || !force_repeated_fields_)
|
events[i] = (i == 0 || !force_repeated_fields_)
|
||||||
|
@ -260,7 +273,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRemoteEstimate) {
|
||||||
history_.push_back(std::make_unique<RtcEventRemoteEstimate>(*events[i]));
|
history_.push_back(std::make_unique<RtcEventRemoteEstimate>(*events[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& parsed_events = parsed_log_.remote_estimate_events();
|
const auto& parsed_events = parsed_log_.remote_estimate_events();
|
||||||
|
|
||||||
|
@ -395,6 +408,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationAll) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventAudioPlayout) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventAudioPlayout) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
// SSRCs will be randomly assigned out of this small pool, significant only
|
// SSRCs will be randomly assigned out of this small pool, significant only
|
||||||
// in that it also covers such edge cases as SSRC = 0 and SSRC = 0xffffffff.
|
// in that it also covers such edge cases as SSRC = 0 and SSRC = 0xffffffff.
|
||||||
// The pool is intentionally small, so as to produce collisions.
|
// The pool is intentionally small, so as to produce collisions.
|
||||||
|
@ -414,7 +428,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioPlayout) {
|
||||||
original_events_by_ssrc[ssrc].push_back(std::move(event));
|
original_events_by_ssrc[ssrc].push_back(std::move(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& parsed_playout_events_by_ssrc =
|
const auto& parsed_playout_events_by_ssrc =
|
||||||
|
@ -443,6 +457,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioPlayout) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventNetEqSetMinimumDelayDecoded) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventNetEqSetMinimumDelayDecoded) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
// SSRCs will be randomly assigned out of this small pool, significant only
|
// SSRCs will be randomly assigned out of this small pool, significant only
|
||||||
// in that it also covers such edge cases as SSRC = 0 and SSRC = 0xffffffff.
|
// in that it also covers such edge cases as SSRC = 0 and SSRC = 0xffffffff.
|
||||||
// The pool is intentionally small, so as to produce collisions.
|
// The pool is intentionally small, so as to produce collisions.
|
||||||
|
@ -461,7 +476,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventNetEqSetMinimumDelayDecoded) {
|
||||||
original_events_by_ssrc[ssrc].push_back(std::move(event));
|
original_events_by_ssrc[ssrc].push_back(std::move(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& parsed_neteq_set_minimum_delay_events_by_ssrc =
|
const auto& parsed_neteq_set_minimum_delay_events_by_ssrc =
|
||||||
|
@ -502,13 +517,14 @@ TEST_P(RtcEventLogEncoderTest, RtcEventNetEqSetMinimumDelayDecoded) {
|
||||||
|
|
||||||
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventAudioReceiveStreamConfig) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventAudioReceiveStreamConfig) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
uint32_t ssrc = prng_.Rand<uint32_t>();
|
uint32_t ssrc = prng_.Rand<uint32_t>();
|
||||||
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
|
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
|
||||||
std::unique_ptr<RtcEventAudioReceiveStreamConfig> event =
|
std::unique_ptr<RtcEventAudioReceiveStreamConfig> event =
|
||||||
gen_.NewAudioReceiveStreamConfig(ssrc, extensions);
|
gen_.NewAudioReceiveStreamConfig(ssrc, extensions);
|
||||||
history_.push_back(event->Copy());
|
history_.push_back(event->Copy());
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& audio_recv_configs = parsed_log_.audio_recv_configs();
|
const auto& audio_recv_configs = parsed_log_.audio_recv_configs();
|
||||||
|
|
||||||
|
@ -518,13 +534,14 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioReceiveStreamConfig) {
|
||||||
|
|
||||||
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventAudioSendStreamConfig) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventAudioSendStreamConfig) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
uint32_t ssrc = prng_.Rand<uint32_t>();
|
uint32_t ssrc = prng_.Rand<uint32_t>();
|
||||||
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
|
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
|
||||||
std::unique_ptr<RtcEventAudioSendStreamConfig> event =
|
std::unique_ptr<RtcEventAudioSendStreamConfig> event =
|
||||||
gen_.NewAudioSendStreamConfig(ssrc, extensions);
|
gen_.NewAudioSendStreamConfig(ssrc, extensions);
|
||||||
history_.push_back(event->Copy());
|
history_.push_back(event->Copy());
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& audio_send_configs = parsed_log_.audio_send_configs();
|
const auto& audio_send_configs = parsed_log_.audio_send_configs();
|
||||||
|
|
||||||
|
@ -533,6 +550,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioSendStreamConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateDelayBased) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateDelayBased) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::vector<std::unique_ptr<RtcEventBweUpdateDelayBased>> events(
|
std::vector<std::unique_ptr<RtcEventBweUpdateDelayBased>> events(
|
||||||
event_count_);
|
event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
|
@ -542,7 +560,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateDelayBased) {
|
||||||
history_.push_back(events[i]->Copy());
|
history_.push_back(events[i]->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& bwe_delay_updates = parsed_log_.bwe_delay_updates();
|
const auto& bwe_delay_updates = parsed_log_.bwe_delay_updates();
|
||||||
|
@ -554,6 +572,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateDelayBased) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateLossBased) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateLossBased) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::vector<std::unique_ptr<RtcEventBweUpdateLossBased>> events(event_count_);
|
std::vector<std::unique_ptr<RtcEventBweUpdateLossBased>> events(event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
events[i] = (i == 0 || !force_repeated_fields_)
|
events[i] = (i == 0 || !force_repeated_fields_)
|
||||||
|
@ -562,7 +581,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateLossBased) {
|
||||||
history_.push_back(events[i]->Copy());
|
history_.push_back(events[i]->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& bwe_loss_updates = parsed_log_.bwe_loss_updates();
|
const auto& bwe_loss_updates = parsed_log_.bwe_loss_updates();
|
||||||
|
@ -577,6 +596,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericPacketReceived) {
|
||||||
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
|
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::vector<std::unique_ptr<RtcEventGenericPacketReceived>> events(
|
std::vector<std::unique_ptr<RtcEventGenericPacketReceived>> events(
|
||||||
event_count_);
|
event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
|
@ -586,7 +606,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericPacketReceived) {
|
||||||
history_.push_back(events[i]->Copy());
|
history_.push_back(events[i]->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& packets_received = parsed_log_.generic_packets_received();
|
const auto& packets_received = parsed_log_.generic_packets_received();
|
||||||
|
@ -602,6 +622,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericPacketSent) {
|
||||||
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
|
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::vector<std::unique_ptr<RtcEventGenericPacketSent>> events(event_count_);
|
std::vector<std::unique_ptr<RtcEventGenericPacketSent>> events(event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
events[i] = (i == 0 || !force_repeated_fields_)
|
events[i] = (i == 0 || !force_repeated_fields_)
|
||||||
|
@ -610,7 +631,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericPacketSent) {
|
||||||
history_.push_back(events[i]->Copy());
|
history_.push_back(events[i]->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& packets_sent = parsed_log_.generic_packets_sent();
|
const auto& packets_sent = parsed_log_.generic_packets_sent();
|
||||||
|
@ -625,6 +646,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericAcksReceived) {
|
||||||
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
|
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::vector<std::unique_ptr<RtcEventGenericAckReceived>> events(event_count_);
|
std::vector<std::unique_ptr<RtcEventGenericAckReceived>> events(event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
events[i] = (i == 0 || !force_repeated_fields_)
|
events[i] = (i == 0 || !force_repeated_fields_)
|
||||||
|
@ -633,7 +655,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericAcksReceived) {
|
||||||
history_.push_back(events[i]->Copy());
|
history_.push_back(events[i]->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& decoded_events = parsed_log_.generic_acks_received();
|
const auto& decoded_events = parsed_log_.generic_acks_received();
|
||||||
|
@ -645,6 +667,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericAcksReceived) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventDtlsTransportState) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventDtlsTransportState) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::vector<std::unique_ptr<RtcEventDtlsTransportState>> events(event_count_);
|
std::vector<std::unique_ptr<RtcEventDtlsTransportState>> events(event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
events[i] = (i == 0 || !force_repeated_fields_)
|
events[i] = (i == 0 || !force_repeated_fields_)
|
||||||
|
@ -653,7 +676,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventDtlsTransportState) {
|
||||||
history_.push_back(events[i]->Copy());
|
history_.push_back(events[i]->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& dtls_transport_states = parsed_log_.dtls_transport_states();
|
const auto& dtls_transport_states = parsed_log_.dtls_transport_states();
|
||||||
|
@ -670,6 +693,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventDtlsTransportState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventDtlsWritableState) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventDtlsWritableState) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::vector<std::unique_ptr<RtcEventDtlsWritableState>> events(event_count_);
|
std::vector<std::unique_ptr<RtcEventDtlsWritableState>> events(event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
events[i] = (i == 0 || !force_repeated_fields_)
|
events[i] = (i == 0 || !force_repeated_fields_)
|
||||||
|
@ -678,7 +702,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventDtlsWritableState) {
|
||||||
history_.push_back(events[i]->Copy());
|
history_.push_back(events[i]->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& dtls_writable_states = parsed_log_.dtls_writable_states();
|
const auto& dtls_writable_states = parsed_log_.dtls_writable_states();
|
||||||
|
@ -696,6 +720,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventDtlsWritableState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventFrameDecoded) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventFrameDecoded) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
// SSRCs will be randomly assigned out of this small pool, significant only
|
// SSRCs will be randomly assigned out of this small pool, significant only
|
||||||
// in that it also covers such edge cases as SSRC = 0 and SSRC = 0xffffffff.
|
// in that it also covers such edge cases as SSRC = 0 and SSRC = 0xffffffff.
|
||||||
// The pool is intentionally small, so as to produce collisions.
|
// The pool is intentionally small, so as to produce collisions.
|
||||||
|
@ -715,7 +740,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventFrameDecoded) {
|
||||||
original_events_by_ssrc[ssrc].push_back(std::move(event));
|
original_events_by_ssrc[ssrc].push_back(std::move(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
auto status = parsed_log_.ParseString(encoded_);
|
auto status = parsed_log_.ParseString(encoded_);
|
||||||
if (!status.ok())
|
if (!status.ok())
|
||||||
RTC_LOG(LS_ERROR) << status.message();
|
RTC_LOG(LS_ERROR) << status.message();
|
||||||
|
@ -751,11 +776,12 @@ TEST_P(RtcEventLogEncoderTest, RtcEventFrameDecoded) {
|
||||||
|
|
||||||
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePairConfig) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePairConfig) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::unique_ptr<RtcEventIceCandidatePairConfig> event =
|
std::unique_ptr<RtcEventIceCandidatePairConfig> event =
|
||||||
gen_.NewIceCandidatePairConfig();
|
gen_.NewIceCandidatePairConfig();
|
||||||
history_.push_back(event->Copy());
|
history_.push_back(event->Copy());
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& ice_candidate_pair_configs =
|
const auto& ice_candidate_pair_configs =
|
||||||
parsed_log_.ice_candidate_pair_configs();
|
parsed_log_.ice_candidate_pair_configs();
|
||||||
|
@ -767,10 +793,11 @@ TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePairConfig) {
|
||||||
|
|
||||||
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePair) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePair) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::unique_ptr<RtcEventIceCandidatePair> event = gen_.NewIceCandidatePair();
|
std::unique_ptr<RtcEventIceCandidatePair> event = gen_.NewIceCandidatePair();
|
||||||
history_.push_back(event->Copy());
|
history_.push_back(event->Copy());
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& ice_candidate_pair_events =
|
const auto& ice_candidate_pair_events =
|
||||||
parsed_log_.ice_candidate_pair_events();
|
parsed_log_.ice_candidate_pair_events();
|
||||||
|
@ -781,11 +808,12 @@ TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePair) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStarted) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStarted) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
const int64_t timestamp_ms = prng_.Rand(1'000'000'000);
|
const int64_t timestamp_ms = prng_.Rand(1'000'000'000);
|
||||||
const int64_t utc_time_ms = prng_.Rand(1'000'000'000);
|
const int64_t utc_time_ms = prng_.Rand(1'000'000'000);
|
||||||
|
|
||||||
// Overwrite the previously encoded LogStart event.
|
// Overwrite the previously encoded LogStart event.
|
||||||
encoded_ = encoder_->EncodeLogStart(timestamp_ms * 1000, utc_time_ms * 1000);
|
encoded_ = encoder->EncodeLogStart(timestamp_ms * 1000, utc_time_ms * 1000);
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& start_log_events = parsed_log_.start_log_events();
|
const auto& start_log_events = parsed_log_.start_log_events();
|
||||||
|
|
||||||
|
@ -795,16 +823,17 @@ TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStarted) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStopped) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStopped) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
const int64_t start_timestamp_ms = prng_.Rand(1'000'000'000);
|
const int64_t start_timestamp_ms = prng_.Rand(1'000'000'000);
|
||||||
const int64_t start_utc_time_ms = prng_.Rand(1'000'000'000);
|
const int64_t start_utc_time_ms = prng_.Rand(1'000'000'000);
|
||||||
|
|
||||||
// Overwrite the previously encoded LogStart event.
|
// Overwrite the previously encoded LogStart event.
|
||||||
encoded_ = encoder_->EncodeLogStart(start_timestamp_ms * 1000,
|
encoded_ = encoder->EncodeLogStart(start_timestamp_ms * 1000,
|
||||||
start_utc_time_ms * 1000);
|
start_utc_time_ms * 1000);
|
||||||
|
|
||||||
const int64_t stop_timestamp_ms =
|
const int64_t stop_timestamp_ms =
|
||||||
prng_.Rand(start_timestamp_ms, 2'000'000'000);
|
prng_.Rand(start_timestamp_ms, 2'000'000'000);
|
||||||
encoded_ += encoder_->EncodeLogEnd(stop_timestamp_ms * 1000);
|
encoded_ += encoder->EncodeLogEnd(stop_timestamp_ms * 1000);
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& stop_log_events = parsed_log_.stop_log_events();
|
const auto& stop_log_events = parsed_log_.stop_log_events();
|
||||||
|
|
||||||
|
@ -814,11 +843,12 @@ TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStopped) {
|
||||||
|
|
||||||
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventProbeClusterCreated) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventProbeClusterCreated) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::unique_ptr<RtcEventProbeClusterCreated> event =
|
std::unique_ptr<RtcEventProbeClusterCreated> event =
|
||||||
gen_.NewProbeClusterCreated();
|
gen_.NewProbeClusterCreated();
|
||||||
history_.push_back(event->Copy());
|
history_.push_back(event->Copy());
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& bwe_probe_cluster_created_events =
|
const auto& bwe_probe_cluster_created_events =
|
||||||
parsed_log_.bwe_probe_cluster_created_events();
|
parsed_log_.bwe_probe_cluster_created_events();
|
||||||
|
@ -830,11 +860,12 @@ TEST_P(RtcEventLogEncoderTest, RtcEventProbeClusterCreated) {
|
||||||
|
|
||||||
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventProbeResultFailure) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventProbeResultFailure) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::unique_ptr<RtcEventProbeResultFailure> event =
|
std::unique_ptr<RtcEventProbeResultFailure> event =
|
||||||
gen_.NewProbeResultFailure();
|
gen_.NewProbeResultFailure();
|
||||||
history_.push_back(event->Copy());
|
history_.push_back(event->Copy());
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& bwe_probe_failure_events = parsed_log_.bwe_probe_failure_events();
|
const auto& bwe_probe_failure_events = parsed_log_.bwe_probe_failure_events();
|
||||||
|
|
||||||
|
@ -845,11 +876,12 @@ TEST_P(RtcEventLogEncoderTest, RtcEventProbeResultFailure) {
|
||||||
|
|
||||||
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventProbeResultSuccess) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventProbeResultSuccess) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::unique_ptr<RtcEventProbeResultSuccess> event =
|
std::unique_ptr<RtcEventProbeResultSuccess> event =
|
||||||
gen_.NewProbeResultSuccess();
|
gen_.NewProbeResultSuccess();
|
||||||
history_.push_back(event->Copy());
|
history_.push_back(event->Copy());
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& bwe_probe_success_events = parsed_log_.bwe_probe_success_events();
|
const auto& bwe_probe_success_events = parsed_log_.bwe_probe_success_events();
|
||||||
|
|
||||||
|
@ -864,6 +896,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketIncoming) {
|
||||||
// As a work around, we're removing duplicates in the parser.
|
// As a work around, we're removing duplicates in the parser.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
std::vector<std::unique_ptr<RtcEventRtcpPacketIncoming>> events(event_count_);
|
std::vector<std::unique_ptr<RtcEventRtcpPacketIncoming>> events(event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
|
@ -873,7 +906,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketIncoming) {
|
||||||
history_.push_back(events[i]->Copy());
|
history_.push_back(events[i]->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& incoming_rtcp_packets = parsed_log_.incoming_rtcp_packets();
|
const auto& incoming_rtcp_packets = parsed_log_.incoming_rtcp_packets();
|
||||||
|
@ -886,6 +919,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketIncoming) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketOutgoing) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketOutgoing) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
std::vector<std::unique_ptr<RtcEventRtcpPacketOutgoing>> events(event_count_);
|
std::vector<std::unique_ptr<RtcEventRtcpPacketOutgoing>> events(event_count_);
|
||||||
for (size_t i = 0; i < event_count_; ++i) {
|
for (size_t i = 0; i < event_count_; ++i) {
|
||||||
events[i] = (i == 0 || !force_repeated_fields_)
|
events[i] = (i == 0 || !force_repeated_fields_)
|
||||||
|
@ -894,7 +928,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketOutgoing) {
|
||||||
history_.push_back(events[i]->Copy());
|
history_.push_back(events[i]->Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& outgoing_rtcp_packets = parsed_log_.outgoing_rtcp_packets();
|
const auto& outgoing_rtcp_packets = parsed_log_.outgoing_rtcp_packets();
|
||||||
|
@ -914,6 +948,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpReceiverReport) {
|
||||||
rtc::ScopedFakeClock fake_clock;
|
rtc::ScopedFakeClock fake_clock;
|
||||||
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
||||||
std::vector<rtcp::ReceiverReport> events(event_count_);
|
std::vector<rtcp::ReceiverReport> events(event_count_);
|
||||||
std::vector<int64_t> timestamps_ms(event_count_);
|
std::vector<int64_t> timestamps_ms(event_count_);
|
||||||
|
@ -931,7 +967,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpReceiverReport) {
|
||||||
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& receiver_reports = parsed_log_.receiver_reports(direction);
|
const auto& receiver_reports = parsed_log_.receiver_reports(direction);
|
||||||
|
@ -952,6 +988,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpSenderReport) {
|
||||||
rtc::ScopedFakeClock fake_clock;
|
rtc::ScopedFakeClock fake_clock;
|
||||||
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
||||||
std::vector<rtcp::SenderReport> events(event_count_);
|
std::vector<rtcp::SenderReport> events(event_count_);
|
||||||
std::vector<int64_t> timestamps_ms(event_count_);
|
std::vector<int64_t> timestamps_ms(event_count_);
|
||||||
|
@ -969,7 +1007,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpSenderReport) {
|
||||||
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& sender_reports = parsed_log_.sender_reports(direction);
|
const auto& sender_reports = parsed_log_.sender_reports(direction);
|
||||||
|
@ -990,6 +1028,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpExtendedReports) {
|
||||||
rtc::ScopedFakeClock fake_clock;
|
rtc::ScopedFakeClock fake_clock;
|
||||||
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
||||||
std::vector<rtcp::ExtendedReports> events(event_count_);
|
std::vector<rtcp::ExtendedReports> events(event_count_);
|
||||||
std::vector<int64_t> timestamps_ms(event_count_);
|
std::vector<int64_t> timestamps_ms(event_count_);
|
||||||
|
@ -1007,7 +1047,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpExtendedReports) {
|
||||||
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& extended_reports = parsed_log_.extended_reports(direction);
|
const auto& extended_reports = parsed_log_.extended_reports(direction);
|
||||||
|
@ -1028,6 +1068,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpFir) {
|
||||||
rtc::ScopedFakeClock fake_clock;
|
rtc::ScopedFakeClock fake_clock;
|
||||||
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
||||||
std::vector<rtcp::Fir> events(event_count_);
|
std::vector<rtcp::Fir> events(event_count_);
|
||||||
std::vector<int64_t> timestamps_ms(event_count_);
|
std::vector<int64_t> timestamps_ms(event_count_);
|
||||||
|
@ -1045,7 +1087,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpFir) {
|
||||||
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& firs = parsed_log_.firs(direction);
|
const auto& firs = parsed_log_.firs(direction);
|
||||||
|
@ -1065,6 +1107,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPli) {
|
||||||
rtc::ScopedFakeClock fake_clock;
|
rtc::ScopedFakeClock fake_clock;
|
||||||
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
||||||
std::vector<rtcp::Pli> events(event_count_);
|
std::vector<rtcp::Pli> events(event_count_);
|
||||||
std::vector<int64_t> timestamps_ms(event_count_);
|
std::vector<int64_t> timestamps_ms(event_count_);
|
||||||
|
@ -1082,7 +1126,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPli) {
|
||||||
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& plis = parsed_log_.plis(direction);
|
const auto& plis = parsed_log_.plis(direction);
|
||||||
|
@ -1102,6 +1146,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpBye) {
|
||||||
rtc::ScopedFakeClock fake_clock;
|
rtc::ScopedFakeClock fake_clock;
|
||||||
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
||||||
std::vector<rtcp::Bye> events(event_count_);
|
std::vector<rtcp::Bye> events(event_count_);
|
||||||
std::vector<int64_t> timestamps_ms(event_count_);
|
std::vector<int64_t> timestamps_ms(event_count_);
|
||||||
|
@ -1119,7 +1165,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpBye) {
|
||||||
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& byes = parsed_log_.byes(direction);
|
const auto& byes = parsed_log_.byes(direction);
|
||||||
|
@ -1139,6 +1185,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpNack) {
|
||||||
rtc::ScopedFakeClock fake_clock;
|
rtc::ScopedFakeClock fake_clock;
|
||||||
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
||||||
std::vector<rtcp::Nack> events(event_count_);
|
std::vector<rtcp::Nack> events(event_count_);
|
||||||
std::vector<int64_t> timestamps_ms(event_count_);
|
std::vector<int64_t> timestamps_ms(event_count_);
|
||||||
|
@ -1156,7 +1204,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpNack) {
|
||||||
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& nacks = parsed_log_.nacks(direction);
|
const auto& nacks = parsed_log_.nacks(direction);
|
||||||
|
@ -1176,6 +1224,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpRemb) {
|
||||||
rtc::ScopedFakeClock fake_clock;
|
rtc::ScopedFakeClock fake_clock;
|
||||||
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
||||||
std::vector<rtcp::Remb> events(event_count_);
|
std::vector<rtcp::Remb> events(event_count_);
|
||||||
std::vector<int64_t> timestamps_ms(event_count_);
|
std::vector<int64_t> timestamps_ms(event_count_);
|
||||||
|
@ -1193,7 +1243,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpRemb) {
|
||||||
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& rembs = parsed_log_.rembs(direction);
|
const auto& rembs = parsed_log_.rembs(direction);
|
||||||
|
@ -1213,6 +1263,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpTransportFeedback) {
|
||||||
rtc::ScopedFakeClock fake_clock;
|
rtc::ScopedFakeClock fake_clock;
|
||||||
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
||||||
std::vector<rtcp::TransportFeedback> events;
|
std::vector<rtcp::TransportFeedback> events;
|
||||||
events.reserve(event_count_);
|
events.reserve(event_count_);
|
||||||
|
@ -1231,7 +1283,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpTransportFeedback) {
|
||||||
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& transport_feedbacks =
|
const auto& transport_feedbacks =
|
||||||
|
@ -1253,6 +1305,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpLossNotification) {
|
||||||
rtc::ScopedFakeClock fake_clock;
|
rtc::ScopedFakeClock fake_clock;
|
||||||
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
|
||||||
|
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
|
|
||||||
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
|
||||||
std::vector<rtcp::LossNotification> events;
|
std::vector<rtcp::LossNotification> events;
|
||||||
events.reserve(event_count_);
|
events.reserve(event_count_);
|
||||||
|
@ -1271,7 +1325,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpLossNotification) {
|
||||||
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
|
|
||||||
const auto& loss_notifications = parsed_log_.loss_notifications(direction);
|
const auto& loss_notifications = parsed_log_.loss_notifications(direction);
|
||||||
|
@ -1308,13 +1362,14 @@ TEST_P(RtcEventLogEncoderTest,
|
||||||
|
|
||||||
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventVideoReceiveStreamConfig) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventVideoReceiveStreamConfig) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
uint32_t ssrc = prng_.Rand<uint32_t>();
|
uint32_t ssrc = prng_.Rand<uint32_t>();
|
||||||
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
|
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
|
||||||
std::unique_ptr<RtcEventVideoReceiveStreamConfig> event =
|
std::unique_ptr<RtcEventVideoReceiveStreamConfig> event =
|
||||||
gen_.NewVideoReceiveStreamConfig(ssrc, extensions);
|
gen_.NewVideoReceiveStreamConfig(ssrc, extensions);
|
||||||
history_.push_back(event->Copy());
|
history_.push_back(event->Copy());
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& video_recv_configs = parsed_log_.video_recv_configs();
|
const auto& video_recv_configs = parsed_log_.video_recv_configs();
|
||||||
|
|
||||||
|
@ -1324,13 +1379,14 @@ TEST_P(RtcEventLogEncoderTest, RtcEventVideoReceiveStreamConfig) {
|
||||||
|
|
||||||
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
// TODO(eladalon/terelius): Test with multiple events in the batch.
|
||||||
TEST_P(RtcEventLogEncoderTest, RtcEventVideoSendStreamConfig) {
|
TEST_P(RtcEventLogEncoderTest, RtcEventVideoSendStreamConfig) {
|
||||||
|
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
|
||||||
uint32_t ssrc = prng_.Rand<uint32_t>();
|
uint32_t ssrc = prng_.Rand<uint32_t>();
|
||||||
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
|
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
|
||||||
std::unique_ptr<RtcEventVideoSendStreamConfig> event =
|
std::unique_ptr<RtcEventVideoSendStreamConfig> event =
|
||||||
gen_.NewVideoSendStreamConfig(ssrc, extensions);
|
gen_.NewVideoSendStreamConfig(ssrc, extensions);
|
||||||
history_.push_back(event->Copy());
|
history_.push_back(event->Copy());
|
||||||
|
|
||||||
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
|
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
|
||||||
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
|
||||||
const auto& video_send_configs = parsed_log_.video_send_configs();
|
const auto& video_send_configs = parsed_log_.video_send_configs();
|
||||||
|
|
||||||
|
@ -1357,7 +1413,8 @@ class RtcEventLogEncoderSimpleTest
|
||||||
encoder_ = std::make_unique<RtcEventLogEncoderLegacy>();
|
encoder_ = std::make_unique<RtcEventLogEncoderLegacy>();
|
||||||
break;
|
break;
|
||||||
case RtcEventLog::EncodingType::NewFormat:
|
case RtcEventLog::EncodingType::NewFormat:
|
||||||
encoder_ = std::make_unique<RtcEventLogEncoderNewFormat>();
|
encoder_ = std::make_unique<RtcEventLogEncoderNewFormat>(
|
||||||
|
ExplicitKeyValueConfig(""));
|
||||||
break;
|
break;
|
||||||
case RtcEventLog::EncodingType::ProtoFree:
|
case RtcEventLog::EncodingType::ProtoFree:
|
||||||
encoder_ = std::make_unique<RtcEventLogEncoderV3>();
|
encoder_ = std::make_unique<RtcEventLogEncoderV3>();
|
||||||
|
|
|
@ -39,7 +39,7 @@ std::unique_ptr<RtcEventLogEncoder> CreateEncoder(const Environment& env) {
|
||||||
return std::make_unique<RtcEventLogEncoderLegacy>();
|
return std::make_unique<RtcEventLogEncoderLegacy>();
|
||||||
} else {
|
} else {
|
||||||
RTC_DLOG(LS_INFO) << "Creating new format encoder for RTC event log.";
|
RTC_DLOG(LS_INFO) << "Creating new format encoder for RTC event log.";
|
||||||
return std::make_unique<RtcEventLogEncoderNewFormat>();
|
return std::make_unique<RtcEventLogEncoderNewFormat>(env.field_trials());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue