Bug 1766646 - Vendor libwebrtc from 2497a27b22

Upstream commit: https://webrtc.googlesource.com/src/+/2497a27b22a3f09c701642230f83f67a4c00df13
    Store RtpPacketReceived::arrival_time as Timestamp.

    Previously this value was rounded up to a millisecond value.
    This change is complementary to another change:
    https://webrtc-review.googlesource.com/c/src/+/216398

    Bug: webrtc:12722
    Change-Id: I0fd2baceb4608132615fb6ad241ec863e343edb1
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217521
    Commit-Queue: Tommi <tommi@webrtc.org>
    Reviewed-by: Johannes Kron <kron@webrtc.org>
    Cr-Commit-Position: refs/heads/master@{#33928}
This commit is contained in:
Michael Froman 2022-05-19 15:47:20 -05:00 коммит произвёл Connor Sheehan
Родитель 6de10dd7a1
Коммит 350846abee
12 изменённых файлов: 48 добавлений и 31 удалений

3
third_party/libwebrtc/README.moz-ff-commit поставляемый
Просмотреть файл

@ -5322,3 +5322,6 @@ bb7ee95c71
# MOZ_LIBWEBRTC_SRC=/home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src MOZ_LIBWEBRTC_COMMIT=mjfdev bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
3f418ccf99
# MOZ_LIBWEBRTC_SRC=/home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src MOZ_LIBWEBRTC_COMMIT=mjfdev bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
2497a27b22

2
third_party/libwebrtc/README.mozilla поставляемый
Просмотреть файл

@ -3550,3 +3550,5 @@ libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwe
libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-05-19T20:44:40.329132.
# python3 vendor-libwebrtc.py --from-local /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src --commit mjfdev libwebrtc
libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-05-19T20:45:29.899165.
# python3 vendor-libwebrtc.py --from-local /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src --commit mjfdev libwebrtc
libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-05-19T20:47:15.140603.

14
third_party/libwebrtc/call/call.cc поставляемый
Просмотреть файл

@ -1426,9 +1426,9 @@ PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type,
packet_time_us = receive_time_calculator_->ReconcileReceiveTimes(
packet_time_us, rtc::TimeUTCMicros(), clock_->TimeInMicroseconds());
}
parsed_packet.set_arrival_time_ms((packet_time_us + 500) / 1000);
parsed_packet.set_arrival_time(Timestamp::Micros(packet_time_us));
} else {
parsed_packet.set_arrival_time_ms(clock_->TimeInMilliseconds());
parsed_packet.set_arrival_time(clock_->CurrentTime());
}
// We might get RTP keep-alive packets in accordance with RFC6263 section 4.6.
@ -1464,7 +1464,7 @@ PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type,
received_audio_bytes_per_second_counter_.Add(length);
event_log_->Log(
std::make_unique<RtcEventRtpPacketIncoming>(parsed_packet));
const int64_t arrival_time_ms = parsed_packet.arrival_time_ms();
const int64_t arrival_time_ms = parsed_packet.arrival_time().ms();
if (!first_received_rtp_audio_ms_) {
first_received_rtp_audio_ms_.emplace(arrival_time_ms);
}
@ -1478,7 +1478,7 @@ PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type,
received_video_bytes_per_second_counter_.Add(length);
event_log_->Log(
std::make_unique<RtcEventRtpPacketIncoming>(parsed_packet));
const int64_t arrival_time_ms = parsed_packet.arrival_time_ms();
const int64_t arrival_time_ms = parsed_packet.arrival_time().ms();
if (!first_received_rtp_video_ms_) {
first_received_rtp_video_ms_.emplace(arrival_time_ms);
}
@ -1566,7 +1566,7 @@ void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet,
ReceivedPacket packet_msg;
packet_msg.size = DataSize::Bytes(packet.payload_size());
packet_msg.receive_time = Timestamp::Millis(packet.arrival_time_ms());
packet_msg.receive_time = packet.arrival_time();
if (header.extension.hasAbsoluteSendTime) {
packet_msg.send_time = header.extension.GetAbsoluteSendTimestamp();
}
@ -1586,8 +1586,8 @@ void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet,
if (media_type == MediaType::VIDEO ||
(use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
receive_side_cc_.OnReceivedPacket(
packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
header);
packet.arrival_time().ms(),
packet.payload_size() + packet.padding_size(), header);
}
}

Просмотреть файл

@ -64,7 +64,7 @@ void RtxReceiveStream::OnRtpPacket(const RtpPacketReceived& rtx_packet) {
media_packet.SetSequenceNumber((payload[0] << 8) + payload[1]);
media_packet.SetPayloadType(it->second);
media_packet.set_recovered(true);
media_packet.set_arrival_time_ms(rtx_packet.arrival_time_ms());
media_packet.set_arrival_time(rtx_packet.arrival_time());
// Skip the RTX header.
rtc::ArrayView<const uint8_t> rtx_payload = payload.subview(kRtxHeaderSize);

Просмотреть файл

@ -194,9 +194,9 @@ TEST(RtxReceiveStreamTest, PropagatesArrivalTime) {
RtxReceiveStream rtx_sink(&media_sink, PayloadTypeMapping(), kMediaSSRC);
RtpPacketReceived rtx_packet(nullptr);
EXPECT_TRUE(rtx_packet.Parse(rtc::ArrayView<const uint8_t>(kRtxPacket)));
rtx_packet.set_arrival_time_ms(123);
EXPECT_CALL(media_sink,
OnRtpPacket(Property(&RtpPacketReceived::arrival_time_ms, 123)));
rtx_packet.set_arrival_time(Timestamp::Millis(123));
EXPECT_CALL(media_sink, OnRtpPacket(Property(&RtpPacketReceived::arrival_time,
Timestamp::Millis(123))));
rtx_sink.OnRtpPacket(rtx_packet);
}

Просмотреть файл

@ -111,6 +111,7 @@ rtc_library("rtp_rtcp_format") {
"../../api/transport:network_control",
"../../api/transport/rtp:dependency_descriptor",
"../../api/units:time_delta",
"../../api/units:timestamp",
"../../api/video:video_frame",
"../../api/video:video_layers_allocation",
"../../api/video:video_rtp_headers",

Просмотреть файл

@ -21,8 +21,10 @@
namespace webrtc {
RtpPacketReceived::RtpPacketReceived() = default;
RtpPacketReceived::RtpPacketReceived(const ExtensionManager* extensions)
: RtpPacket(extensions) {}
RtpPacketReceived::RtpPacketReceived(
const ExtensionManager* extensions,
webrtc::Timestamp arrival_time /*= webrtc::Timestamp::MinusInfinity()*/)
: RtpPacket(extensions), arrival_time_(arrival_time) {}
RtpPacketReceived::RtpPacketReceived(const RtpPacketReceived& packet) = default;
RtpPacketReceived::RtpPacketReceived(RtpPacketReceived&& packet) = default;

Просмотреть файл

@ -14,10 +14,12 @@
#include <utility>
#include "absl/base/attributes.h"
#include "api/array_view.h"
#include "api/ref_counted_base.h"
#include "api/rtp_headers.h"
#include "api/scoped_refptr.h"
#include "api/units/timestamp.h"
#include "modules/rtp_rtcp/source/rtp_packet.h"
namespace webrtc {
@ -27,7 +29,9 @@ namespace webrtc {
class RtpPacketReceived : public RtpPacket {
public:
RtpPacketReceived();
explicit RtpPacketReceived(const ExtensionManager* extensions);
explicit RtpPacketReceived(
const ExtensionManager* extensions,
webrtc::Timestamp arrival_time = webrtc::Timestamp::MinusInfinity());
RtpPacketReceived(const RtpPacketReceived& packet);
RtpPacketReceived(RtpPacketReceived&& packet);
@ -42,8 +46,17 @@ class RtpPacketReceived : public RtpPacket {
// Time in local time base as close as it can to packet arrived on the
// network.
int64_t arrival_time_ms() const { return arrival_time_ms_; }
void set_arrival_time_ms(int64_t time) { arrival_time_ms_ = time; }
webrtc::Timestamp arrival_time() const { return arrival_time_; }
void set_arrival_time(webrtc::Timestamp time) { arrival_time_ = time; }
ABSL_DEPRECATED("Use arrival_time() instead")
int64_t arrival_time_ms() const {
return arrival_time_.IsMinusInfinity() ? -1 : arrival_time_.ms();
}
ABSL_DEPRECATED("Use set_arrival_time() instead")
void set_arrival_time_ms(int64_t time) {
arrival_time_ = webrtc::Timestamp::Millis(time);
}
// Flag if packet was recovered via RTX or FEC.
bool recovered() const { return recovered_; }
@ -64,7 +77,7 @@ class RtpPacketReceived : public RtpPacket {
}
private:
int64_t arrival_time_ms_ = 0;
webrtc::Timestamp arrival_time_ = Timestamp::MinusInfinity();
int payload_type_frequency_ = 0;
bool recovered_ = false;
rtc::scoped_refptr<rtc::RefCountedBase> additional_data_;

12
third_party/libwebrtc/pc/channel.cc поставляемый
Просмотреть файл

@ -471,13 +471,6 @@ bool BaseChannel::SendPacket(bool rtcp,
void BaseChannel::OnRtpPacket(const webrtc::RtpPacketReceived& parsed_packet) {
RTC_DCHECK_RUN_ON(network_thread());
// Take packet time from the |parsed_packet|.
// RtpPacketReceived.arrival_time_ms = (timestamp_us + 500) / 1000;
int64_t packet_time_us = -1;
if (parsed_packet.arrival_time_ms() > 0) {
packet_time_us = parsed_packet.arrival_time_ms() * 1000;
}
if (on_first_packet_received_) {
on_first_packet_received_();
on_first_packet_received_ = nullptr;
@ -501,7 +494,10 @@ void BaseChannel::OnRtpPacket(const webrtc::RtpPacketReceived& parsed_packet) {
return;
}
media_channel_->OnPacketReceived(parsed_packet.Buffer(), packet_time_us);
webrtc::Timestamp packet_time = parsed_packet.arrival_time();
media_channel_->OnPacketReceived(
parsed_packet.Buffer(),
packet_time.IsMinusInfinity() ? -1 : packet_time.us());
}
void BaseChannel::UpdateRtpHeaderExtensionMap(

8
third_party/libwebrtc/pc/rtp_transport.cc поставляемый
Просмотреть файл

@ -181,16 +181,16 @@ bool RtpTransport::UnregisterRtpDemuxerSink(RtpPacketSinkInterface* sink) {
void RtpTransport::DemuxPacket(rtc::CopyOnWriteBuffer packet,
int64_t packet_time_us) {
webrtc::RtpPacketReceived parsed_packet(&header_extension_map_);
webrtc::RtpPacketReceived parsed_packet(
&header_extension_map_, packet_time_us == -1
? Timestamp::MinusInfinity()
: Timestamp::Micros(packet_time_us));
if (!parsed_packet.Parse(std::move(packet))) {
RTC_LOG(LS_ERROR)
<< "Failed to parse the incoming RTP packet before demuxing. Drop it.";
return;
}
if (packet_time_us != -1) {
parsed_packet.set_arrival_time_ms((packet_time_us + 500) / 1000);
}
if (!rtp_demuxer_.OnRtpPacket(parsed_packet)) {
RTC_LOG(LS_WARNING) << "Failed to demux RTP packet: "
<< RtpDemuxer::DescribePacket(parsed_packet);

Просмотреть файл

@ -1214,7 +1214,7 @@ void RtpVideoStreamReceiver::UpdatePacketReceiveTimestamps(
<< " with payload type: " << static_cast<int>(packet.PayloadType())
<< ", timestamp: " << packet.Timestamp()
<< ", sequence number: " << packet.SequenceNumber()
<< ", arrival time: " << packet.arrival_time_ms();
<< ", arrival time: " << ToString(packet.arrival_time());
int32_t time_offset;
if (packet.GetExtension<TransmissionOffset>(&time_offset)) {
ss << ", toffset: " << time_offset;

Просмотреть файл

@ -1177,7 +1177,7 @@ void RtpVideoStreamReceiver2::UpdatePacketReceiveTimestamps(
<< " with payload type: " << static_cast<int>(packet.PayloadType())
<< ", timestamp: " << packet.Timestamp()
<< ", sequence number: " << packet.SequenceNumber()
<< ", arrival time: " << packet.arrival_time_ms();
<< ", arrival time: " << ToString(packet.arrival_time());
int32_t time_offset;
if (packet.GetExtension<TransmissionOffset>(&time_offset)) {
ss << ", toffset: " << time_offset;