diff options
Diffstat (limited to 'logging/rtc_event_log/rtc_event_log_parser.cc')
-rw-r--r-- | logging/rtc_event_log/rtc_event_log_parser.cc | 159 |
1 files changed, 85 insertions, 74 deletions
diff --git a/logging/rtc_event_log/rtc_event_log_parser.cc b/logging/rtc_event_log/rtc_event_log_parser.cc index 6cdaa75bb7..d10e4f987a 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( - proto.timestamp_ms() * 1000, header, proto.header_size(), + Timestamp::Millis(proto.timestamp_ms()), 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( - 1000 * timestamp_ms, header, header.headerLength, + Timestamp::Millis(timestamp_ms), header, header.headerLength, payload_size_values[i].value() + header.headerLength + header.paddingLength); } @@ -615,7 +615,8 @@ ParsedRtcEventLog::ParseStatus StoreRtcpPackets( !IdenticalRtcpContents(rtcp_packets->back().rtcp.raw_data, proto.raw_packet())) { // Base event - rtcp_packets->emplace_back(proto.timestamp_ms() * 1000, proto.raw_packet()); + rtcp_packets->emplace_back(Timestamp::Millis(proto.timestamp_ms()), + proto.raw_packet()); } const size_t number_of_deltas = @@ -653,7 +654,7 @@ ParsedRtcEventLog::ParseStatus StoreRtcpPackets( continue; } std::string data(raw_packet_values[i]); - rtcp_packets->emplace_back(1000 * timestamp_ms, data); + rtcp_packets->emplace_back(Timestamp::Millis(timestamp_ms), data); } return ParsedRtcEventLog::ParseStatus::Success(); } @@ -672,6 +673,7 @@ ParsedRtcEventLog::ParseStatus StoreRtcpBlocks( std::vector<LoggedRtcpPacketBye>* bye_list, std::vector<LoggedRtcpPacketTransportFeedback>* transport_feedback_list, std::vector<LoggedRtcpPacketLossNotification>* 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()) { @@ -679,44 +681,44 @@ ParsedRtcEventLog::ParseStatus StoreRtcpBlocks( if (header.type() == rtcp::TransportFeedback::kPacketType && header.fmt() == rtcp::TransportFeedback::kFeedbackMessageType) { LoggedRtcpPacketTransportFeedback parsed_block; - parsed_block.timestamp_us = timestamp_us; + parsed_block.timestamp = timestamp; 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_us = timestamp_us; + parsed_block.timestamp = timestamp; 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_us = timestamp_us; + parsed_block.timestamp = timestamp; 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_us = timestamp_us; + parsed_block.timestamp = timestamp; 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_us = timestamp_us; + parsed_block.timestamp = timestamp; 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_us = timestamp_us; + parsed_block.timestamp = timestamp; 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_us = timestamp_us; + parsed_block.timestamp = timestamp; if (parsed_block.bye.Parse(header)) { bye_list->push_back(std::move(parsed_block)); } @@ -725,7 +727,7 @@ ParsedRtcEventLog::ParseStatus StoreRtcpBlocks( bool type_found = false; if (!type_found) { LoggedRtcpPacketRemb parsed_block; - parsed_block.timestamp_us = timestamp_us; + parsed_block.timestamp = timestamp; if (parsed_block.remb.Parse(header)) { remb_list->push_back(std::move(parsed_block)); type_found = true; @@ -733,7 +735,7 @@ ParsedRtcEventLog::ParseStatus StoreRtcpBlocks( } if (!type_found) { LoggedRtcpPacketLossNotification parsed_block; - parsed_block.timestamp_us = timestamp_us; + parsed_block.timestamp = timestamp; if (parsed_block.loss_notification.Parse(header)) { loss_notification_list->push_back(std::move(parsed_block)); type_found = true; @@ -742,7 +744,7 @@ ParsedRtcEventLog::ParseStatus StoreRtcpBlocks( } else if (header.type() == rtcp::Nack::kPacketType && header.fmt() == rtcp::Nack::kFeedbackMessageType) { LoggedRtcpPacketNack parsed_block; - parsed_block.timestamp_us = timestamp_us; + parsed_block.timestamp = timestamp; if (parsed_block.nack.Parse(header)) { nack_list->push_back(std::move(parsed_block)); } @@ -1170,7 +1172,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( @@ -1182,7 +1184,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( @@ -1374,7 +1376,8 @@ 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_us, config.value()); + video_recv_configs_.emplace_back(Timestamp::Micros(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] = @@ -1388,7 +1391,8 @@ 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_us, config.value()); + video_send_configs_.emplace_back(Timestamp::Micros(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] = @@ -1402,7 +1406,8 @@ 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_us, config.value()); + audio_recv_configs_.emplace_back(Timestamp::Micros(timestamp_us), + config.value()); incoming_rtp_extensions_maps_[config.value().remote_ssrc] = RtpHeaderExtensionMap(config.value().rtp_extensions); break; @@ -1413,7 +1418,8 @@ 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_us, config.value()); + audio_send_configs_.emplace_back(Timestamp::Micros(timestamp_us), + config.value()); outgoing_rtp_extensions_maps_[config.value().local_ssrc] = RtpHeaderExtensionMap(config.value().rtp_extensions); break; @@ -1446,11 +1452,13 @@ 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_us, parsed_header, header_length, + LoggedRtpPacketIncoming(Timestamp::Micros(timestamp_us), + parsed_header, header_length, total_length)); } else { outgoing_rtp_packets_map_[parsed_header.ssrc].push_back( - LoggedRtpPacketOutgoing(timestamp_us, parsed_header, header_length, + LoggedRtpPacketOutgoing(Timestamp::Micros(timestamp_us), + parsed_header, header_length, total_length)); } break; @@ -1469,24 +1477,26 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreParsedLegacyEvent( if (packet == last_incoming_rtcp_packet_) break; incoming_rtcp_packets_.push_back( - LoggedRtcpPacketIncoming(timestamp_us, packet)); + LoggedRtcpPacketIncoming(Timestamp::Micros(timestamp_us), packet)); last_incoming_rtcp_packet_ = packet; } else { outgoing_rtcp_packets_.push_back( - LoggedRtcpPacketOutgoing(timestamp_us, packet)); + LoggedRtcpPacketOutgoing(Timestamp::Micros(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_us)); + start_log_events_.push_back( + LoggedStartEvent(Timestamp::Micros(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_us)); + stop_log_events_.push_back( + LoggedStopEvent(Timestamp::Micros(timestamp_us))); break; } case rtclog::Event::AUDIO_PLAYOUT_EVENT: { @@ -1805,7 +1815,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_us = event.timestamp_us(); + res.timestamp = Timestamp::Micros(event.timestamp_us()); RTC_PARSE_CHECK_OR_RETURN(playout_event.has_local_ssrc()); res.ssrc = playout_event.local_ssrc(); return res; @@ -1821,7 +1831,7 @@ ParsedRtcEventLog::GetLossBasedBweUpdate(const rtclog::Event& event) const { LoggedBweLossBasedUpdate bwe_update; RTC_CHECK(event.has_timestamp_us()); - bwe_update.timestamp_us = event.timestamp_us(); + bwe_update.timestamp = Timestamp::Micros(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()); @@ -1842,7 +1852,7 @@ ParsedRtcEventLog::GetDelayBasedBweUpdate(const rtclog::Event& event) const { LoggedBweDelayBasedUpdate res; RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); - res.timestamp_us = event.timestamp_us(); + res.timestamp = Timestamp::Micros(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()); @@ -1861,7 +1871,7 @@ ParsedRtcEventLog::GetAudioNetworkAdaptation(const rtclog::Event& event) const { LoggedAudioNetworkAdaptationEvent res; RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); - res.timestamp_us = event.timestamp_us(); + res.timestamp = Timestamp::Micros(event.timestamp_us()); if (ana_event.has_bitrate_bps()) res.config.bitrate_bps = ana_event.bitrate_bps(); if (ana_event.has_enable_fec()) @@ -1887,7 +1897,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_us = event.timestamp_us(); + res.timestamp = Timestamp::Micros(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()); @@ -1912,7 +1922,7 @@ ParsedRtcEventLog::GetBweProbeFailure(const rtclog::Event& event) const { LoggedBweProbeFailureEvent res; RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); - res.timestamp_us = event.timestamp_us(); + res.timestamp = Timestamp::Micros(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()); @@ -1945,7 +1955,7 @@ ParsedRtcEventLog::GetBweProbeSuccess(const rtclog::Event& event) const { LoggedBweProbeSuccessEvent res; RTC_PARSE_CHECK_OR_RETURN(event.has_timestamp_us()); - res.timestamp_us = event.timestamp_us(); + res.timestamp = Timestamp::Micros(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()); @@ -1962,7 +1972,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_us = event.timestamp_us(); + res.timestamp = Timestamp::Micros(event.timestamp_us()); RTC_PARSE_CHECK_OR_RETURN(alr_event.has_in_alr()); res.in_alr = alr_event.in_alr(); @@ -1979,7 +1989,7 @@ ParsedRtcEventLog::GetIceCandidatePairConfig( const rtclog::IceCandidatePairConfig& config = rtc_event.ice_candidate_pair_config(); RTC_CHECK(rtc_event.has_timestamp_us()); - res.timestamp_us = rtc_event.timestamp_us(); + res.timestamp = Timestamp::Micros(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()); @@ -2018,7 +2028,7 @@ ParsedRtcEventLog::GetIceCandidatePairEvent( const rtclog::IceCandidatePairEvent& event = rtc_event.ice_candidate_pair_event(); RTC_CHECK(rtc_event.has_timestamp_us()); - res.timestamp_us = rtc_event.timestamp_us(); + res.timestamp = Timestamp::Micros(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()); @@ -2404,7 +2414,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_us = proto.timestamp_ms() * 1000; + alr_event.timestamp = Timestamp::Millis(proto.timestamp_ms()); alr_event.in_alr = proto.in_alr(); alr_state_events_.push_back(alr_event); @@ -2418,7 +2428,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_ms = proto.timestamp_ms(); + route_event.timestamp = Timestamp::Millis(proto.timestamp_ms()); route_event.connected = proto.connected(); route_event.overhead = proto.overhead(); @@ -2432,7 +2442,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreRemoteEstimateEvent( RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); // Base event LoggedRemoteEstimateEvent base_event; - base_event.timestamp_ms = proto.timestamp_ms(); + base_event.timestamp = Timestamp::Millis(proto.timestamp_ms()); absl::optional<uint64_t> base_link_capacity_lower_kbps; if (proto.has_link_capacity_lower_kbps()) { @@ -2480,7 +2490,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_ms = *timestamp_ms_values[i]; + event.timestamp = Timestamp::Millis(*timestamp_ms_values[i]); if (link_capacity_lower_kbps_values[i]) event.link_capacity_lower = DataRate::KilobitsPerSec(*link_capacity_lower_kbps_values[i]); @@ -2499,7 +2509,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreAudioPlayoutEvent( // Base event audio_playout_events_[proto.local_ssrc()].emplace_back( - 1000 * proto.timestamp_ms(), proto.local_ssrc()); + Timestamp::Millis(proto.timestamp_ms()), proto.local_ssrc()); const size_t number_of_deltas = proto.has_number_of_deltas() ? proto.number_of_deltas() : 0u; @@ -2531,8 +2541,8 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreAudioPlayoutEvent( const uint32_t local_ssrc = static_cast<uint32_t>(local_ssrc_values[i].value()); - audio_playout_events_[local_ssrc].emplace_back(1000 * timestamp_ms, - local_ssrc); + audio_playout_events_[local_ssrc].emplace_back( + Timestamp::Millis(timestamp_ms), local_ssrc); } return ParseStatus::Success(); } @@ -2565,8 +2575,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(proto.timestamp_ms() * 1000, - proto.utc_time_ms()); + LoggedStartEvent start_event(Timestamp::Millis(proto.timestamp_ms()), + Timestamp::Millis(proto.utc_time_ms())); start_log_events_.push_back(start_event); return ParseStatus::Success(); @@ -2575,7 +2585,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(proto.timestamp_ms() * 1000); + LoggedStopEvent stop_event(Timestamp::Millis(proto.timestamp_ms())); stop_log_events_.push_back(stop_event); return ParseStatus::Success(); @@ -2589,7 +2599,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweLossBasedUpdate( RTC_PARSE_CHECK_OR_RETURN(proto.has_total_packets()); // Base event - bwe_loss_updates_.emplace_back(1000 * proto.timestamp_ms(), + bwe_loss_updates_.emplace_back(Timestamp::Millis(proto.timestamp_ms()), proto.bitrate_bps(), proto.fraction_loss(), proto.total_packets()); @@ -2645,7 +2655,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweLossBasedUpdate( const uint32_t total_packets = static_cast<uint32_t>(total_packets_values[i].value()); - bwe_loss_updates_.emplace_back(1000 * timestamp_ms, bitrate_bps, + bwe_loss_updates_.emplace_back(Timestamp::Millis(timestamp_ms), bitrate_bps, fraction_loss, total_packets); } return ParseStatus::Success(); @@ -2660,7 +2670,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweDelayBasedUpdate( // Base event const BandwidthUsage base_detector_state = GetRuntimeDetectorState(proto.detector_state()); - bwe_delay_updates_.emplace_back(1000 * proto.timestamp_ms(), + bwe_delay_updates_.emplace_back(Timestamp::Millis(proto.timestamp_ms()), proto.bitrate_bps(), base_detector_state); const size_t number_of_deltas = @@ -2704,7 +2714,8 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweDelayBasedUpdate( static_cast<rtclog2::DelayBasedBweUpdates::DetectorState>( detector_state_values[i].value()); - bwe_delay_updates_.emplace_back(1000 * timestamp_ms, bitrate_bps, + bwe_delay_updates_.emplace_back(Timestamp::Millis(timestamp_ms), + bitrate_bps, GetRuntimeDetectorState(detector_state)); } return ParseStatus::Success(); @@ -2714,7 +2725,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweProbeClusterCreated( const rtclog2::BweProbeCluster& proto) { LoggedBweProbeClusterCreatedEvent probe_cluster; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - probe_cluster.timestamp_us = proto.timestamp_ms() * 1000; + probe_cluster.timestamp = Timestamp::Millis(proto.timestamp_ms()); RTC_PARSE_CHECK_OR_RETURN(proto.has_id()); probe_cluster.id = proto.id(); RTC_PARSE_CHECK_OR_RETURN(proto.has_bitrate_bps()); @@ -2734,7 +2745,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweProbeSuccessEvent( const rtclog2::BweProbeResultSuccess& proto) { LoggedBweProbeSuccessEvent probe_result; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - probe_result.timestamp_us = proto.timestamp_ms() * 1000; + probe_result.timestamp = Timestamp::Millis(proto.timestamp_ms()); RTC_PARSE_CHECK_OR_RETURN(proto.has_id()); probe_result.id = proto.id(); RTC_PARSE_CHECK_OR_RETURN(proto.has_bitrate_bps()); @@ -2750,7 +2761,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreBweProbeFailureEvent( const rtclog2::BweProbeResultFailure& proto) { LoggedBweProbeFailureEvent probe_result; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - probe_result.timestamp_us = proto.timestamp_ms() * 1000; + probe_result.timestamp = Timestamp::Millis(proto.timestamp_ms()); RTC_PARSE_CHECK_OR_RETURN(proto.has_id()); probe_result.id = proto.id(); RTC_PARSE_CHECK_OR_RETURN(proto.has_failure()); @@ -2773,7 +2784,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreFrameDecodedEvents( RTC_PARSE_CHECK_OR_RETURN(proto.has_qp()); LoggedFrameDecoded base_frame; - base_frame.timestamp_us = 1000 * proto.timestamp_ms(); + base_frame.timestamp = Timestamp::Millis(proto.timestamp_ms()); base_frame.ssrc = proto.ssrc(); base_frame.render_time_ms = proto.render_time_ms(); base_frame.width = proto.width(); @@ -2836,7 +2847,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_us = 1000 * timestamp_ms; + frame.timestamp = Timestamp::Millis(timestamp_ms); RTC_PARSE_CHECK_OR_RETURN(ssrc_values[i].has_value()); RTC_PARSE_CHECK_OR_RETURN_LE(ssrc_values[i].value(), @@ -2881,7 +2892,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreGenericAckReceivedEvent( base_receive_acked_packet_time_ms = proto.receive_acked_packet_time_ms(); } generic_acks_received_.push_back( - {proto.timestamp_ms() * 1000, proto.packet_number(), + {Timestamp::Millis(proto.timestamp_ms()), proto.packet_number(), proto.acked_packet_number(), base_receive_acked_packet_time_ms}); const size_t number_of_deltas = @@ -2940,8 +2951,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_ms * 1000, packet_number, - acked_packet_number, + generic_acks_received_.push_back({Timestamp::Millis(timestamp_ms), + packet_number, acked_packet_number, receive_acked_packet_time_ms}); } return ParseStatus::Success(); @@ -2958,7 +2969,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreGenericPacketSentEvent( RTC_PARSE_CHECK_OR_RETURN(proto.has_padding_length()); generic_packets_sent_.push_back( - {proto.timestamp_ms() * 1000, proto.packet_number(), + {Timestamp::Millis(proto.timestamp_ms()), proto.packet_number(), static_cast<size_t>(proto.overhead_length()), static_cast<size_t>(proto.payload_length()), static_cast<size_t>(proto.padding_length())}); @@ -3005,7 +3016,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_ms * 1000, packet_number, + {Timestamp::Millis(timestamp_ms), packet_number, static_cast<size_t>(overhead_length_values[i].value()), static_cast<size_t>(payload_length_values[i].value()), static_cast<size_t>(padding_length_values[i].value())}); @@ -3022,7 +3033,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({proto.timestamp_ms() * 1000, + generic_packets_received_.push_back({Timestamp::Millis(proto.timestamp_ms()), proto.packet_number(), proto.packet_length()}); @@ -3060,7 +3071,7 @@ ParsedRtcEventLog::StoreGenericPacketReceivedEvent( int32_t packet_length = static_cast<int32_t>(packet_length_values[i].value()); generic_packets_received_.push_back( - {timestamp_ms * 1000, packet_number, packet_length}); + {Timestamp::Millis(timestamp_ms), packet_number, packet_length}); } return ParseStatus::Success(); } @@ -3095,8 +3106,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(1000 * proto.timestamp_ms(), - runtime_config); + audio_network_adaptation_events_.emplace_back( + Timestamp::Millis(proto.timestamp_ms()), runtime_config); } const size_t number_of_deltas = @@ -3217,8 +3228,8 @@ ParsedRtcEventLog::StoreAudioNetworkAdaptationEvent( runtime_config.num_channels = rtc::checked_cast<size_t>(num_channels_values[i].value()); } - audio_network_adaptation_events_.emplace_back(1000 * timestamp_ms, - runtime_config); + audio_network_adaptation_events_.emplace_back( + Timestamp::Millis(timestamp_ms), runtime_config); } return ParseStatus::Success(); } @@ -3227,7 +3238,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreDtlsTransportState( const rtclog2::DtlsTransportStateEvent& proto) { LoggedDtlsTransportState dtls_state; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - dtls_state.timestamp_us = proto.timestamp_ms() * 1000; + dtls_state.timestamp = Timestamp::Millis(proto.timestamp_ms()); RTC_PARSE_CHECK_OR_RETURN(proto.has_dtls_transport_state()); dtls_state.dtls_transport_state = @@ -3241,7 +3252,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_us = proto.timestamp_ms() * 1000; + dtls_writable_state.timestamp = Timestamp::Millis(proto.timestamp_ms()); RTC_PARSE_CHECK_OR_RETURN(proto.has_writable()); dtls_writable_state.writable = proto.writable(); @@ -3253,7 +3264,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreIceCandidatePairConfig( const rtclog2::IceCandidatePairConfig& proto) { LoggedIceCandidatePairConfig ice_config; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - ice_config.timestamp_us = proto.timestamp_ms() * 1000; + ice_config.timestamp = Timestamp::Millis(proto.timestamp_ms()); RTC_PARSE_CHECK_OR_RETURN(proto.has_config_type()); ice_config.type = GetRuntimeIceCandidatePairConfigType(proto.config_type()); @@ -3291,7 +3302,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreIceCandidateEvent( const rtclog2::IceCandidatePairEvent& proto) { LoggedIceCandidatePairEvent ice_event; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - ice_event.timestamp_us = proto.timestamp_ms() * 1000; + ice_event.timestamp = Timestamp::Millis(proto.timestamp_ms()); 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()); @@ -3311,7 +3322,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreVideoRecvConfig( const rtclog2::VideoRecvStreamConfig& proto) { LoggedVideoRecvConfig stream; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - stream.timestamp_us = proto.timestamp_ms() * 1000; + stream.timestamp = Timestamp::Millis(proto.timestamp_ms()); 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()); @@ -3331,7 +3342,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreVideoSendConfig( const rtclog2::VideoSendStreamConfig& proto) { LoggedVideoSendConfig stream; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - stream.timestamp_us = proto.timestamp_ms() * 1000; + stream.timestamp = Timestamp::Millis(proto.timestamp_ms()); RTC_PARSE_CHECK_OR_RETURN(proto.has_ssrc()); stream.config.local_ssrc = proto.ssrc(); if (proto.has_rtx_ssrc()) { @@ -3349,7 +3360,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreAudioRecvConfig( const rtclog2::AudioRecvStreamConfig& proto) { LoggedAudioRecvConfig stream; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - stream.timestamp_us = proto.timestamp_ms() * 1000; + stream.timestamp = Timestamp::Millis(proto.timestamp_ms()); 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()); @@ -3366,7 +3377,7 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreAudioSendConfig( const rtclog2::AudioSendStreamConfig& proto) { LoggedAudioSendConfig stream; RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms()); - stream.timestamp_us = proto.timestamp_ms() * 1000; + stream.timestamp = Timestamp::Millis(proto.timestamp_ms()); RTC_PARSE_CHECK_OR_RETURN(proto.has_ssrc()); stream.config.local_ssrc = proto.ssrc(); if (proto.has_header_extensions()) { |