From 2fa477406771a09b2276085cdeb0f5a12ee961a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Terelius?= Date: Mon, 24 May 2021 13:10:41 +0000 Subject: [PATCH] Revert "Deprecate microsecond timestamps in RTC event log." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e6ee8fab7eac915b2b6abc9b71b6d33ad086f3d1. Reason for revert: Breaks downstream test Original change's description: > Deprecate microsecond timestamps in RTC event log. > > (Microsecond timestamps are only used in the legacy wire-format, > and the clocks only have microsecond resolution on some platforms.) > > Also convert structs on the parsing side to use a Timestamp instead > of a uint64_t to represent the log time. > > Bug: webrtc:11933 > Change-Id: Ide5a0217d99f13f2e243115b163f13e0525648c7 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219467 > Commit-Queue: Björn Terelius > Reviewed-by: Christoffer Rodbro > Reviewed-by: Sebastian Jansson > Cr-Commit-Position: refs/heads/master@{#34097} TBR=terelius@webrtc.org,srte@webrtc.org,crodbro@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com Change-Id: I478c9a4a1664b984891c4fcfc78f0ce9a51fe4c0 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:11933 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219636 Reviewed-by: Björn Terelius Commit-Queue: Björn Terelius Cr-Commit-Position: refs/heads/master@{#34100} --- api/rtc_event_log/rtc_event.cc | 2 +- logging/BUILD.gn | 7 - .../encoder/rtc_event_log_encoder_unittest.cc | 82 ++++----- .../events/rtc_event_alr_state.h | 11 +- .../rtc_event_audio_network_adaptation.h | 11 +- .../events/rtc_event_audio_playout.h | 11 +- .../rtc_event_audio_receive_stream_config.h | 11 +- .../rtc_event_audio_send_stream_config.h | 10 +- .../events/rtc_event_bwe_update_delay_based.h | 11 +- .../events/rtc_event_bwe_update_loss_based.h | 11 +- .../events/rtc_event_dtls_transport_state.h | 7 +- .../events/rtc_event_dtls_writable_state.h | 7 +- .../events/rtc_event_frame_decoded.h | 7 +- .../events/rtc_event_generic_ack_received.h | 11 +- .../rtc_event_generic_packet_received.h | 11 +- .../events/rtc_event_generic_packet_sent.h | 11 +- .../events/rtc_event_ice_candidate_pair.h | 11 +- .../rtc_event_ice_candidate_pair_config.h | 7 +- .../events/rtc_event_probe_cluster_created.h | 11 +- .../events/rtc_event_probe_result_failure.h | 11 +- .../events/rtc_event_probe_result_success.h | 11 +- .../events/rtc_event_remote_estimate.h | 7 +- .../events/rtc_event_route_change.h | 13 +- .../rtc_event_video_receive_stream_config.h | 11 +- .../rtc_event_video_send_stream_config.h | 11 +- logging/rtc_event_log/logged_events.cc | 8 +- logging/rtc_event_log/logged_events.h | 173 +++++++++--------- logging/rtc_event_log/rtc_event_log_impl.cc | 6 +- logging/rtc_event_log/rtc_event_log_parser.cc | 159 ++++++++-------- .../rtc_event_log/rtc_event_log_unittest.cc | 4 +- .../rtc_event_log_unittest_helper.cc | 42 ++--- .../rtc_event_log_unittest_helper.h | 20 +- .../rtc_event_processor_unittest.cc | 8 +- 33 files changed, 349 insertions(+), 385 deletions(-) diff --git a/api/rtc_event_log/rtc_event.cc b/api/rtc_event_log/rtc_event.cc index 631188b915..81e6a4e6da 100644 --- a/api/rtc_event_log/rtc_event.cc +++ b/api/rtc_event_log/rtc_event.cc @@ -14,6 +14,6 @@ namespace webrtc { -RtcEvent::RtcEvent() : timestamp_us_(rtc::TimeMillis() * 1000) {} +RtcEvent::RtcEvent() : timestamp_us_(rtc::TimeMicros()) {} } // namespace webrtc diff --git a/logging/BUILD.gn b/logging/BUILD.gn index 90a05f7c49..519f357345 100644 --- a/logging/BUILD.gn +++ b/logging/BUILD.gn @@ -53,7 +53,6 @@ rtc_library("rtc_event_pacing") { deps = [ "../api:scoped_refptr", "../api/rtc_event_log", - "../api/units:timestamp", ] absl_deps = [ "//third_party/abseil-cpp/absl/memory" ] } @@ -74,7 +73,6 @@ rtc_library("rtc_event_audio") { ":rtc_stream_config", "../api:scoped_refptr", "../api/rtc_event_log", - "../api/units:timestamp", "../modules/audio_coding:audio_network_adaptor_config", "../rtc_base:checks", ] @@ -103,7 +101,6 @@ rtc_library("rtc_event_bwe") { "../api:scoped_refptr", "../api/rtc_event_log", "../api/units:data_rate", - "../api/units:timestamp", ] absl_deps = [ "//third_party/abseil-cpp/absl/memory", @@ -118,7 +115,6 @@ rtc_library("rtc_event_frame_events") { ] deps = [ "../api/rtc_event_log", - "../api/units:timestamp", "../api/video:video_frame", "../rtc_base:timeutils", ] @@ -140,7 +136,6 @@ rtc_library("rtc_event_generic_packet_events") { ] deps = [ "../api/rtc_event_log", - "../api/units:timestamp", "../rtc_base:timeutils", ] absl_deps = [ @@ -184,7 +179,6 @@ rtc_library("rtc_event_video") { ":rtc_stream_config", "../api:scoped_refptr", "../api/rtc_event_log", - "../api/units:timestamp", "../rtc_base:checks", ] absl_deps = [ "//third_party/abseil-cpp/absl/memory" ] @@ -458,7 +452,6 @@ rtc_library("ice_log") { "../api:libjingle_logging_api", "../api:libjingle_peerconnection_api", # For api/dtls_transport_interface.h "../api/rtc_event_log", - "../api/units:timestamp", "../rtc_base:rtc_base_approved", ] absl_deps = [ "//third_party/abseil-cpp/absl/memory" ] 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 063d425af5..cd6e1b35f8 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 @@ -721,35 +721,33 @@ TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePair) { } TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStarted) { - 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 timestamp_us = rtc::TimeMicros(); + const int64_t utc_time_us = rtc::TimeUTCMicros(); // Overwrite the previously encoded LogStart event. - encoded_ = encoder_->EncodeLogStart(timestamp_ms * 1000, utc_time_ms * 1000); + encoded_ = encoder_->EncodeLogStart(timestamp_us, utc_time_us); ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok()); const auto& start_log_events = parsed_log_.start_log_events(); ASSERT_EQ(start_log_events.size(), 1u); - verifier_.VerifyLoggedStartEvent(timestamp_ms * 1000, utc_time_ms * 1000, + verifier_.VerifyLoggedStartEvent(timestamp_us, utc_time_us, start_log_events[0]); } TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStopped) { - 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_timestamp_us = rtc::TimeMicros(); + const int64_t start_utc_time_us = rtc::TimeUTCMicros(); // Overwrite the previously encoded LogStart event. - encoded_ = encoder_->EncodeLogStart(start_timestamp_ms * 1000, - start_utc_time_ms * 1000); + encoded_ = encoder_->EncodeLogStart(start_timestamp_us, start_utc_time_us); - const int64_t stop_timestamp_ms = - prng_.Rand(start_timestamp_ms, 2'000'000'000); - encoded_ += encoder_->EncodeLogEnd(stop_timestamp_ms * 1000); + const int64_t stop_timestamp_us = rtc::TimeMicros(); + encoded_ += encoder_->EncodeLogEnd(stop_timestamp_us); ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok()); const auto& stop_log_events = parsed_log_.stop_log_events(); ASSERT_EQ(stop_log_events.size(), 1u); - verifier_.VerifyLoggedStopEvent(stop_timestamp_ms * 1000, stop_log_events[0]); + verifier_.VerifyLoggedStopEvent(stop_timestamp_us, stop_log_events[0]); } // TODO(eladalon/terelius): Test with multiple events in the batch. @@ -856,9 +854,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpReceiverReport) { for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); - std::vector timestamps_ms(event_count_); + std::vector timestamps_us(event_count_); for (size_t i = 0; i < event_count_; ++i) { - timestamps_ms[i] = rtc::TimeMillis(); + timestamps_us[i] = rtc::TimeMicros(); events[i] = gen_.NewReceiverReport(); rtc::Buffer buffer = events[i].Build(); if (direction == kIncomingPacket) { @@ -878,7 +876,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpReceiverReport) { ASSERT_EQ(receiver_reports.size(), event_count_); for (size_t i = 0; i < event_count_; ++i) { - verifier_.VerifyLoggedReceiverReport(timestamps_ms[i], events[i], + verifier_.VerifyLoggedReceiverReport(timestamps_us[i], events[i], receiver_reports[i]); } } @@ -894,9 +892,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpSenderReport) { for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); - std::vector timestamps_ms(event_count_); + std::vector timestamps_us(event_count_); for (size_t i = 0; i < event_count_; ++i) { - timestamps_ms[i] = rtc::TimeMillis(); + timestamps_us[i] = rtc::TimeMicros(); events[i] = gen_.NewSenderReport(); rtc::Buffer buffer = events[i].Build(); if (direction == kIncomingPacket) { @@ -916,7 +914,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpSenderReport) { ASSERT_EQ(sender_reports.size(), event_count_); for (size_t i = 0; i < event_count_; ++i) { - verifier_.VerifyLoggedSenderReport(timestamps_ms[i], events[i], + verifier_.VerifyLoggedSenderReport(timestamps_us[i], events[i], sender_reports[i]); } } @@ -932,9 +930,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpExtendedReports) { for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); - std::vector timestamps_ms(event_count_); + std::vector timestamps_us(event_count_); for (size_t i = 0; i < event_count_; ++i) { - timestamps_ms[i] = rtc::TimeMillis(); + timestamps_us[i] = rtc::TimeMicros(); events[i] = gen_.NewExtendedReports(); rtc::Buffer buffer = events[i].Build(); if (direction == kIncomingPacket) { @@ -954,7 +952,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpExtendedReports) { ASSERT_EQ(extended_reports.size(), event_count_); for (size_t i = 0; i < event_count_; ++i) { - verifier_.VerifyLoggedExtendedReports(timestamps_ms[i], events[i], + verifier_.VerifyLoggedExtendedReports(timestamps_us[i], events[i], extended_reports[i]); } } @@ -970,9 +968,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpFir) { for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); - std::vector timestamps_ms(event_count_); + std::vector timestamps_us(event_count_); for (size_t i = 0; i < event_count_; ++i) { - timestamps_ms[i] = rtc::TimeMillis(); + timestamps_us[i] = rtc::TimeMicros(); events[i] = gen_.NewFir(); rtc::Buffer buffer = events[i].Build(); if (direction == kIncomingPacket) { @@ -992,7 +990,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpFir) { ASSERT_EQ(firs.size(), event_count_); for (size_t i = 0; i < event_count_; ++i) { - verifier_.VerifyLoggedFir(timestamps_ms[i], events[i], firs[i]); + verifier_.VerifyLoggedFir(timestamps_us[i], events[i], firs[i]); } } } @@ -1007,9 +1005,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPli) { for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); - std::vector timestamps_ms(event_count_); + std::vector timestamps_us(event_count_); for (size_t i = 0; i < event_count_; ++i) { - timestamps_ms[i] = rtc::TimeMillis(); + timestamps_us[i] = rtc::TimeMicros(); events[i] = gen_.NewPli(); rtc::Buffer buffer = events[i].Build(); if (direction == kIncomingPacket) { @@ -1029,7 +1027,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPli) { ASSERT_EQ(plis.size(), event_count_); for (size_t i = 0; i < event_count_; ++i) { - verifier_.VerifyLoggedPli(timestamps_ms[i], events[i], plis[i]); + verifier_.VerifyLoggedPli(timestamps_us[i], events[i], plis[i]); } } } @@ -1044,9 +1042,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpBye) { for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); - std::vector timestamps_ms(event_count_); + std::vector timestamps_us(event_count_); for (size_t i = 0; i < event_count_; ++i) { - timestamps_ms[i] = rtc::TimeMillis(); + timestamps_us[i] = rtc::TimeMicros(); events[i] = gen_.NewBye(); rtc::Buffer buffer = events[i].Build(); if (direction == kIncomingPacket) { @@ -1066,7 +1064,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpBye) { ASSERT_EQ(byes.size(), event_count_); for (size_t i = 0; i < event_count_; ++i) { - verifier_.VerifyLoggedBye(timestamps_ms[i], events[i], byes[i]); + verifier_.VerifyLoggedBye(timestamps_us[i], events[i], byes[i]); } } } @@ -1081,9 +1079,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpNack) { for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); - std::vector timestamps_ms(event_count_); + std::vector timestamps_us(event_count_); for (size_t i = 0; i < event_count_; ++i) { - timestamps_ms[i] = rtc::TimeMillis(); + timestamps_us[i] = rtc::TimeMicros(); events[i] = gen_.NewNack(); rtc::Buffer buffer = events[i].Build(); if (direction == kIncomingPacket) { @@ -1103,7 +1101,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpNack) { ASSERT_EQ(nacks.size(), event_count_); for (size_t i = 0; i < event_count_; ++i) { - verifier_.VerifyLoggedNack(timestamps_ms[i], events[i], nacks[i]); + verifier_.VerifyLoggedNack(timestamps_us[i], events[i], nacks[i]); } } } @@ -1118,9 +1116,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpRemb) { for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); - std::vector timestamps_ms(event_count_); + std::vector timestamps_us(event_count_); for (size_t i = 0; i < event_count_; ++i) { - timestamps_ms[i] = rtc::TimeMillis(); + timestamps_us[i] = rtc::TimeMicros(); events[i] = gen_.NewRemb(); rtc::Buffer buffer = events[i].Build(); if (direction == kIncomingPacket) { @@ -1140,7 +1138,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpRemb) { ASSERT_EQ(rembs.size(), event_count_); for (size_t i = 0; i < event_count_; ++i) { - verifier_.VerifyLoggedRemb(timestamps_ms[i], events[i], rembs[i]); + verifier_.VerifyLoggedRemb(timestamps_us[i], events[i], rembs[i]); } } } @@ -1156,9 +1154,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpTransportFeedback) { for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events; events.reserve(event_count_); - std::vector timestamps_ms(event_count_); + std::vector timestamps_us(event_count_); for (size_t i = 0; i < event_count_; ++i) { - timestamps_ms[i] = rtc::TimeMillis(); + timestamps_us[i] = rtc::TimeMicros(); events.emplace_back(gen_.NewTransportFeedback()); rtc::Buffer buffer = events[i].Build(); if (direction == kIncomingPacket) { @@ -1179,7 +1177,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpTransportFeedback) { ASSERT_EQ(transport_feedbacks.size(), event_count_); for (size_t i = 0; i < event_count_; ++i) { - verifier_.VerifyLoggedTransportFeedback(timestamps_ms[i], events[i], + verifier_.VerifyLoggedTransportFeedback(timestamps_us[i], events[i], transport_feedbacks[i]); } } @@ -1196,9 +1194,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpLossNotification) { for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events; events.reserve(event_count_); - std::vector timestamps_ms(event_count_); + std::vector timestamps_us(event_count_); for (size_t i = 0; i < event_count_; ++i) { - timestamps_ms[i] = rtc::TimeMillis(); + timestamps_us[i] = rtc::TimeMicros(); events.emplace_back(gen_.NewLossNotification()); rtc::Buffer buffer = events[i].Build(); if (direction == kIncomingPacket) { @@ -1218,7 +1216,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpLossNotification) { ASSERT_EQ(loss_notifications.size(), event_count_); for (size_t i = 0; i < event_count_; ++i) { - verifier_.VerifyLoggedLossNotification(timestamps_ms[i], events[i], + verifier_.VerifyLoggedLossNotification(timestamps_us[i], events[i], loss_notifications[i]); } } 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 74d66015ef..3ad0f005fb 100644 --- a/logging/rtc_event_log/events/rtc_event_alr_state.h +++ b/logging/rtc_event_log/events/rtc_event_alr_state.h @@ -14,7 +14,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -40,13 +39,13 @@ class RtcEventAlrState final : public RtcEvent { struct LoggedAlrStateEvent { LoggedAlrStateEvent() = default; - LoggedAlrStateEvent(Timestamp timestamp, bool in_alr) - : timestamp(timestamp), in_alr(in_alr) {} + LoggedAlrStateEvent(int64_t timestamp_us, bool in_alr) + : timestamp_us(timestamp_us), in_alr(in_alr) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; bool in_alr; }; 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 aeeb28e218..2b183bb307 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 @@ -14,7 +14,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" #include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h" namespace webrtc { @@ -44,14 +43,14 @@ class RtcEventAudioNetworkAdaptation final : public RtcEvent { struct LoggedAudioNetworkAdaptationEvent { LoggedAudioNetworkAdaptationEvent() = default; - LoggedAudioNetworkAdaptationEvent(Timestamp timestamp, + LoggedAudioNetworkAdaptationEvent(int64_t timestamp_us, const AudioEncoderRuntimeConfig& config) - : timestamp(timestamp), config(config) {} + : timestamp_us(timestamp_us), config(config) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; AudioEncoderRuntimeConfig config; }; 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 00d07a65bf..83825217a1 100644 --- a/logging/rtc_event_log/events/rtc_event_audio_playout.h +++ b/logging/rtc_event_log/events/rtc_event_audio_playout.h @@ -16,7 +16,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -42,13 +41,13 @@ class RtcEventAudioPlayout final : public RtcEvent { struct LoggedAudioPlayoutEvent { LoggedAudioPlayoutEvent() = default; - LoggedAudioPlayoutEvent(Timestamp timestamp, uint32_t ssrc) - : timestamp(timestamp), ssrc(ssrc) {} + LoggedAudioPlayoutEvent(int64_t timestamp_us, uint32_t ssrc) + : timestamp_us(timestamp_us), ssrc(ssrc) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; uint32_t ssrc; }; 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 ccf76025e6..1edd8e1e46 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 @@ -14,7 +14,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" #include "logging/rtc_event_log/rtc_stream_config.h" namespace webrtc { @@ -43,13 +42,13 @@ class RtcEventAudioReceiveStreamConfig final : public RtcEvent { struct LoggedAudioRecvConfig { LoggedAudioRecvConfig() = default; - LoggedAudioRecvConfig(Timestamp timestamp, const rtclog::StreamConfig config) - : timestamp(timestamp), config(config) {} + LoggedAudioRecvConfig(int64_t timestamp_us, const rtclog::StreamConfig config) + : timestamp_us(timestamp_us), config(config) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtclog::StreamConfig config; }; 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 4e93871ae8..d3c60683b4 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 @@ -41,13 +41,13 @@ class RtcEventAudioSendStreamConfig final : public RtcEvent { struct LoggedAudioSendConfig { LoggedAudioSendConfig() = default; - LoggedAudioSendConfig(Timestamp timestamp, const rtclog::StreamConfig config) - : timestamp(timestamp), config(config) {} + LoggedAudioSendConfig(int64_t timestamp_us, const rtclog::StreamConfig config) + : timestamp_us(timestamp_us), config(config) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtclog::StreamConfig config; }; } // 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 522f98fd8d..a83ea8b693 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 @@ -17,7 +17,6 @@ #include "api/network_state_predictor.h" #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -46,17 +45,17 @@ class RtcEventBweUpdateDelayBased final : public RtcEvent { struct LoggedBweDelayBasedUpdate { LoggedBweDelayBasedUpdate() = default; - LoggedBweDelayBasedUpdate(Timestamp timestamp, + LoggedBweDelayBasedUpdate(int64_t timestamp_us, int32_t bitrate_bps, BandwidthUsage detector_state) - : timestamp(timestamp), + : timestamp_us(timestamp_us), bitrate_bps(bitrate_bps), detector_state(detector_state) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; int32_t bitrate_bps; BandwidthUsage detector_state; }; 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 b031658ea2..b638f1ac16 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 @@ -16,7 +16,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -48,19 +47,19 @@ class RtcEventBweUpdateLossBased final : public RtcEvent { struct LoggedBweLossBasedUpdate { LoggedBweLossBasedUpdate() = default; - LoggedBweLossBasedUpdate(Timestamp timestamp, + LoggedBweLossBasedUpdate(int64_t timestamp_us, int32_t bitrate_bps, uint8_t fraction_lost, int32_t expected_packets) - : timestamp(timestamp), + : timestamp_us(timestamp_us), bitrate_bps(bitrate_bps), fraction_lost(fraction_lost), expected_packets(expected_packets) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; int32_t bitrate_bps; uint8_t fraction_lost; int32_t expected_packets; diff --git a/logging/rtc_event_log/events/rtc_event_dtls_transport_state.h b/logging/rtc_event_log/events/rtc_event_dtls_transport_state.h index 9a3eecb3d3..af35a3f3bc 100644 --- a/logging/rtc_event_log/events/rtc_event_dtls_transport_state.h +++ b/logging/rtc_event_log/events/rtc_event_dtls_transport_state.h @@ -15,7 +15,6 @@ #include "api/dtls_transport_interface.h" #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -42,10 +41,10 @@ class RtcEventDtlsTransportState : public RtcEvent { }; struct LoggedDtlsTransportState { - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; DtlsTransportState dtls_transport_state; }; diff --git a/logging/rtc_event_log/events/rtc_event_dtls_writable_state.h b/logging/rtc_event_log/events/rtc_event_dtls_writable_state.h index c0cc5b87ef..c3ecce00ef 100644 --- a/logging/rtc_event_log/events/rtc_event_dtls_writable_state.h +++ b/logging/rtc_event_log/events/rtc_event_dtls_writable_state.h @@ -14,7 +14,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -42,10 +41,10 @@ struct LoggedDtlsWritableState { LoggedDtlsWritableState() = default; explicit LoggedDtlsWritableState(bool writable) : writable(writable) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; bool writable; }; diff --git a/logging/rtc_event_log/events/rtc_event_frame_decoded.h b/logging/rtc_event_log/events/rtc_event_frame_decoded.h index 4a6bb90d02..c549aa8831 100644 --- a/logging/rtc_event_log/events/rtc_event_frame_decoded.h +++ b/logging/rtc_event_log/events/rtc_event_frame_decoded.h @@ -16,7 +16,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" #include "api/video/video_codec_type.h" namespace webrtc { @@ -57,10 +56,10 @@ class RtcEventFrameDecoded final : public RtcEvent { }; struct LoggedFrameDecoded { - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; int64_t render_time_ms; uint32_t ssrc; int width; diff --git a/logging/rtc_event_log/events/rtc_event_generic_ack_received.h b/logging/rtc_event_log/events/rtc_event_generic_ack_received.h index 75fc83c8b8..76e3cc24c4 100644 --- a/logging/rtc_event_log/events/rtc_event_generic_ack_received.h +++ b/logging/rtc_event_log/events/rtc_event_generic_ack_received.h @@ -16,7 +16,6 @@ #include "absl/types/optional.h" #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -78,19 +77,19 @@ class RtcEventGenericAckReceived final : public RtcEvent { struct LoggedGenericAckReceived { LoggedGenericAckReceived() = default; - LoggedGenericAckReceived(Timestamp timestamp, + LoggedGenericAckReceived(int64_t timestamp_us, int64_t packet_number, int64_t acked_packet_number, absl::optional receive_acked_packet_time_ms) - : timestamp(timestamp), + : timestamp_us(timestamp_us), packet_number(packet_number), acked_packet_number(acked_packet_number), receive_acked_packet_time_ms(receive_acked_packet_time_ms) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; int64_t packet_number; int64_t acked_packet_number; absl::optional receive_acked_packet_time_ms; diff --git a/logging/rtc_event_log/events/rtc_event_generic_packet_received.h b/logging/rtc_event_log/events/rtc_event_generic_packet_received.h index 428e7b3806..45e5e4cc44 100644 --- a/logging/rtc_event_log/events/rtc_event_generic_packet_received.h +++ b/logging/rtc_event_log/events/rtc_event_generic_packet_received.h @@ -14,7 +14,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -46,17 +45,17 @@ class RtcEventGenericPacketReceived final : public RtcEvent { struct LoggedGenericPacketReceived { LoggedGenericPacketReceived() = default; - LoggedGenericPacketReceived(Timestamp timestamp, + LoggedGenericPacketReceived(int64_t timestamp_us, int64_t packet_number, int packet_length) - : timestamp(timestamp), + : timestamp_us(timestamp_us), packet_number(packet_number), packet_length(packet_length) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; int64_t packet_number; int packet_length; }; diff --git a/logging/rtc_event_log/events/rtc_event_generic_packet_sent.h b/logging/rtc_event_log/events/rtc_event_generic_packet_sent.h index 6e626e63a1..9ebafbe2ec 100644 --- a/logging/rtc_event_log/events/rtc_event_generic_packet_sent.h +++ b/logging/rtc_event_log/events/rtc_event_generic_packet_sent.h @@ -14,7 +14,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -63,24 +62,24 @@ class RtcEventGenericPacketSent final : public RtcEvent { struct LoggedGenericPacketSent { LoggedGenericPacketSent() = default; - LoggedGenericPacketSent(Timestamp timestamp, + LoggedGenericPacketSent(int64_t timestamp_us, int64_t packet_number, size_t overhead_length, size_t payload_length, size_t padding_length) - : timestamp(timestamp), + : timestamp_us(timestamp_us), packet_number(packet_number), overhead_length(overhead_length), payload_length(payload_length), padding_length(padding_length) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } size_t packet_length() const { return payload_length + padding_length + overhead_length; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; int64_t packet_number; size_t overhead_length; size_t payload_length; 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 1f4d825a99..717ddf360d 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 @@ -16,7 +16,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -57,19 +56,19 @@ class RtcEventIceCandidatePair final : public RtcEvent { struct LoggedIceCandidatePairEvent { LoggedIceCandidatePairEvent() = default; - LoggedIceCandidatePairEvent(Timestamp timestamp, + LoggedIceCandidatePairEvent(int64_t timestamp_us, IceCandidatePairEventType type, uint32_t candidate_pair_id, uint32_t transaction_id) - : timestamp(timestamp), + : timestamp_us(timestamp_us), type(type), candidate_pair_id(candidate_pair_id), transaction_id(transaction_id) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; IceCandidatePairEventType type; uint32_t candidate_pair_id; uint32_t transaction_id; 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 465a799780..ab2eaf2422 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 @@ -16,7 +16,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -114,10 +113,10 @@ class RtcEventIceCandidatePairConfig final : public RtcEvent { }; struct LoggedIceCandidatePairConfig { - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; IceCandidatePairConfigType type; uint32_t candidate_pair_id; IceCandidateType local_candidate_type; 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 974a0c9a5c..f3221b91fd 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 @@ -16,7 +16,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -51,21 +50,21 @@ class RtcEventProbeClusterCreated final : public RtcEvent { struct LoggedBweProbeClusterCreatedEvent { LoggedBweProbeClusterCreatedEvent() = default; - LoggedBweProbeClusterCreatedEvent(Timestamp timestamp, + LoggedBweProbeClusterCreatedEvent(int64_t timestamp_us, int32_t id, int32_t bitrate_bps, uint32_t min_packets, uint32_t min_bytes) - : timestamp(timestamp), + : timestamp_us(timestamp_us), id(id), bitrate_bps(bitrate_bps), min_packets(min_packets), min_bytes(min_bytes) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; int32_t id; int32_t bitrate_bps; uint32_t min_packets; 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 fa61b314b4..868c30b61c 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 @@ -16,7 +16,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -51,15 +50,15 @@ class RtcEventProbeResultFailure final : public RtcEvent { struct LoggedBweProbeFailureEvent { LoggedBweProbeFailureEvent() = default; - LoggedBweProbeFailureEvent(Timestamp timestamp, + LoggedBweProbeFailureEvent(int64_t timestamp_us, int32_t id, ProbeFailureReason failure_reason) - : timestamp(timestamp), id(id), failure_reason(failure_reason) {} + : timestamp_us(timestamp_us), id(id), failure_reason(failure_reason) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; int32_t id; ProbeFailureReason failure_reason; }; 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 d00cfa81d6..e3746681f6 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 @@ -16,7 +16,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -44,15 +43,15 @@ class RtcEventProbeResultSuccess final : public RtcEvent { struct LoggedBweProbeSuccessEvent { LoggedBweProbeSuccessEvent() = default; - LoggedBweProbeSuccessEvent(Timestamp timestamp, + LoggedBweProbeSuccessEvent(int64_t timestamp_us, int32_t id, int32_t bitrate_bps) - : timestamp(timestamp), id(id), bitrate_bps(bitrate_bps) {} + : timestamp_us(timestamp_us), id(id), bitrate_bps(bitrate_bps) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; int32_t id; int32_t bitrate_bps; }; diff --git a/logging/rtc_event_log/events/rtc_event_remote_estimate.h b/logging/rtc_event_log/events/rtc_event_remote_estimate.h index 956e05f682..29b0c47195 100644 --- a/logging/rtc_event_log/events/rtc_event_remote_estimate.h +++ b/logging/rtc_event_log/events/rtc_event_remote_estimate.h @@ -15,7 +15,6 @@ #include "absl/types/optional.h" #include "api/rtc_event_log/rtc_event.h" #include "api/units/data_rate.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -38,10 +37,10 @@ class RtcEventRemoteEstimate final : public RtcEvent { struct LoggedRemoteEstimateEvent { LoggedRemoteEstimateEvent() = default; - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_ms * 1000; } + int64_t log_time_ms() const { return timestamp_ms; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_ms; absl::optional link_capacity_lower; absl::optional link_capacity_upper; }; diff --git a/logging/rtc_event_log/events/rtc_event_route_change.h b/logging/rtc_event_log/events/rtc_event_route_change.h index 4a4e9aef80..455a832141 100644 --- a/logging/rtc_event_log/events/rtc_event_route_change.h +++ b/logging/rtc_event_log/events/rtc_event_route_change.h @@ -14,7 +14,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -42,13 +41,15 @@ class RtcEventRouteChange final : public RtcEvent { struct LoggedRouteChangeEvent { LoggedRouteChangeEvent() = default; - LoggedRouteChangeEvent(Timestamp timestamp, bool connected, uint32_t overhead) - : timestamp(timestamp), connected(connected), overhead(overhead) {} + LoggedRouteChangeEvent(int64_t timestamp_ms, + bool connected, + uint32_t overhead) + : timestamp_ms(timestamp_ms), connected(connected), overhead(overhead) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_ms * 1000; } + int64_t log_time_ms() const { return timestamp_ms; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_ms; bool connected; uint32_t overhead; }; 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 e7b9061872..2bf52476a1 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 @@ -14,7 +14,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" #include "logging/rtc_event_log/rtc_stream_config.h" namespace webrtc { @@ -43,13 +42,13 @@ class RtcEventVideoReceiveStreamConfig final : public RtcEvent { struct LoggedVideoRecvConfig { LoggedVideoRecvConfig() = default; - LoggedVideoRecvConfig(Timestamp timestamp, const rtclog::StreamConfig config) - : timestamp(timestamp), config(config) {} + LoggedVideoRecvConfig(int64_t timestamp_us, const rtclog::StreamConfig config) + : timestamp_us(timestamp_us), config(config) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtclog::StreamConfig config; }; 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 e72e75e49d..cf95afc4d8 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 @@ -14,7 +14,6 @@ #include #include "api/rtc_event_log/rtc_event.h" -#include "api/units/timestamp.h" #include "logging/rtc_event_log/rtc_stream_config.h" namespace webrtc { @@ -42,13 +41,13 @@ class RtcEventVideoSendStreamConfig final : public RtcEvent { struct LoggedVideoSendConfig { LoggedVideoSendConfig() = default; - LoggedVideoSendConfig(Timestamp timestamp, const rtclog::StreamConfig config) - : timestamp(timestamp), config(config) {} + LoggedVideoSendConfig(int64_t timestamp_us, const rtclog::StreamConfig config) + : timestamp_us(timestamp_us), config(config) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtclog::StreamConfig config; }; } // namespace webrtc diff --git a/logging/rtc_event_log/logged_events.cc b/logging/rtc_event_log/logged_events.cc index 5ef3de11c0..dd0a8aae2a 100644 --- a/logging/rtc_event_log/logged_events.cc +++ b/logging/rtc_event_log/logged_events.cc @@ -40,13 +40,13 @@ LoggedPacketInfo::LoggedPacketInfo(const LoggedPacketInfo&) = default; LoggedPacketInfo::~LoggedPacketInfo() {} -LoggedRtcpPacket::LoggedRtcpPacket(Timestamp timestamp, +LoggedRtcpPacket::LoggedRtcpPacket(int64_t timestamp_us, const std::vector& packet) - : timestamp(timestamp), raw_data(packet) {} + : timestamp_us(timestamp_us), raw_data(packet) {} -LoggedRtcpPacket::LoggedRtcpPacket(Timestamp timestamp, +LoggedRtcpPacket::LoggedRtcpPacket(int64_t timestamp_us, const std::string& packet) - : timestamp(timestamp), raw_data(packet.size()) { + : timestamp_us(timestamp_us), raw_data(packet.size()) { memcpy(raw_data.data(), packet.data(), packet.size()); } diff --git a/logging/rtc_event_log/logged_events.h b/logging/rtc_event_log/logged_events.h index 5bce658c30..3824494134 100644 --- a/logging/rtc_event_log/logged_events.h +++ b/logging/rtc_event_log/logged_events.h @@ -37,19 +37,19 @@ namespace webrtc { // adding a vptr. struct LoggedRtpPacket { - LoggedRtpPacket(Timestamp timestamp, + LoggedRtpPacket(int64_t timestamp_us, RTPHeader header, size_t header_length, size_t total_length) - : timestamp(timestamp), + : timestamp_us(timestamp_us), header(header), header_length(header_length), total_length(total_length) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp; + int64_t timestamp_us; // TODO(terelius): This allocates space for 15 CSRCs even if none are used. RTPHeader header; size_t header_length; @@ -57,145 +57,145 @@ struct LoggedRtpPacket { }; struct LoggedRtpPacketIncoming { - LoggedRtpPacketIncoming(Timestamp timestamp, + LoggedRtpPacketIncoming(int64_t timestamp_us, RTPHeader header, size_t header_length, size_t total_length) - : rtp(timestamp, header, header_length, total_length) {} - int64_t log_time_us() const { return rtp.timestamp.us(); } - int64_t log_time_ms() const { return rtp.timestamp.ms(); } + : rtp(timestamp_us, header, header_length, total_length) {} + int64_t log_time_us() const { return rtp.timestamp_us; } + int64_t log_time_ms() const { return rtp.timestamp_us / 1000; } LoggedRtpPacket rtp; }; struct LoggedRtpPacketOutgoing { - LoggedRtpPacketOutgoing(Timestamp timestamp, + LoggedRtpPacketOutgoing(int64_t timestamp_us, RTPHeader header, size_t header_length, size_t total_length) - : rtp(timestamp, header, header_length, total_length) {} - int64_t log_time_us() const { return rtp.timestamp.us(); } - int64_t log_time_ms() const { return rtp.timestamp.ms(); } + : rtp(timestamp_us, header, header_length, total_length) {} + int64_t log_time_us() const { return rtp.timestamp_us; } + int64_t log_time_ms() const { return rtp.timestamp_us / 1000; } LoggedRtpPacket rtp; }; struct LoggedRtcpPacket { - LoggedRtcpPacket(Timestamp timestamp, const std::vector& packet); - LoggedRtcpPacket(Timestamp timestamp, const std::string& packet); + LoggedRtcpPacket(int64_t timestamp_us, const std::vector& packet); + LoggedRtcpPacket(int64_t timestamp_us, const std::string& packet); LoggedRtcpPacket(const LoggedRtcpPacket&); ~LoggedRtcpPacket(); - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp; + int64_t timestamp_us; std::vector raw_data; }; struct LoggedRtcpPacketIncoming { - LoggedRtcpPacketIncoming(Timestamp timestamp, + LoggedRtcpPacketIncoming(int64_t timestamp_us, const std::vector& packet) - : rtcp(timestamp, packet) {} - LoggedRtcpPacketIncoming(Timestamp timestamp, const std::string& packet) - : rtcp(timestamp, packet) {} + : rtcp(timestamp_us, packet) {} + LoggedRtcpPacketIncoming(uint64_t timestamp_us, const std::string& packet) + : rtcp(timestamp_us, packet) {} - int64_t log_time_us() const { return rtcp.timestamp.us(); } - int64_t log_time_ms() const { return rtcp.timestamp.ms(); } + int64_t log_time_us() const { return rtcp.timestamp_us; } + int64_t log_time_ms() const { return rtcp.timestamp_us / 1000; } LoggedRtcpPacket rtcp; }; struct LoggedRtcpPacketOutgoing { - LoggedRtcpPacketOutgoing(Timestamp timestamp, + LoggedRtcpPacketOutgoing(int64_t timestamp_us, const std::vector& packet) - : rtcp(timestamp, packet) {} - LoggedRtcpPacketOutgoing(Timestamp timestamp, const std::string& packet) - : rtcp(timestamp, packet) {} + : rtcp(timestamp_us, packet) {} + LoggedRtcpPacketOutgoing(uint64_t timestamp_us, const std::string& packet) + : rtcp(timestamp_us, packet) {} - int64_t log_time_us() const { return rtcp.timestamp.us(); } - int64_t log_time_ms() const { return rtcp.timestamp.ms(); } + int64_t log_time_us() const { return rtcp.timestamp_us; } + int64_t log_time_ms() const { return rtcp.timestamp_us / 1000; } LoggedRtcpPacket rtcp; }; struct LoggedRtcpPacketReceiverReport { LoggedRtcpPacketReceiverReport() = default; - LoggedRtcpPacketReceiverReport(Timestamp timestamp, + LoggedRtcpPacketReceiverReport(int64_t timestamp_us, const rtcp::ReceiverReport& rr) - : timestamp(timestamp), rr(rr) {} + : timestamp_us(timestamp_us), rr(rr) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtcp::ReceiverReport rr; }; struct LoggedRtcpPacketSenderReport { LoggedRtcpPacketSenderReport() = default; - LoggedRtcpPacketSenderReport(Timestamp timestamp, + LoggedRtcpPacketSenderReport(int64_t timestamp_us, const rtcp::SenderReport& sr) - : timestamp(timestamp), sr(sr) {} + : timestamp_us(timestamp_us), sr(sr) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtcp::SenderReport sr; }; struct LoggedRtcpPacketExtendedReports { LoggedRtcpPacketExtendedReports() = default; - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtcp::ExtendedReports xr; }; struct LoggedRtcpPacketRemb { LoggedRtcpPacketRemb() = default; - LoggedRtcpPacketRemb(Timestamp timestamp, const rtcp::Remb& remb) - : timestamp(timestamp), remb(remb) {} + LoggedRtcpPacketRemb(int64_t timestamp_us, const rtcp::Remb& remb) + : timestamp_us(timestamp_us), remb(remb) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtcp::Remb remb; }; struct LoggedRtcpPacketNack { LoggedRtcpPacketNack() = default; - LoggedRtcpPacketNack(Timestamp timestamp, const rtcp::Nack& nack) - : timestamp(timestamp), nack(nack) {} + LoggedRtcpPacketNack(int64_t timestamp_us, const rtcp::Nack& nack) + : timestamp_us(timestamp_us), nack(nack) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtcp::Nack nack; }; struct LoggedRtcpPacketFir { LoggedRtcpPacketFir() = default; - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtcp::Fir fir; }; struct LoggedRtcpPacketPli { LoggedRtcpPacketPli() = default; - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtcp::Pli pli; }; @@ -204,64 +204,64 @@ struct LoggedRtcpPacketTransportFeedback { : transport_feedback(/*include_timestamps=*/true, /*include_lost*/ true) { } LoggedRtcpPacketTransportFeedback( - Timestamp timestamp, + int64_t timestamp_us, const rtcp::TransportFeedback& transport_feedback) - : timestamp(timestamp), transport_feedback(transport_feedback) {} + : timestamp_us(timestamp_us), transport_feedback(transport_feedback) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtcp::TransportFeedback transport_feedback; }; struct LoggedRtcpPacketLossNotification { LoggedRtcpPacketLossNotification() = default; LoggedRtcpPacketLossNotification( - Timestamp timestamp, + int64_t timestamp_us, const rtcp::LossNotification& loss_notification) - : timestamp(timestamp), loss_notification(loss_notification) {} + : timestamp_us(timestamp_us), loss_notification(loss_notification) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtcp::LossNotification loss_notification; }; struct LoggedRtcpPacketBye { LoggedRtcpPacketBye() = default; - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp = Timestamp::MinusInfinity(); + int64_t timestamp_us; rtcp::Bye bye; }; struct LoggedStartEvent { - explicit LoggedStartEvent(Timestamp timestamp) - : LoggedStartEvent(timestamp, timestamp) {} + explicit LoggedStartEvent(int64_t timestamp_us) + : LoggedStartEvent(timestamp_us, timestamp_us / 1000) {} - LoggedStartEvent(Timestamp timestamp, Timestamp utc_start_time) - : timestamp(timestamp), utc_start_time(utc_start_time) {} + LoggedStartEvent(int64_t timestamp_us, int64_t utc_start_time_ms) + : timestamp_us(timestamp_us), utc_start_time_ms(utc_start_time_ms) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp utc_time() const { return utc_start_time; } + Timestamp utc_time() const { return Timestamp::Millis(utc_start_time_ms); } - Timestamp timestamp; - Timestamp utc_start_time; + int64_t timestamp_us; + int64_t utc_start_time_ms; }; struct LoggedStopEvent { - explicit LoggedStopEvent(Timestamp timestamp) : timestamp(timestamp) {} + explicit LoggedStopEvent(int64_t timestamp_us) : timestamp_us(timestamp_us) {} - int64_t log_time_us() const { return timestamp.us(); } - int64_t log_time_ms() const { return timestamp.ms(); } + int64_t log_time_us() const { return timestamp_us; } + int64_t log_time_ms() const { return timestamp_us / 1000; } - Timestamp timestamp; + int64_t timestamp_us; }; struct InferredRouteChangeEvent { @@ -339,5 +339,8 @@ struct LoggedIceEvent { }; + + + } // namespace webrtc #endif // LOGGING_RTC_EVENT_LOG_LOGGED_EVENTS_H_ diff --git a/logging/rtc_event_log/rtc_event_log_impl.cc b/logging/rtc_event_log/rtc_event_log_impl.cc index 700f639311..4a272f08cf 100644 --- a/logging/rtc_event_log/rtc_event_log_impl.cc +++ b/logging/rtc_event_log/rtc_event_log_impl.cc @@ -90,8 +90,8 @@ bool RtcEventLogImpl::StartLogging(std::unique_ptr output, return false; } - const int64_t timestamp_us = rtc::TimeMillis() * 1000; - const int64_t utc_time_us = rtc::TimeUTCMillis() * 1000; + const int64_t timestamp_us = rtc::TimeMicros(); + const int64_t utc_time_us = rtc::TimeUTCMicros(); RTC_LOG(LS_INFO) << "Starting WebRTC event log. (Timestamp, UTC) = " "(" << timestamp_us << ", " << utc_time_us << ")."; @@ -253,7 +253,7 @@ void RtcEventLogImpl::StopOutput() { void RtcEventLogImpl::StopLoggingInternal() { if (event_output_) { RTC_DCHECK(event_output_->IsActive()); - const int64_t timestamp_us = rtc::TimeMillis() * 1000; + const int64_t timestamp_us = rtc::TimeMicros(); event_output_->Write(event_encoder_->EncodeLogEnd(timestamp_us)); } StopOutput(); diff --git a/logging/rtc_event_log/rtc_event_log_parser.cc b/logging/rtc_event_log/rtc_event_log_parser.cc index d10e4f987a..6cdaa75bb7 100644 --- a/logging/rtc_event_log/rtc_event_log_parser.cc +++ b/logging/rtc_event_log/rtc_event_log_parser.cc @@ -390,7 +390,7 @@ ParsedRtcEventLog::ParseStatus StoreRtpPackets( RTC_PARSE_CHECK_OR_RETURN(!proto.has_voice_activity()); } (*rtp_packets_map)[header.ssrc].emplace_back( - Timestamp::Millis(proto.timestamp_ms()), header, proto.header_size(), + proto.timestamp_ms() * 1000, header, proto.header_size(), proto.payload_size() + header.headerLength + header.paddingLength); } @@ -592,7 +592,7 @@ ParsedRtcEventLog::ParseStatus StoreRtpPackets( !voice_activity_values[i].has_value()); } (*rtp_packets_map)[header.ssrc].emplace_back( - Timestamp::Millis(timestamp_ms), header, header.headerLength, + 1000 * timestamp_ms, header, header.headerLength, payload_size_values[i].value() + header.headerLength + header.paddingLength); } @@ -615,8 +615,7 @@ ParsedRtcEventLog::ParseStatus StoreRtcpPackets( !IdenticalRtcpContents(rtcp_packets->back().rtcp.raw_data, proto.raw_packet())) { // Base event - rtcp_packets->emplace_back(Timestamp::Millis(proto.timestamp_ms()), - proto.raw_packet()); + rtcp_packets->emplace_back(proto.timestamp_ms() * 1000, proto.raw_packet()); } const size_t number_of_deltas = @@ -654,7 +653,7 @@ ParsedRtcEventLog::ParseStatus StoreRtcpPackets( continue; } std::string data(raw_packet_values[i]); - rtcp_packets->emplace_back(Timestamp::Millis(timestamp_ms), data); + rtcp_packets->emplace_back(1000 * timestamp_ms, data); } return ParsedRtcEventLog::ParseStatus::Success(); } @@ -673,7 +672,6 @@ ParsedRtcEventLog::ParseStatus StoreRtcpBlocks( std::vector* bye_list, std::vector* transport_feedback_list, std::vector* loss_notification_list) { - Timestamp timestamp = Timestamp::Micros(timestamp_us); rtcp::CommonHeader header; for (const uint8_t* block = packet_begin; block < packet_end; block = header.NextPacket()) { @@ -681,44 +679,44 @@ ParsedRtcEventLog::ParseStatus StoreRtcpBlocks( if (header.type() == rtcp::TransportFeedback::kPacketType && header.fmt() == rtcp::TransportFeedback::kFeedbackMessageType) { LoggedRtcpPacketTransportFeedback parsed_block; - parsed_block.timestamp = timestamp; + parsed_block.timestamp_us = timestamp_us; if (parsed_block.transport_feedback.Parse(header)) transport_feedback_list->push_back(std::move(parsed_block)); } else if (header.type() == rtcp::SenderReport::kPacketType) { LoggedRtcpPacketSenderReport parsed_block; - parsed_block.timestamp = timestamp; + parsed_block.timestamp_us = timestamp_us; if (parsed_block.sr.Parse(header)) { sr_list->push_back(std::move(parsed_block)); } } else if (header.type() == rtcp::ReceiverReport::kPacketType) { LoggedRtcpPacketReceiverReport parsed_block; - parsed_block.timestamp = timestamp; + parsed_block.timestamp_us = timestamp_us; if (parsed_block.rr.Parse(header)) { rr_list->push_back(std::move(parsed_block)); } } else if (header.type() == rtcp::ExtendedReports::kPacketType) { LoggedRtcpPacketExtendedReports parsed_block; - parsed_block.timestamp = timestamp; + parsed_block.timestamp_us = timestamp_us; if (parsed_block.xr.Parse(header)) { xr_list->push_back(std::move(parsed_block)); } } else if (header.type() == rtcp::Fir::kPacketType && header.fmt() == rtcp::Fir::kFeedbackMessageType) { LoggedRtcpPacketFir parsed_block; - parsed_block.timestamp = timestamp; + parsed_block.timestamp_us = timestamp_us; if (parsed_block.fir.Parse(header)) { fir_list->push_back(std::move(parsed_block)); } } else if (header.type() == rtcp::Pli::kPacketType && header.fmt() == rtcp::Pli::kFeedbackMessageType) { LoggedRtcpPacketPli parsed_block; - parsed_block.timestamp = timestamp; + parsed_block.timestamp_us = timestamp_us; if (parsed_block.pli.Parse(header)) { pli_list->push_back(std::move(parsed_block)); } } else if (header.type() == rtcp::Bye::kPacketType) { LoggedRtcpPacketBye parsed_block; - parsed_block.timestamp = timestamp; + parsed_block.timestamp_us = timestamp_us; if (parsed_block.bye.Parse(header)) { bye_list->push_back(std::move(parsed_block)); } @@ -727,7 +725,7 @@ ParsedRtcEventLog::ParseStatus StoreRtcpBlocks( bool type_found = false; if (!type_found) { LoggedRtcpPacketRemb parsed_block; - parsed_block.timestamp = timestamp; + parsed_block.timestamp_us = timestamp_us; if (parsed_block.remb.Parse(header)) { remb_list->push_back(std::move(parsed_block)); type_found = true; @@ -735,7 +733,7 @@ ParsedRtcEventLog::ParseStatus StoreRtcpBlocks( } if (!type_found) { LoggedRtcpPacketLossNotification parsed_block; - parsed_block.timestamp = timestamp; + parsed_block.timestamp_us = timestamp_us; if (parsed_block.loss_notification.Parse(header)) { loss_notification_list->push_back(std::move(parsed_block)); type_found = true; @@ -744,7 +742,7 @@ ParsedRtcEventLog::ParseStatus StoreRtcpBlocks( } else if (header.type() == rtcp::Nack::kPacketType && header.fmt() == rtcp::Nack::kFeedbackMessageType) { LoggedRtcpPacketNack parsed_block; - parsed_block.timestamp = timestamp; + parsed_block.timestamp_us = timestamp_us; if (parsed_block.nack.Parse(header)) { nack_list->push_back(std::move(parsed_block)); } @@ -1172,7 +1170,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::ParseStream( // Set up convenience wrappers around the most commonly used RTCP types. for (const auto& incoming : incoming_rtcp_packets_) { - const int64_t timestamp_us = incoming.rtcp.timestamp.us(); + const int64_t timestamp_us = incoming.rtcp.timestamp_us; const uint8_t* packet_begin = incoming.rtcp.raw_data.data(); const uint8_t* packet_end = packet_begin + incoming.rtcp.raw_data.size(); auto status = StoreRtcpBlocks( @@ -1184,7 +1182,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::ParseStream( } for (const auto& outgoing : outgoing_rtcp_packets_) { - const int64_t timestamp_us = outgoing.rtcp.timestamp.us(); + const int64_t timestamp_us = outgoing.rtcp.timestamp_us; const uint8_t* packet_begin = outgoing.rtcp.raw_data.data(); const uint8_t* packet_end = packet_begin + outgoing.rtcp.raw_data.size(); auto status = StoreRtcpBlocks( @@ -1376,8 +1374,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreParsedLegacyEvent( RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); int64_t timestamp_us = event.timestamp_us(); - video_recv_configs_.emplace_back(Timestamp::Micros(timestamp_us), - config.value()); + video_recv_configs_.emplace_back(timestamp_us, config.value()); incoming_rtp_extensions_maps_[config.value().remote_ssrc] = RtpHeaderExtensionMap(config.value().rtp_extensions); incoming_rtp_extensions_maps_[config.value().rtx_ssrc] = @@ -1391,8 +1388,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreParsedLegacyEvent( RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); int64_t timestamp_us = event.timestamp_us(); - video_send_configs_.emplace_back(Timestamp::Micros(timestamp_us), - config.value()); + video_send_configs_.emplace_back(timestamp_us, config.value()); outgoing_rtp_extensions_maps_[config.value().local_ssrc] = RtpHeaderExtensionMap(config.value().rtp_extensions); outgoing_rtp_extensions_maps_[config.value().rtx_ssrc] = @@ -1406,8 +1402,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreParsedLegacyEvent( RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); int64_t timestamp_us = event.timestamp_us(); - audio_recv_configs_.emplace_back(Timestamp::Micros(timestamp_us), - config.value()); + audio_recv_configs_.emplace_back(timestamp_us, config.value()); incoming_rtp_extensions_maps_[config.value().remote_ssrc] = RtpHeaderExtensionMap(config.value().rtp_extensions); break; @@ -1418,8 +1413,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreParsedLegacyEvent( return config.status(); RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); int64_t timestamp_us = event.timestamp_us(); - audio_send_configs_.emplace_back(Timestamp::Micros(timestamp_us), - config.value()); + audio_send_configs_.emplace_back(timestamp_us, config.value()); outgoing_rtp_extensions_maps_[config.value().local_ssrc] = RtpHeaderExtensionMap(config.value().rtp_extensions); break; @@ -1452,13 +1446,11 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreParsedLegacyEvent( int64_t timestamp_us = event.timestamp_us(); if (direction == kIncomingPacket) { incoming_rtp_packets_map_[parsed_header.ssrc].push_back( - LoggedRtpPacketIncoming(Timestamp::Micros(timestamp_us), - parsed_header, header_length, + LoggedRtpPacketIncoming(timestamp_us, parsed_header, header_length, total_length)); } else { outgoing_rtp_packets_map_[parsed_header.ssrc].push_back( - LoggedRtpPacketOutgoing(Timestamp::Micros(timestamp_us), - parsed_header, header_length, + LoggedRtpPacketOutgoing(timestamp_us, parsed_header, header_length, total_length)); } break; @@ -1477,26 +1469,24 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreParsedLegacyEvent( if (packet == last_incoming_rtcp_packet_) break; incoming_rtcp_packets_.push_back( - LoggedRtcpPacketIncoming(Timestamp::Micros(timestamp_us), packet)); + LoggedRtcpPacketIncoming(timestamp_us, packet)); last_incoming_rtcp_packet_ = packet; } else { outgoing_rtcp_packets_.push_back( - LoggedRtcpPacketOutgoing(Timestamp::Micros(timestamp_us), packet)); + LoggedRtcpPacketOutgoing(timestamp_us, packet)); } break; } case rtclog::Event::LOG_START: { RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); int64_t timestamp_us = event.timestamp_us(); - start_log_events_.push_back( - LoggedStartEvent(Timestamp::Micros(timestamp_us))); + start_log_events_.push_back(LoggedStartEvent(timestamp_us)); break; } case rtclog::Event::LOG_END: { RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); int64_t timestamp_us = event.timestamp_us(); - stop_log_events_.push_back( - LoggedStopEvent(Timestamp::Micros(timestamp_us))); + stop_log_events_.push_back(LoggedStopEvent(timestamp_us)); break; } case rtclog::Event::AUDIO_PLAYOUT_EVENT: { @@ -1815,7 +1805,7 @@ ParsedRtcEventLog::GetAudioPlayout(const rtclog::Event& event) const { const rtclog::AudioPlayoutEvent& playout_event = event.audio_playout_event(); LoggedAudioPlayoutEvent res; RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); - res.timestamp = Timestamp::Micros(event.timestamp_us()); + res.timestamp_us = event.timestamp_us(); RTC_PARSE_CHECK_OR_RETURN(playout_event.has_local_ssrc()); res.ssrc = playout_event.local_ssrc(); return res; @@ -1831,7 +1821,7 @@ ParsedRtcEventLog::GetLossBasedBweUpdate(const rtclog::Event& event) const { LoggedBweLossBasedUpdate bwe_update; RTC_CHECK(event.has_timestamp_us()); - bwe_update.timestamp = Timestamp::Micros(event.timestamp_us()); + bwe_update.timestamp_us = event.timestamp_us(); RTC_PARSE_CHECK_OR_RETURN(loss_event.has_bitrate_bps()); bwe_update.bitrate_bps = loss_event.bitrate_bps(); RTC_PARSE_CHECK_OR_RETURN(loss_event.has_fraction_loss()); @@ -1852,7 +1842,7 @@ ParsedRtcEventLog::GetDelayBasedBweUpdate(const rtclog::Event& event) const { LoggedBweDelayBasedUpdate res; RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); - res.timestamp = Timestamp::Micros(event.timestamp_us()); + res.timestamp_us = event.timestamp_us(); RTC_PARSE_CHECK_OR_RETURN(delay_event.has_bitrate_bps()); res.bitrate_bps = delay_event.bitrate_bps(); RTC_PARSE_CHECK_OR_RETURN(delay_event.has_detector_state()); @@ -1871,7 +1861,7 @@ ParsedRtcEventLog::GetAudioNetworkAdaptation(const rtclog::Event& event) const { LoggedAudioNetworkAdaptationEvent res; RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); - res.timestamp = Timestamp::Micros(event.timestamp_us()); + res.timestamp_us = event.timestamp_us(); if (ana_event.has_bitrate_bps()) res.config.bitrate_bps = ana_event.bitrate_bps(); if (ana_event.has_enable_fec()) @@ -1897,7 +1887,7 @@ ParsedRtcEventLog::GetBweProbeClusterCreated(const rtclog::Event& event) const { const rtclog::BweProbeCluster& pcc_event = event.probe_cluster(); LoggedBweProbeClusterCreatedEvent res; RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); - res.timestamp = Timestamp::Micros(event.timestamp_us()); + res.timestamp_us = event.timestamp_us(); RTC_PARSE_CHECK_OR_RETURN(pcc_event.has_id()); res.id = pcc_event.id(); RTC_PARSE_CHECK_OR_RETURN(pcc_event.has_bitrate_bps()); @@ -1922,7 +1912,7 @@ ParsedRtcEventLog::GetBweProbeFailure(const rtclog::Event& event) const { LoggedBweProbeFailureEvent res; RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); - res.timestamp = Timestamp::Micros(event.timestamp_us()); + res.timestamp_us = event.timestamp_us(); RTC_PARSE_CHECK_OR_RETURN(pr_event.has_id()); res.id = pr_event.id(); RTC_PARSE_CHECK_OR_RETURN(pr_event.has_result()); @@ -1955,7 +1945,7 @@ ParsedRtcEventLog::GetBweProbeSuccess(const rtclog::Event& event) const { LoggedBweProbeSuccessEvent res; RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); - res.timestamp = Timestamp::Micros(event.timestamp_us()); + res.timestamp_us = event.timestamp_us(); RTC_PARSE_CHECK_OR_RETURN(pr_event.has_id()); res.id = pr_event.id(); RTC_PARSE_CHECK_OR_RETURN(pr_event.has_bitrate_bps()); @@ -1972,7 +1962,7 @@ ParsedRtcEventLog::GetAlrState(const rtclog::Event& event) const { const rtclog::AlrState& alr_event = event.alr_state(); LoggedAlrStateEvent res; RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); - res.timestamp = Timestamp::Micros(event.timestamp_us()); + res.timestamp_us = event.timestamp_us(); RTC_PARSE_CHECK_OR_RETURN(alr_event.has_in_alr()); res.in_alr = alr_event.in_alr(); @@ -1989,7 +1979,7 @@ ParsedRtcEventLog::GetIceCandidatePairConfig( const rtclog::IceCandidatePairConfig& config = rtc_event.ice_candidate_pair_config(); RTC_CHECK(rtc_event.has_timestamp_us()); - res.timestamp = Timestamp::Micros(rtc_event.timestamp_us()); + res.timestamp_us = rtc_event.timestamp_us(); RTC_PARSE_CHECK_OR_RETURN(config.has_config_type()); res.type = GetRuntimeIceCandidatePairConfigType(config.config_type()); RTC_PARSE_CHECK_OR_RETURN(config.has_candidate_pair_id()); @@ -2028,7 +2018,7 @@ ParsedRtcEventLog::GetIceCandidatePairEvent( const rtclog::IceCandidatePairEvent& event = rtc_event.ice_candidate_pair_event(); RTC_CHECK(rtc_event.has_timestamp_us()); - res.timestamp = Timestamp::Micros(rtc_event.timestamp_us()); + res.timestamp_us = rtc_event.timestamp_us(); RTC_PARSE_CHECK_OR_RETURN(event.has_event_type()); res.type = GetRuntimeIceCandidatePairEventType(event.event_type()); RTC_PARSE_CHECK_OR_RETURN(event.has_candidate_pair_id()); @@ -2414,7 +2404,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreAlrStateEvent( RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); RTC_PARSE_CHECK_OR_RETURN(proto.has_in_alr()); LoggedAlrStateEvent alr_event; - alr_event.timestamp = Timestamp::Millis(proto.timestamp_ms()); + alr_event.timestamp_us = proto.timestamp_ms() * 1000; alr_event.in_alr = proto.in_alr(); alr_state_events_.push_back(alr_event); @@ -2428,7 +2418,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreRouteChangeEvent( RTC_PARSE_CHECK_OR_RETURN(proto.has_connected()); RTC_PARSE_CHECK_OR_RETURN(proto.has_overhead()); LoggedRouteChangeEvent route_event; - route_event.timestamp = Timestamp::Millis(proto.timestamp_ms()); + route_event.timestamp_ms = proto.timestamp_ms(); route_event.connected = proto.connected(); route_event.overhead = proto.overhead(); @@ -2442,7 +2432,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreRemoteEstimateEvent( RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); // Base event LoggedRemoteEstimateEvent base_event; - base_event.timestamp = Timestamp::Millis(proto.timestamp_ms()); + base_event.timestamp_ms = proto.timestamp_ms(); absl::optional base_link_capacity_lower_kbps; if (proto.has_link_capacity_lower_kbps()) { @@ -2490,7 +2480,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreRemoteEstimateEvent( for (size_t i = 0; i < number_of_deltas; ++i) { LoggedRemoteEstimateEvent event; RTC_PARSE_CHECK_OR_RETURN(timestamp_ms_values[i].has_value()); - event.timestamp = Timestamp::Millis(*timestamp_ms_values[i]); + event.timestamp_ms = *timestamp_ms_values[i]; if (link_capacity_lower_kbps_values[i]) event.link_capacity_lower = DataRate::KilobitsPerSec(*link_capacity_lower_kbps_values[i]); @@ -2509,7 +2499,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreAudioPlayoutEvent( // Base event audio_playout_events_[proto.local_ssrc()].emplace_back( - Timestamp::Millis(proto.timestamp_ms()), proto.local_ssrc()); + 1000 * proto.timestamp_ms(), proto.local_ssrc()); const size_t number_of_deltas = proto.has_number_of_deltas() ? proto.number_of_deltas() : 0u; @@ -2541,8 +2531,8 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreAudioPlayoutEvent( const uint32_t local_ssrc = static_cast(local_ssrc_values[i].value()); - audio_playout_events_[local_ssrc].emplace_back( - Timestamp::Millis(timestamp_ms), local_ssrc); + audio_playout_events_[local_ssrc].emplace_back(1000 * timestamp_ms, + local_ssrc); } return ParseStatus::Success(); } @@ -2575,8 +2565,8 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreStartEvent( RTC_PARSE_CHECK_OR_RETURN(proto.has_version()); RTC_PARSE_CHECK_OR_RETURN(proto.has_utc_time_ms()); RTC_PARSE_CHECK_OR_RETURN_EQ(proto.version(), 2); - LoggedStartEvent start_event(Timestamp::Millis(proto.timestamp_ms()), - Timestamp::Millis(proto.utc_time_ms())); + LoggedStartEvent start_event(proto.timestamp_ms() * 1000, + proto.utc_time_ms()); start_log_events_.push_back(start_event); return ParseStatus::Success(); @@ -2585,7 +2575,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreStartEvent( ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreStopEvent( const rtclog2::EndLogEvent& proto) { RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - LoggedStopEvent stop_event(Timestamp::Millis(proto.timestamp_ms())); + LoggedStopEvent stop_event(proto.timestamp_ms() * 1000); stop_log_events_.push_back(stop_event); return ParseStatus::Success(); @@ -2599,7 +2589,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweLossBasedUpdate( RTC_PARSE_CHECK_OR_RETURN(proto.has_total_packets()); // Base event - bwe_loss_updates_.emplace_back(Timestamp::Millis(proto.timestamp_ms()), + bwe_loss_updates_.emplace_back(1000 * proto.timestamp_ms(), proto.bitrate_bps(), proto.fraction_loss(), proto.total_packets()); @@ -2655,7 +2645,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweLossBasedUpdate( const uint32_t total_packets = static_cast(total_packets_values[i].value()); - bwe_loss_updates_.emplace_back(Timestamp::Millis(timestamp_ms), bitrate_bps, + bwe_loss_updates_.emplace_back(1000 * timestamp_ms, bitrate_bps, fraction_loss, total_packets); } return ParseStatus::Success(); @@ -2670,7 +2660,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweDelayBasedUpdate( // Base event const BandwidthUsage base_detector_state = GetRuntimeDetectorState(proto.detector_state()); - bwe_delay_updates_.emplace_back(Timestamp::Millis(proto.timestamp_ms()), + bwe_delay_updates_.emplace_back(1000 * proto.timestamp_ms(), proto.bitrate_bps(), base_detector_state); const size_t number_of_deltas = @@ -2714,8 +2704,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweDelayBasedUpdate( static_cast( detector_state_values[i].value()); - bwe_delay_updates_.emplace_back(Timestamp::Millis(timestamp_ms), - bitrate_bps, + bwe_delay_updates_.emplace_back(1000 * timestamp_ms, bitrate_bps, GetRuntimeDetectorState(detector_state)); } return ParseStatus::Success(); @@ -2725,7 +2714,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweProbeClusterCreated( const rtclog2::BweProbeCluster& proto) { LoggedBweProbeClusterCreatedEvent probe_cluster; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - probe_cluster.timestamp = Timestamp::Millis(proto.timestamp_ms()); + probe_cluster.timestamp_us = proto.timestamp_ms() * 1000; RTC_PARSE_CHECK_OR_RETURN(proto.has_id()); probe_cluster.id = proto.id(); RTC_PARSE_CHECK_OR_RETURN(proto.has_bitrate_bps()); @@ -2745,7 +2734,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweProbeSuccessEvent( const rtclog2::BweProbeResultSuccess& proto) { LoggedBweProbeSuccessEvent probe_result; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - probe_result.timestamp = Timestamp::Millis(proto.timestamp_ms()); + probe_result.timestamp_us = proto.timestamp_ms() * 1000; RTC_PARSE_CHECK_OR_RETURN(proto.has_id()); probe_result.id = proto.id(); RTC_PARSE_CHECK_OR_RETURN(proto.has_bitrate_bps()); @@ -2761,7 +2750,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweProbeFailureEvent( const rtclog2::BweProbeResultFailure& proto) { LoggedBweProbeFailureEvent probe_result; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - probe_result.timestamp = Timestamp::Millis(proto.timestamp_ms()); + probe_result.timestamp_us = proto.timestamp_ms() * 1000; RTC_PARSE_CHECK_OR_RETURN(proto.has_id()); probe_result.id = proto.id(); RTC_PARSE_CHECK_OR_RETURN(proto.has_failure()); @@ -2784,7 +2773,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreFrameDecodedEvents( RTC_PARSE_CHECK_OR_RETURN(proto.has_qp()); LoggedFrameDecoded base_frame; - base_frame.timestamp = Timestamp::Millis(proto.timestamp_ms()); + base_frame.timestamp_us = 1000 * proto.timestamp_ms(); base_frame.ssrc = proto.ssrc(); base_frame.render_time_ms = proto.render_time_ms(); base_frame.width = proto.width(); @@ -2847,7 +2836,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreFrameDecodedEvents( RTC_PARSE_CHECK_OR_RETURN(timestamp_ms_values[i].has_value()); RTC_PARSE_CHECK_OR_RETURN( ToSigned(timestamp_ms_values[i].value(), ×tamp_ms)); - frame.timestamp = Timestamp::Millis(timestamp_ms); + frame.timestamp_us = 1000 * timestamp_ms; RTC_PARSE_CHECK_OR_RETURN(ssrc_values[i].has_value()); RTC_PARSE_CHECK_OR_RETURN_LE(ssrc_values[i].value(), @@ -2892,7 +2881,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreGenericAckReceivedEvent( base_receive_acked_packet_time_ms = proto.receive_acked_packet_time_ms(); } generic_acks_received_.push_back( - {Timestamp::Millis(proto.timestamp_ms()), proto.packet_number(), + {proto.timestamp_ms() * 1000, proto.packet_number(), proto.acked_packet_number(), base_receive_acked_packet_time_ms}); const size_t number_of_deltas = @@ -2951,8 +2940,8 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreGenericAckReceivedEvent( ToSigned(receive_acked_packet_time_ms_values[i].value(), &value)); receive_acked_packet_time_ms = value; } - generic_acks_received_.push_back({Timestamp::Millis(timestamp_ms), - packet_number, acked_packet_number, + generic_acks_received_.push_back({timestamp_ms * 1000, packet_number, + acked_packet_number, receive_acked_packet_time_ms}); } return ParseStatus::Success(); @@ -2969,7 +2958,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreGenericPacketSentEvent( RTC_PARSE_CHECK_OR_RETURN(proto.has_padding_length()); generic_packets_sent_.push_back( - {Timestamp::Millis(proto.timestamp_ms()), proto.packet_number(), + {proto.timestamp_ms() * 1000, proto.packet_number(), static_cast(proto.overhead_length()), static_cast(proto.payload_length()), static_cast(proto.padding_length())}); @@ -3016,7 +3005,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreGenericPacketSentEvent( RTC_PARSE_CHECK_OR_RETURN(payload_length_values[i].has_value()); RTC_PARSE_CHECK_OR_RETURN(padding_length_values[i].has_value()); generic_packets_sent_.push_back( - {Timestamp::Millis(timestamp_ms), packet_number, + {timestamp_ms * 1000, packet_number, static_cast(overhead_length_values[i].value()), static_cast(payload_length_values[i].value()), static_cast(padding_length_values[i].value())}); @@ -3033,7 +3022,7 @@ ParsedRtcEventLog::StoreGenericPacketReceivedEvent( RTC_PARSE_CHECK_OR_RETURN(proto.has_packet_number()); RTC_PARSE_CHECK_OR_RETURN(proto.has_packet_length()); - generic_packets_received_.push_back({Timestamp::Millis(proto.timestamp_ms()), + generic_packets_received_.push_back({proto.timestamp_ms() * 1000, proto.packet_number(), proto.packet_length()}); @@ -3071,7 +3060,7 @@ ParsedRtcEventLog::StoreGenericPacketReceivedEvent( int32_t packet_length = static_cast(packet_length_values[i].value()); generic_packets_received_.push_back( - {Timestamp::Millis(timestamp_ms), packet_number, packet_length}); + {timestamp_ms * 1000, packet_number, packet_length}); } return ParseStatus::Success(); } @@ -3106,8 +3095,8 @@ ParsedRtcEventLog::StoreAudioNetworkAdaptationEvent( // Note: Encoding N as N-1 only done for |num_channels_deltas|. runtime_config.num_channels = proto.num_channels(); } - audio_network_adaptation_events_.emplace_back( - Timestamp::Millis(proto.timestamp_ms()), runtime_config); + audio_network_adaptation_events_.emplace_back(1000 * proto.timestamp_ms(), + runtime_config); } const size_t number_of_deltas = @@ -3228,8 +3217,8 @@ ParsedRtcEventLog::StoreAudioNetworkAdaptationEvent( runtime_config.num_channels = rtc::checked_cast(num_channels_values[i].value()); } - audio_network_adaptation_events_.emplace_back( - Timestamp::Millis(timestamp_ms), runtime_config); + audio_network_adaptation_events_.emplace_back(1000 * timestamp_ms, + runtime_config); } return ParseStatus::Success(); } @@ -3238,7 +3227,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreDtlsTransportState( const rtclog2::DtlsTransportStateEvent& proto) { LoggedDtlsTransportState dtls_state; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - dtls_state.timestamp = Timestamp::Millis(proto.timestamp_ms()); + dtls_state.timestamp_us = proto.timestamp_ms() * 1000; RTC_PARSE_CHECK_OR_RETURN(proto.has_dtls_transport_state()); dtls_state.dtls_transport_state = @@ -3252,7 +3241,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreDtlsWritableState( const rtclog2::DtlsWritableState& proto) { LoggedDtlsWritableState dtls_writable_state; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - dtls_writable_state.timestamp = Timestamp::Millis(proto.timestamp_ms()); + dtls_writable_state.timestamp_us = proto.timestamp_ms() * 1000; RTC_PARSE_CHECK_OR_RETURN(proto.has_writable()); dtls_writable_state.writable = proto.writable(); @@ -3264,7 +3253,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreIceCandidatePairConfig( const rtclog2::IceCandidatePairConfig& proto) { LoggedIceCandidatePairConfig ice_config; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - ice_config.timestamp = Timestamp::Millis(proto.timestamp_ms()); + ice_config.timestamp_us = proto.timestamp_ms() * 1000; RTC_PARSE_CHECK_OR_RETURN(proto.has_config_type()); ice_config.type = GetRuntimeIceCandidatePairConfigType(proto.config_type()); @@ -3302,7 +3291,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreIceCandidateEvent( const rtclog2::IceCandidatePairEvent& proto) { LoggedIceCandidatePairEvent ice_event; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - ice_event.timestamp = Timestamp::Millis(proto.timestamp_ms()); + ice_event.timestamp_us = proto.timestamp_ms() * 1000; RTC_PARSE_CHECK_OR_RETURN(proto.has_event_type()); ice_event.type = GetRuntimeIceCandidatePairEventType(proto.event_type()); RTC_PARSE_CHECK_OR_RETURN(proto.has_candidate_pair_id()); @@ -3322,7 +3311,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreVideoRecvConfig( const rtclog2::VideoRecvStreamConfig& proto) { LoggedVideoRecvConfig stream; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - stream.timestamp = Timestamp::Millis(proto.timestamp_ms()); + stream.timestamp_us = proto.timestamp_ms() * 1000; RTC_PARSE_CHECK_OR_RETURN(proto.has_remote_ssrc()); stream.config.remote_ssrc = proto.remote_ssrc(); RTC_PARSE_CHECK_OR_RETURN(proto.has_local_ssrc()); @@ -3342,7 +3331,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreVideoSendConfig( const rtclog2::VideoSendStreamConfig& proto) { LoggedVideoSendConfig stream; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - stream.timestamp = Timestamp::Millis(proto.timestamp_ms()); + stream.timestamp_us = proto.timestamp_ms() * 1000; RTC_PARSE_CHECK_OR_RETURN(proto.has_ssrc()); stream.config.local_ssrc = proto.ssrc(); if (proto.has_rtx_ssrc()) { @@ -3360,7 +3349,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreAudioRecvConfig( const rtclog2::AudioRecvStreamConfig& proto) { LoggedAudioRecvConfig stream; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - stream.timestamp = Timestamp::Millis(proto.timestamp_ms()); + stream.timestamp_us = proto.timestamp_ms() * 1000; RTC_PARSE_CHECK_OR_RETURN(proto.has_remote_ssrc()); stream.config.remote_ssrc = proto.remote_ssrc(); RTC_PARSE_CHECK_OR_RETURN(proto.has_local_ssrc()); @@ -3377,7 +3366,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreAudioSendConfig( const rtclog2::AudioSendStreamConfig& proto) { LoggedAudioSendConfig stream; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - stream.timestamp = Timestamp::Millis(proto.timestamp_ms()); + stream.timestamp_us = proto.timestamp_ms() * 1000; RTC_PARSE_CHECK_OR_RETURN(proto.has_ssrc()); stream.config.local_ssrc = proto.ssrc(); if (proto.has_header_extensions()) { diff --git a/logging/rtc_event_log/rtc_event_log_unittest.cc b/logging/rtc_event_log/rtc_event_log_unittest.cc index 5535bec44f..dca7fb7774 100644 --- a/logging/rtc_event_log/rtc_event_log_unittest.cc +++ b/logging/rtc_event_log/rtc_event_log_unittest.cc @@ -944,7 +944,7 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) { EXPECT_LT(probe_success_events.size(), kNumEvents); ASSERT_GT(probe_success_events.size(), 1u); - int64_t first_timestamp_ms = probe_success_events[0].timestamp.ms(); + int64_t first_timestamp_us = probe_success_events[0].timestamp_us; uint32_t first_id = probe_success_events[0].id; int32_t first_bitrate_bps = probe_success_events[0].bitrate_bps; // We want to reset the time to what we used when generating the events, but @@ -953,7 +953,7 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) { // destroyed before the new one is created, so we have to reset() first. fake_clock.reset(); fake_clock = std::make_unique(); - fake_clock->SetTime(Timestamp::Millis(first_timestamp_ms)); + fake_clock->SetTime(Timestamp::Micros(first_timestamp_us)); for (size_t i = 1; i < probe_success_events.size(); i++) { fake_clock->AdvanceTime(TimeDelta::Millis(10)); verifier_.VerifyLoggedBweProbeSuccessEvent( diff --git a/logging/rtc_event_log/rtc_event_log_unittest_helper.cc b/logging/rtc_event_log/rtc_event_log_unittest_helper.cc index 0960c98502..cefd4a6967 100644 --- a/logging/rtc_event_log/rtc_event_log_unittest_helper.cc +++ b/logging/rtc_event_log/rtc_event_log_unittest_helper.cc @@ -1124,10 +1124,10 @@ void EventVerifier::VerifyReportBlock( } void EventVerifier::VerifyLoggedSenderReport( - int64_t log_time_ms, + int64_t log_time_us, const rtcp::SenderReport& original_sr, const LoggedRtcpPacketSenderReport& logged_sr) { - EXPECT_EQ(log_time_ms, logged_sr.log_time_ms()); + EXPECT_EQ(log_time_us, logged_sr.log_time_us()); EXPECT_EQ(original_sr.sender_ssrc(), logged_sr.sr.sender_ssrc()); EXPECT_EQ(original_sr.ntp(), logged_sr.sr.ntp()); EXPECT_EQ(original_sr.rtp_timestamp(), logged_sr.sr.rtp_timestamp()); @@ -1144,10 +1144,10 @@ void EventVerifier::VerifyLoggedSenderReport( } void EventVerifier::VerifyLoggedReceiverReport( - int64_t log_time_ms, + int64_t log_time_us, const rtcp::ReceiverReport& original_rr, const LoggedRtcpPacketReceiverReport& logged_rr) { - EXPECT_EQ(log_time_ms, logged_rr.log_time_ms()); + EXPECT_EQ(log_time_us, logged_rr.log_time_us()); EXPECT_EQ(original_rr.sender_ssrc(), logged_rr.rr.sender_ssrc()); ASSERT_EQ(original_rr.report_blocks().size(), logged_rr.rr.report_blocks().size()); @@ -1158,10 +1158,10 @@ void EventVerifier::VerifyLoggedReceiverReport( } void EventVerifier::VerifyLoggedExtendedReports( - int64_t log_time_ms, + int64_t log_time_us, const rtcp::ExtendedReports& original_xr, const LoggedRtcpPacketExtendedReports& logged_xr) { - EXPECT_EQ(log_time_ms, logged_xr.log_time_ms()); + EXPECT_EQ(log_time_us, logged_xr.log_time_us()); EXPECT_EQ(original_xr.sender_ssrc(), logged_xr.xr.sender_ssrc()); EXPECT_EQ(original_xr.rrtr().has_value(), logged_xr.xr.rrtr().has_value()); @@ -1199,10 +1199,10 @@ void EventVerifier::VerifyLoggedExtendedReports( } } -void EventVerifier::VerifyLoggedFir(int64_t log_time_ms, +void EventVerifier::VerifyLoggedFir(int64_t log_time_us, const rtcp::Fir& original_fir, const LoggedRtcpPacketFir& logged_fir) { - EXPECT_EQ(log_time_ms, logged_fir.log_time_ms()); + EXPECT_EQ(log_time_us, logged_fir.log_time_us()); EXPECT_EQ(original_fir.sender_ssrc(), logged_fir.fir.sender_ssrc()); const auto& original_requests = original_fir.requests(); const auto& logged_requests = logged_fir.fir.requests(); @@ -1213,35 +1213,35 @@ void EventVerifier::VerifyLoggedFir(int64_t log_time_ms, } } -void EventVerifier::VerifyLoggedPli(int64_t log_time_ms, +void EventVerifier::VerifyLoggedPli(int64_t log_time_us, const rtcp::Pli& original_pli, const LoggedRtcpPacketPli& logged_pli) { - EXPECT_EQ(log_time_ms, logged_pli.log_time_ms()); + EXPECT_EQ(log_time_us, logged_pli.log_time_us()); EXPECT_EQ(original_pli.sender_ssrc(), logged_pli.pli.sender_ssrc()); EXPECT_EQ(original_pli.media_ssrc(), logged_pli.pli.media_ssrc()); } -void EventVerifier::VerifyLoggedBye(int64_t log_time_ms, +void EventVerifier::VerifyLoggedBye(int64_t log_time_us, const rtcp::Bye& original_bye, const LoggedRtcpPacketBye& logged_bye) { - EXPECT_EQ(log_time_ms, logged_bye.log_time_ms()); + EXPECT_EQ(log_time_us, logged_bye.log_time_us()); EXPECT_EQ(original_bye.sender_ssrc(), logged_bye.bye.sender_ssrc()); EXPECT_EQ(original_bye.csrcs(), logged_bye.bye.csrcs()); EXPECT_EQ(original_bye.reason(), logged_bye.bye.reason()); } -void EventVerifier::VerifyLoggedNack(int64_t log_time_ms, +void EventVerifier::VerifyLoggedNack(int64_t log_time_us, const rtcp::Nack& original_nack, const LoggedRtcpPacketNack& logged_nack) { - EXPECT_EQ(log_time_ms, logged_nack.log_time_ms()); + EXPECT_EQ(log_time_us, logged_nack.log_time_us()); EXPECT_EQ(original_nack.packet_ids(), logged_nack.nack.packet_ids()); } void EventVerifier::VerifyLoggedTransportFeedback( - int64_t log_time_ms, + int64_t log_time_us, const rtcp::TransportFeedback& original_transport_feedback, const LoggedRtcpPacketTransportFeedback& logged_transport_feedback) { - EXPECT_EQ(log_time_ms, logged_transport_feedback.log_time_ms()); + EXPECT_EQ(log_time_us, logged_transport_feedback.log_time_us()); ASSERT_EQ( original_transport_feedback.GetReceivedPackets().size(), logged_transport_feedback.transport_feedback.GetReceivedPackets().size()); @@ -1258,19 +1258,19 @@ void EventVerifier::VerifyLoggedTransportFeedback( } } -void EventVerifier::VerifyLoggedRemb(int64_t log_time_ms, +void EventVerifier::VerifyLoggedRemb(int64_t log_time_us, const rtcp::Remb& original_remb, const LoggedRtcpPacketRemb& logged_remb) { - EXPECT_EQ(log_time_ms, logged_remb.log_time_ms()); + EXPECT_EQ(log_time_us, logged_remb.log_time_us()); EXPECT_EQ(original_remb.ssrcs(), logged_remb.remb.ssrcs()); EXPECT_EQ(original_remb.bitrate_bps(), logged_remb.remb.bitrate_bps()); } void EventVerifier::VerifyLoggedLossNotification( - int64_t log_time_ms, + int64_t log_time_us, const rtcp::LossNotification& original_loss_notification, const LoggedRtcpPacketLossNotification& logged_loss_notification) { - EXPECT_EQ(log_time_ms, logged_loss_notification.log_time_ms()); + EXPECT_EQ(log_time_us, logged_loss_notification.log_time_us()); EXPECT_EQ(original_loss_notification.last_decoded(), logged_loss_notification.loss_notification.last_decoded()); EXPECT_EQ(original_loss_notification.last_received(), @@ -1285,7 +1285,7 @@ void EventVerifier::VerifyLoggedStartEvent( const LoggedStartEvent& logged_event) const { EXPECT_EQ(start_time_us / 1000, logged_event.log_time_ms()); if (encoding_type_ == RtcEventLog::EncodingType::NewFormat) { - EXPECT_EQ(utc_start_time_us / 1000, logged_event.utc_start_time.ms()); + EXPECT_EQ(utc_start_time_us / 1000, logged_event.utc_start_time_ms); } } diff --git a/logging/rtc_event_log/rtc_event_log_unittest_helper.h b/logging/rtc_event_log/rtc_event_log_unittest_helper.h index eb16592271..94cf3d5ae7 100644 --- a/logging/rtc_event_log/rtc_event_log_unittest_helper.h +++ b/logging/rtc_event_log/rtc_event_log_unittest_helper.h @@ -260,38 +260,38 @@ class EventVerifier { const RtcEventRtcpPacketOutgoing& original_event, const LoggedRtcpPacketOutgoing& logged_event) const; - void VerifyLoggedSenderReport(int64_t log_time_ms, + void VerifyLoggedSenderReport(int64_t log_time_us, const rtcp::SenderReport& original_sr, const LoggedRtcpPacketSenderReport& logged_sr); void VerifyLoggedReceiverReport( - int64_t log_time_ms, + int64_t log_time_us, const rtcp::ReceiverReport& original_rr, const LoggedRtcpPacketReceiverReport& logged_rr); void VerifyLoggedExtendedReports( - int64_t log_time_ms, + int64_t log_time_us, const rtcp::ExtendedReports& original_xr, const LoggedRtcpPacketExtendedReports& logged_xr); - void VerifyLoggedFir(int64_t log_time_ms, + void VerifyLoggedFir(int64_t log_time_us, const rtcp::Fir& original_fir, const LoggedRtcpPacketFir& logged_fir); - void VerifyLoggedPli(int64_t log_time_ms, + void VerifyLoggedPli(int64_t log_time_us, const rtcp::Pli& original_pli, const LoggedRtcpPacketPli& logged_pli); - void VerifyLoggedBye(int64_t log_time_ms, + void VerifyLoggedBye(int64_t log_time_us, const rtcp::Bye& original_bye, const LoggedRtcpPacketBye& logged_bye); - void VerifyLoggedNack(int64_t log_time_ms, + void VerifyLoggedNack(int64_t log_time_us, const rtcp::Nack& original_nack, const LoggedRtcpPacketNack& logged_nack); void VerifyLoggedTransportFeedback( - int64_t log_time_ms, + int64_t log_time_us, const rtcp::TransportFeedback& original_transport_feedback, const LoggedRtcpPacketTransportFeedback& logged_transport_feedback); - void VerifyLoggedRemb(int64_t log_time_ms, + void VerifyLoggedRemb(int64_t log_time_us, const rtcp::Remb& original_remb, const LoggedRtcpPacketRemb& logged_remb); void VerifyLoggedLossNotification( - int64_t log_time_ms, + int64_t log_time_us, const rtcp::LossNotification& original_loss_notification, const LoggedRtcpPacketLossNotification& logged_loss_notification); diff --git a/logging/rtc_event_log/rtc_event_processor_unittest.cc b/logging/rtc_event_log/rtc_event_processor_unittest.cc index b0cec25f1f..4ec5abee5e 100644 --- a/logging/rtc_event_log/rtc_event_processor_unittest.cc +++ b/logging/rtc_event_log/rtc_event_processor_unittest.cc @@ -29,7 +29,7 @@ std::vector CreateEventList( std::initializer_list timestamp_list) { std::vector v; for (int64_t timestamp_ms : timestamp_list) { - v.emplace_back(Timestamp::Millis(timestamp_ms)); + v.emplace_back(timestamp_ms * 1000); // Convert ms to us. } return v; } @@ -41,7 +41,7 @@ CreateRandomEventLists(size_t num_lists, size_t num_elements, uint64_t seed) { for (size_t elem = 0; elem < num_elements; elem++) { uint32_t i = prng.Rand(0u, num_lists - 1); int64_t timestamp_ms = elem; - lists[i].emplace_back(Timestamp::Millis(timestamp_ms)); + lists[i].emplace_back(timestamp_ms * 1000); } return lists; } @@ -146,8 +146,8 @@ TEST(RtcEventProcessor, DifferentTypes) { result.push_back(elem.log_time_ms()); }; - std::vector events1{LoggedStartEvent(Timestamp::Millis(2))}; - std::vector events2{LoggedStopEvent(Timestamp::Millis(1))}; + std::vector events1{LoggedStartEvent(2000)}; + std::vector events2{LoggedStopEvent(1000)}; RtcEventProcessor processor; processor.AddEvents(events1, f1); processor.AddEvents(events2, f2);