aboutsummaryrefslogtreecommitdiff
path: root/logging
diff options
context:
space:
mode:
authorBjorn Terelius <terelius@webrtc.org>2018-06-28 16:48:35 +0200
committerCommit Bot <commit-bot@chromium.org>2018-06-28 15:31:23 +0000
commit7750de906ad7f59524d3669846c64057e9c63050 (patch)
treecc7ab18e0c94e7227aab47353a382d1128e70a4c /logging
parent0601d68ac85e201d7bf377373daf249c07a7ab74 (diff)
downloadwebrtc-7750de906ad7f59524d3669846c64057e9c63050.tar.gz
Port RtcEventLog encoder unittests to the new parser API.
The Copy() function previously did not copy the logging timestamp. To be able to use Copy() in this test, we add private copy constructors for RtcEvents which the Copy() can use to copy everything including the timestamp. Also adds missing test for RtcEventAlrState, RtcEventIceCandidatePairConfig and RtcEventIceCandidatePair. Bug: webrtc:8111 Change-Id: I3901231735baa4e671173c921eada0a4be6de7c9 Reviewed-on: https://webrtc-review.googlesource.com/86042 Commit-Queue: Björn Terelius <terelius@webrtc.org> Reviewed-by: Elad Alon <eladalon@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23774}
Diffstat (limited to 'logging')
-rw-r--r--logging/rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc531
-rw-r--r--logging/rtc_event_log/events/rtc_event_alr_state.cc5
-rw-r--r--logging/rtc_event_log/events/rtc_event_alr_state.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_audio_network_adaptation.cc9
-rw-r--r--logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_audio_playout.cc5
-rw-r--r--logging/rtc_event_log/events/rtc_event_audio_playout.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.cc8
-rw-r--r--logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h4
-rw-r--r--logging/rtc_event_log/events/rtc_event_audio_send_stream_config.cc7
-rw-r--r--logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.cc9
-rw-r--r--logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.cc10
-rw-r--r--logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_ice_candidate_pair.cc8
-rw-r--r--logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.cc10
-rw-r--r--logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_probe_cluster_created.cc11
-rw-r--r--logging/rtc_event_log/events/rtc_event_probe_cluster_created.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_probe_result_failure.cc8
-rw-r--r--logging/rtc_event_log/events/rtc_event_probe_result_failure.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_probe_result_success.cc8
-rw-r--r--logging/rtc_event_log/events/rtc_event_probe_result_success.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.cc8
-rw-r--r--logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.cc8
-rw-r--r--logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h3
-rw-r--r--logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.cc2
-rw-r--r--logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h4
-rw-r--r--logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.cc2
-rw-r--r--logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h4
-rw-r--r--logging/rtc_event_log/events/rtc_event_video_receive_stream_config.cc9
-rw-r--r--logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h4
-rw-r--r--logging/rtc_event_log/events/rtc_event_video_send_stream_config.cc8
-rw-r--r--logging/rtc_event_log/events/rtc_event_video_send_stream_config.h3
37 files changed, 351 insertions, 373 deletions
diff --git a/logging/rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc b/logging/rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc
index 1bda6c9042..383e71fbd5 100644
--- a/logging/rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc
+++ b/logging/rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc
@@ -8,15 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include <cmath>
#include <deque>
#include <limits>
-#include <memory>
#include <string>
-#include <utility>
-#include "api/rtpparameters.h" // RtpExtension
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.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"
@@ -33,50 +30,24 @@
#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 "logging/rtc_event_log/rtc_event_log_unittest_helper.h"
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h"
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
-#include "modules/rtp_rtcp/source/rtcp_packet/bye.h" // Arbitrary RTCP message.
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
-#include "modules/rtp_rtcp/source/rtp_packet_received.h"
-#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
-#include "rtc_base/arraysize.h"
-#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/ptr_util.h"
#include "rtc_base/random.h"
#include "test/gtest.h"
namespace webrtc {
-namespace {
-struct ExtensionInfo {
- RTPExtensionType type;
- const char* uri;
-};
-
-template <typename Extension>
-constexpr ExtensionInfo CreateExtensionInfo() {
- return {Extension::kId, Extension::kUri};
-}
-
-constexpr ExtensionInfo kExtensions[] = {
- CreateExtensionInfo<TransmissionOffset>(),
- CreateExtensionInfo<AudioLevel>(),
- CreateExtensionInfo<AbsoluteSendTime>(),
- CreateExtensionInfo<VideoOrientation>(),
- CreateExtensionInfo<TransportSequenceNumber>(),
- CreateExtensionInfo<PlayoutDelayLimits>(),
- CreateExtensionInfo<VideoContentTypeExtension>(),
- CreateExtensionInfo<VideoTimingExtension>(),
- CreateExtensionInfo<RtpStreamId>(),
- CreateExtensionInfo<RepairedRtpStreamId>(),
- CreateExtensionInfo<RtpMid>(),
-};
-} // namespace
class RtcEventLogEncoderTest : public testing::TestWithParam<int> {
protected:
RtcEventLogEncoderTest()
- : encoder_(new RtcEventLogEncoderLegacy), prng_(GetParam()) {}
+ : encoder_(new RtcEventLogEncoderLegacy),
+ seed_(GetParam()),
+ prng_(seed_),
+ gen_(seed_ * 880001UL) {}
~RtcEventLogEncoderTest() override = default;
// ANA events have some optional fields, so we want to make sure that we get
@@ -85,47 +56,28 @@ class RtcEventLogEncoderTest : public testing::TestWithParam<int> {
void TestRtcEventAudioNetworkAdaptation(
std::unique_ptr<AudioEncoderRuntimeConfig> runtime_config);
- // These help prevent code duplication between incoming/outgoing variants.
- void TestRtcEventRtcpPacket(PacketDirection direction);
- void TestRtcEventRtpPacket(PacketDirection direction);
-
- int RandomInt() {
- // Don't run this on a SNES.
- static_assert(8 * sizeof(int) >= 32, "Don't run this on a SNES.");
- int32_t rand = prng_.Rand(0, std::numeric_limits<int32_t>::max());
- return rtc::saturated_cast<int>(rand);
- }
-
- int RandomPositiveInt() {
- int32_t rand = prng_.Rand(1, std::numeric_limits<int32_t>::max());
- return rtc::saturated_cast<int>(rand);
- }
-
- uint32_t RandomSsrc() {
- return prng_.Rand(std::numeric_limits<uint32_t>::max());
- }
-
- std::vector<RtpExtension> RandomRtpExtensions() {
- RTC_DCHECK(arraysize(kExtensions) >= 2);
- size_t id_1 = prng_.Rand(0u, arraysize(kExtensions) - 1);
- size_t id_2 = prng_.Rand(0u, arraysize(kExtensions) - 2);
- if (id_2 == id_1)
- id_2 = arraysize(kExtensions) - 1;
- return std::vector<RtpExtension>{
- RtpExtension(kExtensions[id_1].uri, kExtensions[id_1].type),
- RtpExtension(kExtensions[id_2].uri, kExtensions[id_2].type)};
- }
-
- int RandomBitrate() { return RandomInt(); }
-
std::deque<std::unique_ptr<RtcEvent>> history_;
- // TODO(eladalon): Once we have more than once possible encoder, parameterize
+ // TODO(eladalon): Once we have more than one possible encoder, parameterize
// encoder selection.
std::unique_ptr<RtcEventLogEncoder> encoder_;
ParsedRtcEventLogNew parsed_log_;
+ const uint64_t seed_;
Random prng_;
+ test::EventGenerator gen_;
};
+TEST_P(RtcEventLogEncoderTest, RtcEventAlrState) {
+ std::unique_ptr<RtcEventAlrState> event = gen_.NewAlrState();
+ history_.push_back(event->Copy());
+
+ std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
+ ASSERT_TRUE(parsed_log_.ParseString(encoded));
+ const auto& alr_state_events = parsed_log_.alr_state_events();
+
+ ASSERT_EQ(alr_state_events.size(), 1u);
+ EXPECT_TRUE(test::VerifyLoggedAlrStateEvent(*event, alr_state_events[0]));
+}
+
void RtcEventLogEncoderTest::TestRtcEventAudioNetworkAdaptation(
std::unique_ptr<AudioEncoderRuntimeConfig> runtime_config) {
// This function is called repeatedly. Clear state between calls.
@@ -138,20 +90,17 @@ void RtcEventLogEncoderTest::TestRtcEventAudioNetworkAdaptation(
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::AUDIO_NETWORK_ADAPTATION_EVENT);
-
- LoggedAudioNetworkAdaptationEvent parsed_event =
- parsed_log_.GetAudioNetworkAdaptation(0);
+ const auto& ana_configs = parsed_log_.audio_network_adaptation_events();
+ ASSERT_EQ(ana_configs.size(), 1u);
- EXPECT_EQ(parsed_event.timestamp_us, timestamp_us);
- EXPECT_EQ(parsed_event.config, original_runtime_config);
+ EXPECT_EQ(ana_configs[0].timestamp_us, timestamp_us);
+ EXPECT_EQ(ana_configs[0].config, original_runtime_config);
}
TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationBitrate) {
auto runtime_config = rtc::MakeUnique<AudioEncoderRuntimeConfig>();
- const int bitrate_bps = RandomBitrate();
+ const int bitrate_bps = rtc::checked_cast<int>(
+ prng_.Rand(0, std::numeric_limits<int32_t>::max()));
runtime_config->bitrate_bps = bitrate_bps;
TestRtcEventAudioNetworkAdaptation(std::move(runtime_config));
}
@@ -202,7 +151,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationChannels) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationAll) {
- const int bitrate_bps = RandomBitrate();
+ const int bitrate_bps = rtc::checked_cast<int>(
+ prng_.Rand(0, std::numeric_limits<int32_t>::max()));
const int frame_length_ms = prng_.Rand(1, 1000);
const float plr = std::pow(0.5f, prng_.Rand(1, 8));
for (bool fec_enabled : {false, true}) {
@@ -223,369 +173,268 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationAll) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventAudioPlayout) {
- const uint32_t ssrc = RandomSsrc();
- auto event = rtc::MakeUnique<RtcEventAudioPlayout>(ssrc);
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+ uint32_t ssrc = prng_.Rand<uint32_t>();
+ std::unique_ptr<RtcEventAudioPlayout> event = gen_.NewAudioPlayout(ssrc);
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::AUDIO_PLAYOUT_EVENT);
-
- LoggedAudioPlayoutEvent playout_event = parsed_log_.GetAudioPlayout(0);
- EXPECT_EQ(playout_event.timestamp_us, timestamp_us);
- EXPECT_EQ(playout_event.ssrc, ssrc);
+ const auto& playout_events = parsed_log_.audio_playout_events();
+ ASSERT_EQ(playout_events.size(), 1u);
+ const auto playout_stream = playout_events.find(ssrc);
+ ASSERT_TRUE(playout_stream != playout_events.end());
+ ASSERT_EQ(playout_stream->second.size(), 1u);
+ LoggedAudioPlayoutEvent playout_event = playout_stream->second[0];
+ EXPECT_TRUE(test::VerifyLoggedAudioPlayoutEvent(*event, playout_event));
}
TEST_P(RtcEventLogEncoderTest, RtcEventAudioReceiveStreamConfig) {
- auto stream_config = rtc::MakeUnique<rtclog::StreamConfig>();
- stream_config->local_ssrc = RandomSsrc();
- stream_config->remote_ssrc = RandomSsrc();
- // TODO(eladalon): Verify that the extensions are used correctly when
- // parsing RTP packets headers. Here and elsewhere.
- std::vector<RtpExtension> extensions = RandomRtpExtensions();
- for (const auto& extension : extensions)
- stream_config->rtp_extensions.push_back(extension);
-
- auto original_stream_config = *stream_config;
-
- auto event = rtc::MakeUnique<RtcEventAudioReceiveStreamConfig>(
- std::move(stream_config));
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+ uint32_t ssrc = prng_.Rand<uint32_t>();
+ RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
+ std::unique_ptr<RtcEventAudioReceiveStreamConfig> event =
+ gen_.NewAudioReceiveStreamConfig(ssrc, extensions);
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::AUDIO_RECEIVER_CONFIG_EVENT);
+ const auto& audio_recv_configs = parsed_log_.audio_recv_configs();
- auto parsed_event = parsed_log_.GetAudioReceiveConfig(0);
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
- EXPECT_EQ(parsed_event, original_stream_config);
+ ASSERT_EQ(audio_recv_configs.size(), 1u);
+ EXPECT_TRUE(test::VerifyLoggedAudioRecvConfig(*event, audio_recv_configs[0]));
}
TEST_P(RtcEventLogEncoderTest, RtcEventAudioSendStreamConfig) {
- auto stream_config = rtc::MakeUnique<rtclog::StreamConfig>();
- stream_config->local_ssrc = RandomSsrc();
- std::vector<RtpExtension> extensions = RandomRtpExtensions();
- for (const auto& extension : extensions)
- stream_config->rtp_extensions.push_back(extension);
-
- auto original_stream_config = *stream_config;
-
- auto event =
- rtc::MakeUnique<RtcEventAudioSendStreamConfig>(std::move(stream_config));
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+ uint32_t ssrc = prng_.Rand<uint32_t>();
+ RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
+ std::unique_ptr<RtcEventAudioSendStreamConfig> event =
+ gen_.NewAudioSendStreamConfig(ssrc, extensions);
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::AUDIO_SENDER_CONFIG_EVENT);
+ const auto& audio_send_configs = parsed_log_.audio_send_configs();
- auto parsed_event = parsed_log_.GetAudioSendConfig(0);
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
- EXPECT_EQ(parsed_event, original_stream_config);
+ ASSERT_EQ(audio_send_configs.size(), 1u);
+ EXPECT_TRUE(test::VerifyLoggedAudioSendConfig(*event, audio_send_configs[0]));
}
TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateDelayBased) {
- const int32_t bitrate_bps = RandomBitrate();
- const BandwidthUsage detector_state = static_cast<BandwidthUsage>(
- prng_.Rand(0, static_cast<int32_t>(BandwidthUsage::kLast) - 1));
- auto event =
- rtc::MakeUnique<RtcEventBweUpdateDelayBased>(bitrate_bps, detector_state);
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+ std::unique_ptr<RtcEventBweUpdateDelayBased> event =
+ gen_.NewBweUpdateDelayBased();
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::DELAY_BASED_BWE_UPDATE);
+ const auto& bwe_delay_updates = parsed_log_.bwe_delay_updates();
- auto parsed_event = parsed_log_.GetDelayBasedBweUpdate(0);
-
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
- EXPECT_EQ(parsed_event.bitrate_bps, bitrate_bps);
- EXPECT_EQ(parsed_event.detector_state, detector_state);
+ ASSERT_EQ(bwe_delay_updates.size(), 1u);
+ EXPECT_TRUE(
+ test::VerifyLoggedBweDelayBasedUpdate(*event, bwe_delay_updates[0]));
}
TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateLossBased) {
- const int32_t bitrate_bps = RandomBitrate();
- const uint8_t fraction_loss = rtc::dchecked_cast<uint8_t>(
- prng_.Rand(0, std::numeric_limits<uint8_t>::max()));
- const int32_t total_packets = RandomInt();
+ std::unique_ptr<RtcEventBweUpdateLossBased> event =
+ gen_.NewBweUpdateLossBased();
+ history_.push_back(event->Copy());
- auto event = rtc::MakeUnique<RtcEventBweUpdateLossBased>(
- bitrate_bps, fraction_loss, total_packets);
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+ std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
+ ASSERT_TRUE(parsed_log_.ParseString(encoded));
+ const auto& bwe_loss_updates = parsed_log_.bwe_loss_updates();
+
+ ASSERT_EQ(bwe_loss_updates.size(), 1u);
+ EXPECT_TRUE(
+ test::VerifyLoggedBweLossBasedUpdate(*event, bwe_loss_updates[0]));
+}
+
+TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePairConfig) {
+ std::unique_ptr<RtcEventIceCandidatePairConfig> event =
+ gen_.NewIceCandidatePairConfig();
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::LOSS_BASED_BWE_UPDATE);
+ const auto& ice_candidate_pair_configs =
+ parsed_log_.ice_candidate_pair_configs();
+
+ ASSERT_EQ(ice_candidate_pair_configs.size(), 1u);
+ EXPECT_TRUE(test::VerifyLoggedIceCandidatePairConfig(
+ *event, ice_candidate_pair_configs[0]));
+}
- LoggedBweLossBasedUpdate bwe_update = parsed_log_.GetLossBasedBweUpdate(0);
+TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePair) {
+ std::unique_ptr<RtcEventIceCandidatePair> event = gen_.NewIceCandidatePair();
+ history_.push_back(event->Copy());
- EXPECT_EQ(bwe_update.timestamp_us, timestamp_us);
- EXPECT_EQ(bwe_update.bitrate_bps, bitrate_bps);
- EXPECT_EQ(bwe_update.fraction_lost, fraction_loss);
- EXPECT_EQ(bwe_update.expected_packets, total_packets);
+ std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
+ ASSERT_TRUE(parsed_log_.ParseString(encoded));
+ const auto& ice_candidate_pair_events =
+ parsed_log_.ice_candidate_pair_events();
+
+ ASSERT_EQ(ice_candidate_pair_events.size(), 1u);
+ EXPECT_TRUE(test::VerifyLoggedIceCandidatePairEvent(
+ *event, ice_candidate_pair_events[0]));
}
TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStarted) {
const int64_t timestamp_us = rtc::TimeMicros();
ASSERT_TRUE(parsed_log_.ParseString(encoder_->EncodeLogStart(timestamp_us)));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::LOG_START);
+ const auto& start_log_events = parsed_log_.start_log_events();
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
+ ASSERT_EQ(start_log_events.size(), 1u);
+ EXPECT_EQ(start_log_events[0].timestamp_us, timestamp_us);
}
TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStopped) {
const int64_t timestamp_us = rtc::TimeMicros();
ASSERT_TRUE(parsed_log_.ParseString(encoder_->EncodeLogEnd(timestamp_us)));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::LOG_END);
+ const auto& stop_log_events = parsed_log_.stop_log_events();
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
+ ASSERT_EQ(stop_log_events.size(), 1u);
+ EXPECT_EQ(stop_log_events[0].timestamp_us, timestamp_us);
}
TEST_P(RtcEventLogEncoderTest, RtcEventProbeClusterCreated) {
- const int32_t id = RandomPositiveInt();
- const int32_t bitrate_bps = RandomBitrate();
- const uint32_t min_probes = RandomPositiveInt();
- const uint32_t min_bytes = RandomPositiveInt();
-
- auto event = rtc::MakeUnique<RtcEventProbeClusterCreated>(
- id, bitrate_bps, min_probes, min_bytes);
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+ std::unique_ptr<RtcEventProbeClusterCreated> event =
+ gen_.NewProbeClusterCreated();
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::BWE_PROBE_CLUSTER_CREATED_EVENT);
+ const auto& bwe_probe_cluster_created_events =
+ parsed_log_.bwe_probe_cluster_created_events();
- auto parsed_event = parsed_log_.GetBweProbeClusterCreated(0);
-
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
- EXPECT_EQ(parsed_event.id, id);
- EXPECT_EQ(parsed_event.bitrate_bps, bitrate_bps);
- EXPECT_EQ(parsed_event.min_packets, min_probes);
- EXPECT_EQ(parsed_event.min_bytes, min_bytes);
+ ASSERT_EQ(bwe_probe_cluster_created_events.size(), 1u);
+ EXPECT_TRUE(test::VerifyLoggedBweProbeClusterCreatedEvent(
+ *event, bwe_probe_cluster_created_events[0]));
}
TEST_P(RtcEventLogEncoderTest, RtcEventProbeResultFailure) {
- const int id = RandomPositiveInt();
- const ProbeFailureReason failure_reason = static_cast<ProbeFailureReason>(
- prng_.Rand(0, static_cast<int32_t>(ProbeFailureReason::kLast) - 1));
-
- auto event = rtc::MakeUnique<RtcEventProbeResultFailure>(id, failure_reason);
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+ std::unique_ptr<RtcEventProbeResultFailure> event =
+ gen_.NewProbeResultFailure();
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::BWE_PROBE_FAILURE_EVENT);
-
- auto parsed_event = parsed_log_.GetBweProbeFailure(0);
+ const auto& bwe_probe_failure_events = parsed_log_.bwe_probe_failure_events();
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
- EXPECT_EQ(parsed_event.id, id);
- EXPECT_EQ(parsed_event.failure_reason, failure_reason);
+ ASSERT_EQ(bwe_probe_failure_events.size(), 1u);
+ EXPECT_TRUE(test::VerifyLoggedBweProbeFailureEvent(
+ *event, bwe_probe_failure_events[0]));
}
TEST_P(RtcEventLogEncoderTest, RtcEventProbeResultSuccess) {
- const int32_t id = RandomPositiveInt();
- const int32_t bitrate_bps = RandomBitrate();
-
- auto event = rtc::MakeUnique<RtcEventProbeResultSuccess>(id, bitrate_bps);
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+ std::unique_ptr<RtcEventProbeResultSuccess> event =
+ gen_.NewProbeResultSuccess();
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::BWE_PROBE_SUCCESS_EVENT);
+ const auto& bwe_probe_success_events = parsed_log_.bwe_probe_success_events();
- auto parsed_event = parsed_log_.GetBweProbeSuccess(0);
-
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
- EXPECT_EQ(parsed_event.id, id);
- EXPECT_EQ(parsed_event.bitrate_bps, bitrate_bps);
+ ASSERT_EQ(bwe_probe_success_events.size(), 1u);
+ EXPECT_TRUE(test::VerifyLoggedBweProbeSuccessEvent(
+ *event, bwe_probe_success_events[0]));
}
-void RtcEventLogEncoderTest::TestRtcEventRtcpPacket(PacketDirection direction) {
- rtcp::Bye bye_packet; // Arbitrarily chosen RTCP packet type.
- bye_packet.SetReason("a man's reach should exceed his grasp");
- auto rtcp_packet = bye_packet.Build();
-
- std::unique_ptr<RtcEvent> event;
- if (direction == PacketDirection::kIncomingPacket) {
- event = rtc::MakeUnique<RtcEventRtcpPacketIncoming>(rtcp_packet);
- } else {
- event = rtc::MakeUnique<RtcEventRtcpPacketOutgoing>(rtcp_packet);
- }
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketIncoming) {
+ std::unique_ptr<RtcEventRtcpPacketIncoming> event =
+ gen_.NewRtcpPacketIncoming();
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::RTCP_EVENT);
-
- PacketDirection parsed_direction;
- uint8_t parsed_packet[IP_PACKET_SIZE]; // "Parsed" = after event-encoding.
- size_t parsed_packet_length;
- parsed_log_.GetRtcpPacket(0, &parsed_direction, parsed_packet,
- &parsed_packet_length);
-
- EXPECT_EQ(parsed_direction, direction);
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
- ASSERT_EQ(parsed_packet_length, rtcp_packet.size());
- ASSERT_EQ(memcmp(parsed_packet, rtcp_packet.data(), parsed_packet_length), 0);
-}
+ const auto& incoming_rtcp_packets = parsed_log_.incoming_rtcp_packets();
-TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketIncoming) {
- TestRtcEventRtcpPacket(PacketDirection::kIncomingPacket);
+ ASSERT_EQ(incoming_rtcp_packets.size(), 1u);
+ EXPECT_TRUE(
+ test::VerifyLoggedRtcpPacketIncoming(*event, incoming_rtcp_packets[0]));
}
TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketOutgoing) {
- TestRtcEventRtcpPacket(PacketDirection::kOutgoingPacket);
-}
-
-void RtcEventLogEncoderTest::TestRtcEventRtpPacket(PacketDirection direction) {
- const int probe_cluster_id = RandomPositiveInt();
-
- std::unique_ptr<RtpPacketReceived> packet_received;
- std::unique_ptr<RtpPacketToSend> packet_to_send;
- RtpPacket* packet;
- if (direction == PacketDirection::kIncomingPacket) {
- packet_received = rtc::MakeUnique<RtpPacketReceived>();
- packet = packet_received.get();
- } else {
- packet_to_send = rtc::MakeUnique<RtpPacketToSend>(nullptr);
- packet = packet_to_send.get();
- }
- packet->SetSsrc(RandomSsrc());
- packet->SetSequenceNumber(static_cast<uint16_t>(RandomInt()));
- packet->SetPayloadSize(prng_.Rand(0u, 1000u));
- // TODO(terelius): Add marker bit, capture timestamp, CSRCs, and header
- // extensions.
-
- std::unique_ptr<RtcEvent> event;
- if (direction == PacketDirection::kIncomingPacket) {
- event = rtc::MakeUnique<RtcEventRtpPacketIncoming>(*packet_received);
- } else {
- event = rtc::MakeUnique<RtcEventRtpPacketOutgoing>(*packet_to_send,
- probe_cluster_id);
- }
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+ std::unique_ptr<RtcEventRtcpPacketOutgoing> event =
+ gen_.NewRtcpPacketOutgoing();
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::RTP_EVENT);
-
- PacketDirection parsed_direction;
- uint8_t parsed_rtp_header[IP_PACKET_SIZE];
- size_t parsed_header_length;
- size_t parsed_total_length;
- int parsed_probe_cluster_id;
- parsed_log_.GetRtpHeader(0, &parsed_direction, parsed_rtp_header,
- &parsed_header_length, &parsed_total_length,
- &parsed_probe_cluster_id);
-
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
- EXPECT_EQ(parsed_direction, direction);
- if (parsed_direction == PacketDirection::kOutgoingPacket) {
- EXPECT_EQ(parsed_probe_cluster_id, probe_cluster_id);
- }
- EXPECT_EQ(memcmp(parsed_rtp_header, packet->data(), parsed_header_length), 0);
- EXPECT_EQ(parsed_header_length, packet->headers_size());
- EXPECT_EQ(parsed_total_length, packet->size());
+ const auto& outgoing_rtcp_packets = parsed_log_.outgoing_rtcp_packets();
+
+ ASSERT_EQ(outgoing_rtcp_packets.size(), 1u);
+ EXPECT_TRUE(
+ test::VerifyLoggedRtcpPacketOutgoing(*event, outgoing_rtcp_packets[0]));
}
TEST_P(RtcEventLogEncoderTest, RtcEventRtpPacketIncoming) {
- TestRtcEventRtpPacket(PacketDirection::kIncomingPacket);
+ uint32_t ssrc = prng_.Rand<uint32_t>();
+ RtpHeaderExtensionMap extension_map; // TODO(terelius): Test extensions too.
+ std::unique_ptr<RtcEventRtpPacketIncoming> event =
+ gen_.NewRtpPacketIncoming(ssrc, extension_map);
+ history_.push_back(event->Copy());
+
+ std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
+ ASSERT_TRUE(parsed_log_.ParseString(encoded));
+ const auto& incoming_rtp_packets_by_ssrc =
+ parsed_log_.incoming_rtp_packets_by_ssrc();
+
+ ASSERT_EQ(incoming_rtp_packets_by_ssrc.size(), 1u);
+ const auto& stream = incoming_rtp_packets_by_ssrc[0];
+ EXPECT_EQ(stream.ssrc, ssrc);
+ ASSERT_EQ(stream.incoming_packets.size(), 1u);
+ EXPECT_TRUE(
+ test::VerifyLoggedRtpPacketIncoming(*event, stream.incoming_packets[0]));
}
TEST_P(RtcEventLogEncoderTest, RtcEventRtpPacketOutgoing) {
- TestRtcEventRtpPacket(PacketDirection::kOutgoingPacket);
+ uint32_t ssrc = prng_.Rand<uint32_t>();
+ RtpHeaderExtensionMap extension_map; // TODO(terelius): Test extensions too.
+ std::unique_ptr<RtcEventRtpPacketOutgoing> event =
+ gen_.NewRtpPacketOutgoing(ssrc, extension_map);
+ history_.push_back(event->Copy());
+
+ std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
+ ASSERT_TRUE(parsed_log_.ParseString(encoded));
+ const auto& outgoing_rtp_packets_by_ssrc =
+ parsed_log_.outgoing_rtp_packets_by_ssrc();
+
+ ASSERT_EQ(outgoing_rtp_packets_by_ssrc.size(), 1u);
+ const auto& stream = outgoing_rtp_packets_by_ssrc[0];
+ EXPECT_EQ(stream.ssrc, ssrc);
+ ASSERT_EQ(stream.outgoing_packets.size(), 1u);
+ EXPECT_TRUE(
+ test::VerifyLoggedRtpPacketOutgoing(*event, stream.outgoing_packets[0]));
}
TEST_P(RtcEventLogEncoderTest, RtcEventVideoReceiveStreamConfig) {
- auto stream_config = rtc::MakeUnique<rtclog::StreamConfig>();
- stream_config->local_ssrc = RandomSsrc();
- stream_config->remote_ssrc = RandomSsrc();
- stream_config->rtcp_mode = RtcpMode::kCompound;
- stream_config->remb = prng_.Rand<bool>();
- std::vector<RtpExtension> extensions = RandomRtpExtensions();
- for (const auto& extension : extensions)
- stream_config->rtp_extensions.push_back(extension);
- stream_config->codecs.emplace_back("CODEC", 122, 7);
-
- auto original_stream_config = *stream_config;
-
- auto event = rtc::MakeUnique<RtcEventVideoReceiveStreamConfig>(
- std::move(stream_config));
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+ uint32_t ssrc = prng_.Rand<uint32_t>();
+ RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
+ std::unique_ptr<RtcEventVideoReceiveStreamConfig> event =
+ gen_.NewVideoReceiveStreamConfig(ssrc, extensions);
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::VIDEO_RECEIVER_CONFIG_EVENT);
+ const auto& video_recv_configs = parsed_log_.video_recv_configs();
- auto parsed_event = parsed_log_.GetVideoReceiveConfig(0);
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
- EXPECT_EQ(parsed_event, original_stream_config);
+ ASSERT_EQ(video_recv_configs.size(), 1u);
+ EXPECT_TRUE(test::VerifyLoggedVideoRecvConfig(*event, video_recv_configs[0]));
}
TEST_P(RtcEventLogEncoderTest, RtcEventVideoSendStreamConfig) {
- auto stream_config = rtc::MakeUnique<rtclog::StreamConfig>();
- stream_config->local_ssrc = RandomSsrc();
- std::vector<RtpExtension> extensions = RandomRtpExtensions();
- for (const auto& extension : extensions)
- stream_config->rtp_extensions.push_back(extension);
- stream_config->codecs.emplace_back("CODEC", 120, 3);
-
- auto original_stream_config = *stream_config;
-
- auto event =
- rtc::MakeUnique<RtcEventVideoSendStreamConfig>(std::move(stream_config));
- const int64_t timestamp_us = event->timestamp_us_;
- history_.push_back(std::move(event));
+ uint32_t ssrc = prng_.Rand<uint32_t>();
+ RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
+ std::unique_ptr<RtcEventVideoSendStreamConfig> event =
+ gen_.NewVideoSendStreamConfig(ssrc, extensions);
+ history_.push_back(event->Copy());
std::string encoded = encoder_->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded));
- ASSERT_EQ(parsed_log_.GetNumberOfEvents(), 1u);
- ASSERT_EQ(parsed_log_.GetEventType(0),
- ParsedRtcEventLogNew::EventType::VIDEO_SENDER_CONFIG_EVENT);
+ const auto& video_send_configs = parsed_log_.video_send_configs();
- auto parsed_event = parsed_log_.GetVideoSendConfig(0)[0];
- EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
- EXPECT_EQ(parsed_event, original_stream_config);
+ ASSERT_EQ(video_send_configs.size(), 1u);
+ EXPECT_TRUE(test::VerifyLoggedVideoSendConfig(*event, video_send_configs[0]));
}
INSTANTIATE_TEST_CASE_P(RandomSeeds,
diff --git a/logging/rtc_event_log/events/rtc_event_alr_state.cc b/logging/rtc_event_log/events/rtc_event_alr_state.cc
index 249cda9710..7c5257a914 100644
--- a/logging/rtc_event_log/events/rtc_event_alr_state.cc
+++ b/logging/rtc_event_log/events/rtc_event_alr_state.cc
@@ -15,6 +15,9 @@ namespace webrtc {
RtcEventAlrState::RtcEventAlrState(bool in_alr) : in_alr_(in_alr) {}
+RtcEventAlrState::RtcEventAlrState(const RtcEventAlrState& other)
+ : RtcEvent(other.timestamp_us_), in_alr_(other.in_alr_) {}
+
RtcEventAlrState::~RtcEventAlrState() = default;
RtcEvent::Type RtcEventAlrState::GetType() const {
@@ -26,7 +29,7 @@ bool RtcEventAlrState::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventAlrState::Copy() const {
- return rtc::MakeUnique<RtcEventAlrState>(in_alr_);
+ return rtc::WrapUnique<RtcEvent>(new RtcEventAlrState(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_alr_state.h b/logging/rtc_event_log/events/rtc_event_alr_state.h
index 2f041d02c6..e737c915e1 100644
--- a/logging/rtc_event_log/events/rtc_event_alr_state.h
+++ b/logging/rtc_event_log/events/rtc_event_alr_state.h
@@ -29,6 +29,9 @@ class RtcEventAlrState final : public RtcEvent {
std::unique_ptr<RtcEvent> Copy() const override;
const bool in_alr_;
+
+ private:
+ RtcEventAlrState(const RtcEventAlrState& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.cc b/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.cc
index ea41c879aa..be73d786a1 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.cc
+++ b/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.cc
@@ -21,6 +21,11 @@ RtcEventAudioNetworkAdaptation::RtcEventAudioNetworkAdaptation(
std::unique_ptr<AudioEncoderRuntimeConfig> config)
: config_(std::move(config)) {}
+RtcEventAudioNetworkAdaptation::RtcEventAudioNetworkAdaptation(
+ const RtcEventAudioNetworkAdaptation& other)
+ : RtcEvent(other.timestamp_us_),
+ config_(rtc::MakeUnique<AudioEncoderRuntimeConfig>(*other.config_)) {}
+
RtcEventAudioNetworkAdaptation::~RtcEventAudioNetworkAdaptation() = default;
RtcEvent::Type RtcEventAudioNetworkAdaptation::GetType() const {
@@ -32,9 +37,7 @@ bool RtcEventAudioNetworkAdaptation::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventAudioNetworkAdaptation::Copy() const {
- auto config_copy = rtc::MakeUnique<AudioEncoderRuntimeConfig>(*config_);
- return rtc::MakeUnique<RtcEventAudioNetworkAdaptation>(
- std::move(config_copy));
+ return rtc::WrapUnique(new RtcEventAudioNetworkAdaptation(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h b/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h
index 0caacb4b3c..65fbad8621 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h
+++ b/logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h
@@ -32,6 +32,9 @@ class RtcEventAudioNetworkAdaptation final : public RtcEvent {
std::unique_ptr<RtcEvent> Copy() const override;
const std::unique_ptr<const AudioEncoderRuntimeConfig> config_;
+
+ private:
+ RtcEventAudioNetworkAdaptation(const RtcEventAudioNetworkAdaptation& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_audio_playout.cc b/logging/rtc_event_log/events/rtc_event_audio_playout.cc
index fd02c1f446..73cf5f5f11 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_playout.cc
+++ b/logging/rtc_event_log/events/rtc_event_audio_playout.cc
@@ -16,6 +16,9 @@ namespace webrtc {
RtcEventAudioPlayout::RtcEventAudioPlayout(uint32_t ssrc) : ssrc_(ssrc) {}
+RtcEventAudioPlayout::RtcEventAudioPlayout(const RtcEventAudioPlayout& other)
+ : RtcEvent(other.timestamp_us_), ssrc_(other.ssrc_) {}
+
RtcEvent::Type RtcEventAudioPlayout::GetType() const {
return RtcEvent::Type::AudioPlayout;
}
@@ -25,7 +28,7 @@ bool RtcEventAudioPlayout::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventAudioPlayout::Copy() const {
- return rtc::MakeUnique<RtcEventAudioPlayout>(ssrc_);
+ return rtc::WrapUnique<RtcEvent>(new RtcEventAudioPlayout(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_audio_playout.h b/logging/rtc_event_log/events/rtc_event_audio_playout.h
index ab57a994de..3080f5b9f0 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_playout.h
+++ b/logging/rtc_event_log/events/rtc_event_audio_playout.h
@@ -29,6 +29,9 @@ class RtcEventAudioPlayout final : public RtcEvent {
std::unique_ptr<RtcEvent> Copy() const override;
const uint32_t ssrc_;
+
+ private:
+ RtcEventAudioPlayout(const RtcEventAudioPlayout& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.cc b/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.cc
index 8aefb1f390..0be3b24743 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.cc
+++ b/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.cc
@@ -21,6 +21,11 @@ RtcEventAudioReceiveStreamConfig::RtcEventAudioReceiveStreamConfig(
std::unique_ptr<rtclog::StreamConfig> config)
: config_(std::move(config)) {}
+RtcEventAudioReceiveStreamConfig::RtcEventAudioReceiveStreamConfig(
+ const RtcEventAudioReceiveStreamConfig& other)
+ : RtcEvent(other.timestamp_us_),
+ config_(rtc::MakeUnique<rtclog::StreamConfig>(*other.config_)) {}
+
RtcEventAudioReceiveStreamConfig::~RtcEventAudioReceiveStreamConfig() = default;
RtcEvent::Type RtcEventAudioReceiveStreamConfig::GetType() const {
@@ -33,8 +38,7 @@ bool RtcEventAudioReceiveStreamConfig::IsConfigEvent() const {
std::unique_ptr<RtcEvent> RtcEventAudioReceiveStreamConfig::Copy() const {
auto config_copy = rtc::MakeUnique<rtclog::StreamConfig>(*config_);
- return rtc::MakeUnique<RtcEventAudioReceiveStreamConfig>(
- std::move(config_copy));
+ return rtc::WrapUnique<RtcEvent>(new RtcEventAudioReceiveStreamConfig(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h b/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h
index e5c7784cc4..2757650314 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h
+++ b/logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h
@@ -34,6 +34,10 @@ class RtcEventAudioReceiveStreamConfig final : public RtcEvent {
std::unique_ptr<RtcEvent> Copy() const override;
const std::unique_ptr<const rtclog::StreamConfig> config_;
+
+ private:
+ RtcEventAudioReceiveStreamConfig(
+ const RtcEventAudioReceiveStreamConfig& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.cc b/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.cc
index 496c192fec..c9f8dd6f4a 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.cc
+++ b/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.cc
@@ -21,6 +21,11 @@ RtcEventAudioSendStreamConfig::RtcEventAudioSendStreamConfig(
std::unique_ptr<rtclog::StreamConfig> config)
: config_(std::move(config)) {}
+RtcEventAudioSendStreamConfig::RtcEventAudioSendStreamConfig(
+ const RtcEventAudioSendStreamConfig& other)
+ : RtcEvent(other.timestamp_us_),
+ config_(rtc::MakeUnique<rtclog::StreamConfig>(*other.config_)) {}
+
RtcEventAudioSendStreamConfig::~RtcEventAudioSendStreamConfig() = default;
RtcEvent::Type RtcEventAudioSendStreamConfig::GetType() const {
@@ -33,7 +38,7 @@ bool RtcEventAudioSendStreamConfig::IsConfigEvent() const {
std::unique_ptr<RtcEvent> RtcEventAudioSendStreamConfig::Copy() const {
auto config_copy = rtc::MakeUnique<rtclog::StreamConfig>(*config_);
- return rtc::MakeUnique<RtcEventAudioSendStreamConfig>(std::move(config_copy));
+ return rtc::WrapUnique<RtcEvent>(new RtcEventAudioSendStreamConfig(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h b/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h
index 13b35b34bc..b248a61915 100644
--- a/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h
+++ b/logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h
@@ -34,6 +34,9 @@ class RtcEventAudioSendStreamConfig final : public RtcEvent {
std::unique_ptr<RtcEvent> Copy() const override;
const std::unique_ptr<const rtclog::StreamConfig> config_;
+
+ private:
+ RtcEventAudioSendStreamConfig(const RtcEventAudioSendStreamConfig& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.cc b/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.cc
index c814dcfe4b..a2c2b6b544 100644
--- a/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.cc
+++ b/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.cc
@@ -20,6 +20,12 @@ RtcEventBweUpdateDelayBased::RtcEventBweUpdateDelayBased(
BandwidthUsage detector_state)
: bitrate_bps_(bitrate_bps), detector_state_(detector_state) {}
+RtcEventBweUpdateDelayBased::RtcEventBweUpdateDelayBased(
+ const RtcEventBweUpdateDelayBased& other)
+ : RtcEvent(other.timestamp_us_),
+ bitrate_bps_(other.bitrate_bps_),
+ detector_state_(other.detector_state_) {}
+
RtcEventBweUpdateDelayBased::~RtcEventBweUpdateDelayBased() = default;
RtcEvent::Type RtcEventBweUpdateDelayBased::GetType() const {
@@ -31,8 +37,7 @@ bool RtcEventBweUpdateDelayBased::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventBweUpdateDelayBased::Copy() const {
- return rtc::MakeUnique<RtcEventBweUpdateDelayBased>(bitrate_bps_,
- detector_state_);
+ return rtc::WrapUnique<RtcEvent>(new RtcEventBweUpdateDelayBased(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h b/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h
index 4d49a3f647..3f47dc7f97 100644
--- a/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h
+++ b/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h
@@ -33,6 +33,9 @@ class RtcEventBweUpdateDelayBased final : public RtcEvent {
const int32_t bitrate_bps_;
const BandwidthUsage detector_state_;
+
+ private:
+ RtcEventBweUpdateDelayBased(const RtcEventBweUpdateDelayBased& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.cc b/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.cc
index 54891c3ce8..89afad4538 100644
--- a/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.cc
+++ b/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.cc
@@ -21,6 +21,13 @@ RtcEventBweUpdateLossBased::RtcEventBweUpdateLossBased(int32_t bitrate_bps,
fraction_loss_(fraction_loss),
total_packets_(total_packets) {}
+RtcEventBweUpdateLossBased::RtcEventBweUpdateLossBased(
+ const RtcEventBweUpdateLossBased& other)
+ : RtcEvent(other.timestamp_us_),
+ bitrate_bps_(other.bitrate_bps_),
+ fraction_loss_(other.fraction_loss_),
+ total_packets_(other.total_packets_) {}
+
RtcEventBweUpdateLossBased::~RtcEventBweUpdateLossBased() = default;
RtcEvent::Type RtcEventBweUpdateLossBased::GetType() const {
@@ -32,8 +39,7 @@ bool RtcEventBweUpdateLossBased::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventBweUpdateLossBased::Copy() const {
- return rtc::MakeUnique<RtcEventBweUpdateLossBased>(
- bitrate_bps_, fraction_loss_, total_packets_);
+ return rtc::WrapUnique<RtcEvent>(new RtcEventBweUpdateLossBased(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h b/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h
index 6b3200a0c7..2d4ffda1b1 100644
--- a/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h
+++ b/logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h
@@ -33,6 +33,9 @@ class RtcEventBweUpdateLossBased final : public RtcEvent {
const int32_t bitrate_bps_;
const uint8_t fraction_loss_;
const int32_t total_packets_;
+
+ private:
+ RtcEventBweUpdateLossBased(const RtcEventBweUpdateLossBased& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.cc b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.cc
index 2499b111e7..d3d54cfcf1 100644
--- a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.cc
+++ b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.cc
@@ -19,6 +19,12 @@ RtcEventIceCandidatePair::RtcEventIceCandidatePair(
uint32_t candidate_pair_id)
: type_(type), candidate_pair_id_(candidate_pair_id) {}
+RtcEventIceCandidatePair::RtcEventIceCandidatePair(
+ const RtcEventIceCandidatePair& other)
+ : RtcEvent(other.timestamp_us_),
+ type_(other.type_),
+ candidate_pair_id_(other.candidate_pair_id_) {}
+
RtcEventIceCandidatePair::~RtcEventIceCandidatePair() = default;
RtcEvent::Type RtcEventIceCandidatePair::GetType() const {
@@ -30,7 +36,7 @@ bool RtcEventIceCandidatePair::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventIceCandidatePair::Copy() const {
- return rtc::MakeUnique<RtcEventIceCandidatePair>(type_, candidate_pair_id_);
+ return rtc::WrapUnique<RtcEvent>(new RtcEventIceCandidatePair(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h
index d0bed5f17f..f49a0d1792 100644
--- a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h
+++ b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h
@@ -40,6 +40,9 @@ class RtcEventIceCandidatePair final : public RtcEvent {
const IceCandidatePairEventType type_;
const uint32_t candidate_pair_id_;
+
+ private:
+ RtcEventIceCandidatePair(const RtcEventIceCandidatePair& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.cc b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.cc
index b3d55610ef..7ed877fa17 100644
--- a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.cc
+++ b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.cc
@@ -45,6 +45,13 @@ RtcEventIceCandidatePairConfig::RtcEventIceCandidatePairConfig(
candidate_pair_id_(candidate_pair_id),
candidate_pair_desc_(candidate_pair_desc) {}
+RtcEventIceCandidatePairConfig::RtcEventIceCandidatePairConfig(
+ const RtcEventIceCandidatePairConfig& other)
+ : RtcEvent(other.timestamp_us_),
+ type_(other.type_),
+ candidate_pair_id_(other.candidate_pair_id_),
+ candidate_pair_desc_(other.candidate_pair_desc_) {}
+
RtcEventIceCandidatePairConfig::~RtcEventIceCandidatePairConfig() = default;
RtcEvent::Type RtcEventIceCandidatePairConfig::GetType() const {
@@ -58,8 +65,7 @@ bool RtcEventIceCandidatePairConfig::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventIceCandidatePairConfig::Copy() const {
- return rtc::MakeUnique<RtcEventIceCandidatePairConfig>(
- type_, candidate_pair_id_, candidate_pair_desc_);
+ return rtc::WrapUnique<RtcEvent>(new RtcEventIceCandidatePairConfig(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h
index 4c161455a4..1f6eb8ceb0 100644
--- a/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h
+++ b/logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h
@@ -97,6 +97,9 @@ class RtcEventIceCandidatePairConfig final : public RtcEvent {
const IceCandidatePairConfigType type_;
const uint32_t candidate_pair_id_;
const IceCandidatePairDescription candidate_pair_desc_;
+
+ private:
+ RtcEventIceCandidatePairConfig(const RtcEventIceCandidatePairConfig& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_probe_cluster_created.cc b/logging/rtc_event_log/events/rtc_event_probe_cluster_created.cc
index a1ee9604e8..da1ac5aaad 100644
--- a/logging/rtc_event_log/events/rtc_event_probe_cluster_created.cc
+++ b/logging/rtc_event_log/events/rtc_event_probe_cluster_created.cc
@@ -23,6 +23,14 @@ RtcEventProbeClusterCreated::RtcEventProbeClusterCreated(int32_t id,
min_probes_(min_probes),
min_bytes_(min_bytes) {}
+RtcEventProbeClusterCreated::RtcEventProbeClusterCreated(
+ const RtcEventProbeClusterCreated& other)
+ : RtcEvent(other.timestamp_us_),
+ id_(other.id_),
+ bitrate_bps_(other.bitrate_bps_),
+ min_probes_(other.min_probes_),
+ min_bytes_(other.min_bytes_) {}
+
RtcEvent::Type RtcEventProbeClusterCreated::GetType() const {
return RtcEvent::Type::ProbeClusterCreated;
}
@@ -32,8 +40,7 @@ bool RtcEventProbeClusterCreated::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventProbeClusterCreated::Copy() const {
- return rtc::MakeUnique<RtcEventProbeClusterCreated>(id_, bitrate_bps_,
- min_probes_, min_bytes_);
+ return rtc::WrapUnique<RtcEvent>(new RtcEventProbeClusterCreated(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h b/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h
index cbf80cbec5..3e8c21f5c9 100644
--- a/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h
+++ b/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h
@@ -35,6 +35,9 @@ class RtcEventProbeClusterCreated final : public RtcEvent {
const int32_t bitrate_bps_;
const uint32_t min_probes_;
const uint32_t min_bytes_;
+
+ private:
+ RtcEventProbeClusterCreated(const RtcEventProbeClusterCreated& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_probe_result_failure.cc b/logging/rtc_event_log/events/rtc_event_probe_result_failure.cc
index c9b2233033..2ae369db56 100644
--- a/logging/rtc_event_log/events/rtc_event_probe_result_failure.cc
+++ b/logging/rtc_event_log/events/rtc_event_probe_result_failure.cc
@@ -19,6 +19,12 @@ RtcEventProbeResultFailure::RtcEventProbeResultFailure(
ProbeFailureReason failure_reason)
: id_(id), failure_reason_(failure_reason) {}
+RtcEventProbeResultFailure::RtcEventProbeResultFailure(
+ const RtcEventProbeResultFailure& other)
+ : RtcEvent(other.timestamp_us_),
+ id_(other.id_),
+ failure_reason_(other.failure_reason_) {}
+
RtcEvent::Type RtcEventProbeResultFailure::GetType() const {
return RtcEvent::Type::ProbeResultFailure;
}
@@ -28,7 +34,7 @@ bool RtcEventProbeResultFailure::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventProbeResultFailure::Copy() const {
- return rtc::MakeUnique<RtcEventProbeResultFailure>(id_, failure_reason_);
+ return rtc::WrapUnique<RtcEvent>(new RtcEventProbeResultFailure(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_probe_result_failure.h b/logging/rtc_event_log/events/rtc_event_probe_result_failure.h
index 00b537adbd..181c694037 100644
--- a/logging/rtc_event_log/events/rtc_event_probe_result_failure.h
+++ b/logging/rtc_event_log/events/rtc_event_probe_result_failure.h
@@ -37,6 +37,9 @@ class RtcEventProbeResultFailure final : public RtcEvent {
const int32_t id_;
const ProbeFailureReason failure_reason_;
+
+ private:
+ RtcEventProbeResultFailure(const RtcEventProbeResultFailure& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_probe_result_success.cc b/logging/rtc_event_log/events/rtc_event_probe_result_success.cc
index 9257f9a3e4..87abc1c1ca 100644
--- a/logging/rtc_event_log/events/rtc_event_probe_result_success.cc
+++ b/logging/rtc_event_log/events/rtc_event_probe_result_success.cc
@@ -18,6 +18,12 @@ RtcEventProbeResultSuccess::RtcEventProbeResultSuccess(int32_t id,
int32_t bitrate_bps)
: id_(id), bitrate_bps_(bitrate_bps) {}
+RtcEventProbeResultSuccess::RtcEventProbeResultSuccess(
+ const RtcEventProbeResultSuccess& other)
+ : RtcEvent(other.timestamp_us_),
+ id_(other.id_),
+ bitrate_bps_(other.bitrate_bps_) {}
+
RtcEvent::Type RtcEventProbeResultSuccess::GetType() const {
return RtcEvent::Type::ProbeResultSuccess;
}
@@ -27,7 +33,7 @@ bool RtcEventProbeResultSuccess::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventProbeResultSuccess::Copy() const {
- return rtc::MakeUnique<RtcEventProbeResultSuccess>(id_, bitrate_bps_);
+ return rtc::WrapUnique<RtcEvent>(new RtcEventProbeResultSuccess(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_probe_result_success.h b/logging/rtc_event_log/events/rtc_event_probe_result_success.h
index fa42fcb3d5..15ff1833bf 100644
--- a/logging/rtc_event_log/events/rtc_event_probe_result_success.h
+++ b/logging/rtc_event_log/events/rtc_event_probe_result_success.h
@@ -30,6 +30,9 @@ class RtcEventProbeResultSuccess final : public RtcEvent {
const int32_t id_;
const int32_t bitrate_bps_;
+
+ private:
+ RtcEventProbeResultSuccess(const RtcEventProbeResultSuccess& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.cc b/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.cc
index d28916340c..c1a667a99b 100644
--- a/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.cc
+++ b/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.cc
@@ -18,6 +18,11 @@ RtcEventRtcpPacketIncoming::RtcEventRtcpPacketIncoming(
rtc::ArrayView<const uint8_t> packet)
: packet_(packet.data(), packet.size()) {}
+RtcEventRtcpPacketIncoming::RtcEventRtcpPacketIncoming(
+ const RtcEventRtcpPacketIncoming& other)
+ : RtcEvent(other.timestamp_us_),
+ packet_(other.packet_.data(), other.packet_.size()) {}
+
RtcEventRtcpPacketIncoming::~RtcEventRtcpPacketIncoming() = default;
RtcEvent::Type RtcEventRtcpPacketIncoming::GetType() const {
@@ -29,8 +34,7 @@ bool RtcEventRtcpPacketIncoming::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventRtcpPacketIncoming::Copy() const {
- return rtc::MakeUnique<RtcEventRtcpPacketIncoming>(
- rtc::ArrayView<const uint8_t>(packet_.data(), packet_.size()));
+ return rtc::WrapUnique<RtcEvent>(new RtcEventRtcpPacketIncoming(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h b/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h
index d8e4ed10ff..6d904953a4 100644
--- a/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h
+++ b/logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h
@@ -31,6 +31,9 @@ class RtcEventRtcpPacketIncoming final : public RtcEvent {
std::unique_ptr<RtcEvent> Copy() const override;
rtc::Buffer packet_;
+
+ private:
+ RtcEventRtcpPacketIncoming(const RtcEventRtcpPacketIncoming& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.cc b/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.cc
index 6d74567144..04731bf096 100644
--- a/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.cc
+++ b/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.cc
@@ -18,6 +18,11 @@ RtcEventRtcpPacketOutgoing::RtcEventRtcpPacketOutgoing(
rtc::ArrayView<const uint8_t> packet)
: packet_(packet.data(), packet.size()) {}
+RtcEventRtcpPacketOutgoing::RtcEventRtcpPacketOutgoing(
+ const RtcEventRtcpPacketOutgoing& other)
+ : RtcEvent(other.timestamp_us_),
+ packet_(other.packet_.data(), other.packet_.size()) {}
+
RtcEventRtcpPacketOutgoing::~RtcEventRtcpPacketOutgoing() = default;
RtcEvent::Type RtcEventRtcpPacketOutgoing::GetType() const {
@@ -29,8 +34,7 @@ bool RtcEventRtcpPacketOutgoing::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventRtcpPacketOutgoing::Copy() const {
- return rtc::MakeUnique<RtcEventRtcpPacketOutgoing>(
- rtc::ArrayView<const uint8_t>(packet_.data(), packet_.size()));
+ return rtc::WrapUnique<RtcEvent>(new RtcEventRtcpPacketOutgoing(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h b/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h
index ed6b9fb226..3aa9e7199a 100644
--- a/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h
+++ b/logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h
@@ -31,6 +31,9 @@ class RtcEventRtcpPacketOutgoing final : public RtcEvent {
std::unique_ptr<RtcEvent> Copy() const override;
rtc::Buffer packet_;
+
+ private:
+ RtcEventRtcpPacketOutgoing(const RtcEventRtcpPacketOutgoing& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.cc b/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.cc
index 3c0be49147..58b65a9251 100644
--- a/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.cc
+++ b/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.cc
@@ -38,7 +38,7 @@ bool RtcEventRtpPacketIncoming::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventRtpPacketIncoming::Copy() const {
- return rtc::MakeUnique<RtcEventRtpPacketIncoming>(*this);
+ return rtc::WrapUnique<RtcEvent>(new RtcEventRtpPacketIncoming(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h b/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h
index 513fcaf66a..6b141b6d57 100644
--- a/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h
+++ b/logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h
@@ -23,7 +23,6 @@ class RtpPacketReceived;
class RtcEventRtpPacketIncoming final : public RtcEvent {
public:
explicit RtcEventRtpPacketIncoming(const RtpPacketReceived& packet);
- RtcEventRtpPacketIncoming(const RtcEventRtpPacketIncoming& other);
~RtcEventRtpPacketIncoming() override;
Type GetType() const override;
@@ -34,6 +33,9 @@ class RtcEventRtpPacketIncoming final : public RtcEvent {
RtpPacket header_; // Only the packet's header will be stored here.
const size_t packet_length_; // Length before stripping away all but header.
+
+ private:
+ RtcEventRtpPacketIncoming(const RtcEventRtpPacketIncoming& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.cc b/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.cc
index 18d386124d..9c504076d8 100644
--- a/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.cc
+++ b/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.cc
@@ -41,7 +41,7 @@ bool RtcEventRtpPacketOutgoing::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventRtpPacketOutgoing::Copy() const {
- return rtc::MakeUnique<RtcEventRtpPacketOutgoing>(*this);
+ return rtc::WrapUnique<RtcEvent>(new RtcEventRtpPacketOutgoing(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h b/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h
index f83ae20e4c..171a21c420 100644
--- a/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h
+++ b/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h
@@ -24,7 +24,6 @@ class RtcEventRtpPacketOutgoing final : public RtcEvent {
public:
RtcEventRtpPacketOutgoing(const RtpPacketToSend& packet,
int probe_cluster_id);
- RtcEventRtpPacketOutgoing(const RtcEventRtpPacketOutgoing& other);
~RtcEventRtpPacketOutgoing() override;
Type GetType() const override;
@@ -36,6 +35,9 @@ class RtcEventRtpPacketOutgoing final : public RtcEvent {
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_;
+
+ private:
+ RtcEventRtpPacketOutgoing(const RtcEventRtpPacketOutgoing& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.cc b/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.cc
index 8d58542265..517f731b6b 100644
--- a/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.cc
+++ b/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.cc
@@ -20,6 +20,11 @@ RtcEventVideoReceiveStreamConfig::RtcEventVideoReceiveStreamConfig(
std::unique_ptr<rtclog::StreamConfig> config)
: config_(std::move(config)) {}
+RtcEventVideoReceiveStreamConfig::RtcEventVideoReceiveStreamConfig(
+ const RtcEventVideoReceiveStreamConfig& other)
+ : RtcEvent(other.timestamp_us_),
+ config_(rtc::MakeUnique<rtclog::StreamConfig>(*other.config_)) {}
+
RtcEventVideoReceiveStreamConfig::~RtcEventVideoReceiveStreamConfig() = default;
RtcEvent::Type RtcEventVideoReceiveStreamConfig::GetType() const {
@@ -31,9 +36,7 @@ bool RtcEventVideoReceiveStreamConfig::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventVideoReceiveStreamConfig::Copy() const {
- auto config_copy = rtc::MakeUnique<rtclog::StreamConfig>(*config_);
- return rtc::MakeUnique<RtcEventVideoReceiveStreamConfig>(
- std::move(config_copy));
+ return rtc::WrapUnique<RtcEvent>(new RtcEventVideoReceiveStreamConfig(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h b/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h
index 06188c2cc6..c6263c3fdb 100644
--- a/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h
+++ b/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h
@@ -31,6 +31,10 @@ class RtcEventVideoReceiveStreamConfig final : public RtcEvent {
std::unique_ptr<RtcEvent> Copy() const override;
const std::unique_ptr<const rtclog::StreamConfig> config_;
+
+ private:
+ RtcEventVideoReceiveStreamConfig(
+ const RtcEventVideoReceiveStreamConfig& other);
};
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_video_send_stream_config.cc b/logging/rtc_event_log/events/rtc_event_video_send_stream_config.cc
index 63300b3add..0e54c970a3 100644
--- a/logging/rtc_event_log/events/rtc_event_video_send_stream_config.cc
+++ b/logging/rtc_event_log/events/rtc_event_video_send_stream_config.cc
@@ -20,6 +20,11 @@ RtcEventVideoSendStreamConfig::RtcEventVideoSendStreamConfig(
std::unique_ptr<rtclog::StreamConfig> config)
: config_(std::move(config)) {}
+RtcEventVideoSendStreamConfig::RtcEventVideoSendStreamConfig(
+ const RtcEventVideoSendStreamConfig& other)
+ : RtcEvent(other.timestamp_us_),
+ config_(rtc::MakeUnique<rtclog::StreamConfig>(*other.config_)) {}
+
RtcEventVideoSendStreamConfig::~RtcEventVideoSendStreamConfig() = default;
RtcEvent::Type RtcEventVideoSendStreamConfig::GetType() const {
@@ -31,8 +36,7 @@ bool RtcEventVideoSendStreamConfig::IsConfigEvent() const {
}
std::unique_ptr<RtcEvent> RtcEventVideoSendStreamConfig::Copy() const {
- auto config_copy = rtc::MakeUnique<rtclog::StreamConfig>(*config_);
- return rtc::MakeUnique<RtcEventVideoSendStreamConfig>(std::move(config_copy));
+ return rtc::WrapUnique<RtcEvent>(new RtcEventVideoSendStreamConfig(*this));
}
} // namespace webrtc
diff --git a/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h b/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h
index c36b506978..3472f8855b 100644
--- a/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h
+++ b/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h
@@ -31,6 +31,9 @@ class RtcEventVideoSendStreamConfig final : public RtcEvent {
std::unique_ptr<RtcEvent> Copy() const override;
const std::unique_ptr<const rtclog::StreamConfig> config_;
+
+ private:
+ RtcEventVideoSendStreamConfig(const RtcEventVideoSendStreamConfig& other);
};
} // namespace webrtc