Reland "Refactor AnalyzerConfig to use Timestamps instead of microseconds."
This is a reland of 43fb16921b29ecd3a2d87876dda75c575e05f66a Original change's description: > Refactor AnalyzerConfig to use Timestamps instead of microseconds. > > Add optional offset-to-UTC parameter to output. This allows aligning > the x-axis in the generated charts to other UTC-based logs. > > Bug: b/215140373 > Change-Id: I65bcd295718acbb8c94e363907c1abc458067bfd > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250203 > Reviewed-by: Kristoffer Erlandsson <kerl@google.com> > Commit-Queue: Björn Terelius <terelius@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#35992} Bug: b/215140373 Change-Id: Id2b88cc4b8078a97275d49a617581cbbd02d2c6f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252380 Reviewed-by: Kristoffer Erlandsson <kerl@google.com> Commit-Queue: Björn Terelius <terelius@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36066}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
caf2063a9e
commit
7a992e21b9
@ -41,6 +41,7 @@ struct LoggedRtpPacket {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp;
|
||||
// TODO(terelius): This allocates space for 15 CSRCs even if none are used.
|
||||
@ -57,6 +58,7 @@ struct LoggedRtpPacketIncoming {
|
||||
: 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(); }
|
||||
Timestamp log_time() const { return rtp.timestamp; }
|
||||
|
||||
LoggedRtpPacket rtp;
|
||||
};
|
||||
@ -69,6 +71,7 @@ struct LoggedRtpPacketOutgoing {
|
||||
: 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(); }
|
||||
Timestamp log_time() const { return rtp.timestamp; }
|
||||
|
||||
LoggedRtpPacket rtp;
|
||||
};
|
||||
@ -87,6 +90,7 @@ struct LoggedRtcpPacket {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp;
|
||||
std::vector<uint8_t> raw_data;
|
||||
@ -101,6 +105,7 @@ struct LoggedRtcpPacketIncoming {
|
||||
|
||||
int64_t log_time_us() const { return rtcp.timestamp.us(); }
|
||||
int64_t log_time_ms() const { return rtcp.timestamp.ms(); }
|
||||
Timestamp log_time() const { return rtcp.timestamp; }
|
||||
|
||||
LoggedRtcpPacket rtcp;
|
||||
};
|
||||
@ -114,6 +119,7 @@ struct LoggedRtcpPacketOutgoing {
|
||||
|
||||
int64_t log_time_us() const { return rtcp.timestamp.us(); }
|
||||
int64_t log_time_ms() const { return rtcp.timestamp.ms(); }
|
||||
Timestamp log_time() const { return rtcp.timestamp; }
|
||||
|
||||
LoggedRtcpPacket rtcp;
|
||||
};
|
||||
@ -126,6 +132,7 @@ struct LoggedRtcpPacketReceiverReport {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtcp::ReceiverReport rr;
|
||||
@ -139,6 +146,7 @@ struct LoggedRtcpPacketSenderReport {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtcp::SenderReport sr;
|
||||
@ -149,6 +157,7 @@ struct LoggedRtcpPacketExtendedReports {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtcp::ExtendedReports xr;
|
||||
@ -161,6 +170,7 @@ struct LoggedRtcpPacketRemb {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtcp::Remb remb;
|
||||
@ -173,6 +183,7 @@ struct LoggedRtcpPacketNack {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtcp::Nack nack;
|
||||
@ -183,6 +194,7 @@ struct LoggedRtcpPacketFir {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtcp::Fir fir;
|
||||
@ -193,6 +205,7 @@ struct LoggedRtcpPacketPli {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtcp::Pli pli;
|
||||
@ -209,6 +222,7 @@ struct LoggedRtcpPacketTransportFeedback {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtcp::TransportFeedback transport_feedback;
|
||||
@ -223,6 +237,7 @@ struct LoggedRtcpPacketLossNotification {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtcp::LossNotification loss_notification;
|
||||
@ -233,6 +248,7 @@ struct LoggedRtcpPacketBye {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtcp::Bye bye;
|
||||
|
@ -32,6 +32,7 @@ struct LoggedAlrStateEvent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
bool in_alr;
|
||||
|
@ -31,6 +31,7 @@ struct LoggedAudioNetworkAdaptationEvent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
AudioEncoderRuntimeConfig config;
|
||||
|
@ -32,6 +32,7 @@ struct LoggedAudioPlayoutEvent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
uint32_t ssrc;
|
||||
|
@ -30,6 +30,7 @@ struct LoggedAudioRecvConfig {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtclog::StreamConfig config;
|
||||
|
@ -29,6 +29,7 @@ struct LoggedAudioSendConfig {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtclog::StreamConfig config;
|
||||
|
@ -35,6 +35,7 @@ struct LoggedStartEvent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp utc_time() const { return utc_start_time; }
|
||||
|
||||
|
@ -76,6 +76,7 @@ struct LoggedBweDelayBasedUpdate {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
int32_t bitrate_bps;
|
||||
|
@ -37,6 +37,7 @@ struct LoggedBweLossBasedUpdate {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
int32_t bitrate_bps;
|
||||
|
@ -26,6 +26,7 @@ namespace webrtc {
|
||||
struct LoggedDtlsTransportState {
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
DtlsTransportState dtls_transport_state;
|
||||
|
@ -28,6 +28,7 @@ struct LoggedDtlsWritableState {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
bool writable;
|
||||
|
@ -32,6 +32,7 @@ struct LoggedStopEvent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::PlusInfinity();
|
||||
};
|
||||
|
@ -29,6 +29,7 @@ namespace webrtc {
|
||||
struct LoggedFrameDecoded {
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
int64_t render_time_ms;
|
||||
|
@ -36,6 +36,7 @@ struct LoggedGenericAckReceived {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
int64_t packet_number;
|
||||
|
@ -33,6 +33,7 @@ struct LoggedGenericPacketReceived {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
int64_t packet_number;
|
||||
|
@ -37,6 +37,7 @@ struct LoggedGenericPacketSent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
size_t packet_length() const {
|
||||
return payload_length + padding_length + overhead_length;
|
||||
|
@ -45,6 +45,7 @@ struct LoggedIceCandidatePairEvent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
IceCandidatePairEventType type;
|
||||
|
@ -72,6 +72,7 @@ enum class IceCandidateNetworkType {
|
||||
struct LoggedIceCandidatePairConfig {
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
IceCandidatePairConfigType type;
|
||||
|
@ -39,6 +39,7 @@ struct LoggedBweProbeClusterCreatedEvent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
int32_t id;
|
||||
|
@ -40,6 +40,7 @@ struct LoggedBweProbeFailureEvent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
int32_t id;
|
||||
|
@ -33,6 +33,7 @@ struct LoggedBweProbeSuccessEvent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
int32_t id;
|
||||
|
@ -28,6 +28,7 @@ struct LoggedRemoteEstimateEvent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
absl::optional<DataRate> link_capacity_lower;
|
||||
|
@ -29,6 +29,7 @@ struct LoggedRouteChangeEvent {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
bool connected;
|
||||
|
@ -30,6 +30,7 @@ struct LoggedVideoRecvConfig {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtclog::StreamConfig config;
|
||||
|
@ -30,6 +30,7 @@ struct LoggedVideoSendConfig {
|
||||
|
||||
int64_t log_time_us() const { return timestamp.us(); }
|
||||
int64_t log_time_ms() const { return timestamp.ms(); }
|
||||
Timestamp log_time() const { return timestamp; }
|
||||
|
||||
Timestamp timestamp = Timestamp::MinusInfinity();
|
||||
rtclog::StreamConfig config;
|
||||
|
@ -1110,8 +1110,8 @@ void ParsedRtcEventLog::Clear() {
|
||||
|
||||
last_incoming_rtcp_packet_.clear();
|
||||
|
||||
first_timestamp_ = std::numeric_limits<int64_t>::max();
|
||||
last_timestamp_ = std::numeric_limits<int64_t>::min();
|
||||
first_timestamp_ = Timestamp::PlusInfinity();
|
||||
last_timestamp_ = Timestamp::MinusInfinity();
|
||||
first_log_segment_ = LogSegment(0, std::numeric_limits<int64_t>::max());
|
||||
|
||||
incoming_rtp_extensions_maps_.clear();
|
||||
@ -1232,8 +1232,8 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::ParseStream(
|
||||
// stream configurations and starting/stopping the log.
|
||||
// TODO(terelius): Figure out if we actually need to find the first and last
|
||||
// timestamp in the parser. It seems like this could be done by the caller.
|
||||
first_timestamp_ = std::numeric_limits<int64_t>::max();
|
||||
last_timestamp_ = std::numeric_limits<int64_t>::min();
|
||||
first_timestamp_ = Timestamp::PlusInfinity();
|
||||
last_timestamp_ = Timestamp::MinusInfinity();
|
||||
StoreFirstAndLastTimestamp(alr_state_events());
|
||||
StoreFirstAndLastTimestamp(route_change_events());
|
||||
for (const auto& audio_stream : audio_playout_events()) {
|
||||
@ -1272,7 +1272,8 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::ParseStream(
|
||||
// event, we could use the timestamp of the the last previous regular event.
|
||||
auto start_iter = start_log_events().begin();
|
||||
auto stop_iter = stop_log_events().begin();
|
||||
int64_t start_us = first_timestamp();
|
||||
int64_t start_us =
|
||||
first_timestamp().us_or(std::numeric_limits<int64_t>::max());
|
||||
int64_t next_start_us = std::numeric_limits<int64_t>::max();
|
||||
int64_t stop_us = std::numeric_limits<int64_t>::max();
|
||||
if (start_iter != start_log_events().end()) {
|
||||
@ -1286,15 +1287,14 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::ParseStream(
|
||||
}
|
||||
stop_us = std::min(stop_us, next_start_us);
|
||||
if (stop_us == std::numeric_limits<int64_t>::max() &&
|
||||
last_timestamp() != std::numeric_limits<int64_t>::min()) {
|
||||
stop_us = last_timestamp();
|
||||
!last_timestamp().IsMinusInfinity()) {
|
||||
stop_us = last_timestamp().us();
|
||||
}
|
||||
RTC_PARSE_CHECK_OR_RETURN_LE(start_us, stop_us);
|
||||
first_log_segment_ = LogSegment(start_us, stop_us);
|
||||
|
||||
if (first_timestamp_ == std::numeric_limits<int64_t>::max() &&
|
||||
last_timestamp_ == std::numeric_limits<int64_t>::min()) {
|
||||
first_timestamp_ = last_timestamp_ = 0;
|
||||
if (first_timestamp_ > last_timestamp_) {
|
||||
first_timestamp_ = last_timestamp_ = Timestamp::Zero();
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -1563,8 +1563,8 @@ template <typename T>
|
||||
void ParsedRtcEventLog::StoreFirstAndLastTimestamp(const std::vector<T>& v) {
|
||||
if (v.empty())
|
||||
return;
|
||||
first_timestamp_ = std::min(first_timestamp_, v.front().log_time_us());
|
||||
last_timestamp_ = std::max(last_timestamp_, v.back().log_time_us());
|
||||
first_timestamp_ = std::min(first_timestamp_, v.front().log_time());
|
||||
last_timestamp_ = std::max(last_timestamp_, v.back().log_time());
|
||||
}
|
||||
|
||||
ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreParsedLegacyEvent(
|
||||
|
@ -643,8 +643,8 @@ class ParsedRtcEventLog {
|
||||
return decoded_frames_;
|
||||
}
|
||||
|
||||
int64_t first_timestamp() const { return first_timestamp_; }
|
||||
int64_t last_timestamp() const { return last_timestamp_; }
|
||||
Timestamp first_timestamp() const { return first_timestamp_; }
|
||||
Timestamp last_timestamp() const { return last_timestamp_; }
|
||||
|
||||
const LogSegment& first_log_segment() const { return first_log_segment_; }
|
||||
|
||||
@ -889,8 +889,8 @@ class ParsedRtcEventLog {
|
||||
|
||||
std::vector<uint8_t> last_incoming_rtcp_packet_;
|
||||
|
||||
int64_t first_timestamp_;
|
||||
int64_t last_timestamp_;
|
||||
Timestamp first_timestamp_ = Timestamp::PlusInfinity();
|
||||
Timestamp last_timestamp_ = Timestamp::MinusInfinity();
|
||||
|
||||
LogSegment first_log_segment_ =
|
||||
LogSegment(0, std::numeric_limits<int64_t>::max());
|
||||
|
@ -785,8 +785,8 @@ void RtcEventLogSession::ReadAndVerifyLog() {
|
||||
parsed_generic_acks_received[i]);
|
||||
}
|
||||
|
||||
EXPECT_EQ(first_timestamp_ms_, parsed_log.first_timestamp() / 1000);
|
||||
EXPECT_EQ(last_timestamp_ms_, parsed_log.last_timestamp() / 1000);
|
||||
EXPECT_EQ(first_timestamp_ms_, parsed_log.first_timestamp().ms());
|
||||
EXPECT_EQ(last_timestamp_ms_, parsed_log.last_timestamp().ms());
|
||||
|
||||
EXPECT_EQ(parsed_log.first_log_segment().start_time_ms(),
|
||||
std::min(start_time_us_ / 1000, first_timestamp_ms_));
|
||||
|
Reference in New Issue
Block a user