webrtc_m130/logging/rtc_event_log/logged_events.cc
Björn Terelius ada810aab2 Reland "Deprecate microsecond timestamps in RTC event log."
This is a reland of e6ee8fab7eac915b2b6abc9b71b6d33ad086f3d1

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 <terelius@webrtc.org>
> Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org>
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#34097}

Bug: webrtc:11933
Change-Id: I295be966ee96b50719ceb4690dad7e7ce958dbac
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221361
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34321}
2021-06-17 12:08:54 +00:00

58 lines
2.4 KiB
C++

/*
* Copyright 2019 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "logging/rtc_event_log/logged_events.h"
namespace webrtc {
LoggedPacketInfo::LoggedPacketInfo(const LoggedRtpPacket& rtp,
LoggedMediaType media_type,
bool rtx,
Timestamp capture_time)
: ssrc(rtp.header.ssrc),
stream_seq_no(rtp.header.sequenceNumber),
size(static_cast<uint16_t>(rtp.total_length)),
payload_size(static_cast<uint16_t>(rtp.total_length -
rtp.header.paddingLength -
rtp.header.headerLength)),
padding_size(static_cast<uint16_t>(rtp.header.paddingLength)),
payload_type(rtp.header.payloadType),
media_type(media_type),
rtx(rtx),
marker_bit(rtp.header.markerBit),
has_transport_seq_no(rtp.header.extension.hasTransportSequenceNumber),
transport_seq_no(static_cast<uint16_t>(
has_transport_seq_no ? rtp.header.extension.transportSequenceNumber
: 0)),
capture_time(capture_time),
log_packet_time(Timestamp::Micros(rtp.log_time_us())),
reported_send_time(rtp.header.extension.hasAbsoluteSendTime
? rtp.header.extension.GetAbsoluteSendTimestamp()
: Timestamp::MinusInfinity()) {}
LoggedPacketInfo::LoggedPacketInfo(const LoggedPacketInfo&) = default;
LoggedPacketInfo::~LoggedPacketInfo() {}
LoggedRtcpPacket::LoggedRtcpPacket(Timestamp timestamp,
const std::vector<uint8_t>& packet)
: timestamp(timestamp), raw_data(packet) {}
LoggedRtcpPacket::LoggedRtcpPacket(Timestamp timestamp,
const std::string& packet)
: timestamp(timestamp), raw_data(packet.size()) {
memcpy(raw_data.data(), packet.data(), packet.size());
}
LoggedRtcpPacket::LoggedRtcpPacket(const LoggedRtcpPacket& rhs) = default;
LoggedRtcpPacket::~LoggedRtcpPacket() = default;
} // namespace webrtc