Files
sousa-gecko/third_party/libwebrtc/moz-patch-stack/s0029.patch
T
Nico Grunbaum 0ff17e1700 Bug 2047265 - Vendor libwebrtc from 888fb5647c
Upstream commit: https://webrtc.googlesource.com/src/+/888fb5647ce3fe5740a33500eaf731ec8c6b1b0d
    Use StrongAlias for RTP header extension identification.

    This change introduces RtpHeaderExtensionId as a StrongAlias to
    improve type safety for RTP header extension IDs. The type is used
    throughout the RTP stack.

    The code previous to this change has many different places where it
    defines what a valid ID is (between 1 and 255) by checking it - having
    a separate type allows us to centralize that check for validity.

    IDs need to be allocated at an RTP transport level. Manufacturing your
    own ID is a footgun - sooner or later the ID you manufacture will be
    used by the allocator, leading to an unexpected error situation. Having
    a separate type allows the reader to easily figure out where IDs are
    being created, and verify that it's either in an unit test or in the
    allocator.

    Key changes:
    - RtpHeaderExtensionId defined in api/rtp_header_extension_id.h
    - Backwards compatible overloads (taking int) added to public APIs in
      api/ and modules/rtp_rtcp/ to ensure no breaking changes for
      downstream projects.
    - RtpPacket, RtpHeaderExtensionPicker, and other internal components
      updated to use the new type.
    - Updated SRTP components to handle RtpHeaderExtensionId.
    - Fixed naming conflict in fake_rtp.h by renaming kRtcpReport to
      kFakeRtcpReport.
    - Updated numerous tests to comply with the new explicit type.

    Bug: webrtc:514817938
    Change-Id: I79eb728f2ebd5c1fe5a1711eae2162c742fd029c
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/473880
    Auto-Submit: Harald Alvestrand <hta@webrtc.org>
    Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
    Commit-Queue: Harald Alvestrand <hta@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#47832}
2026-06-19 13:55:46 +00:00

132 lines
5.1 KiB
Diff

From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 18 Jan 2021 11:04:00 +0100
Subject: Bug 1654112 - Include RtcpPacketTypeCounter in audio send stats, to
not regress nackCount. r=ng
This is similar to how it's already included for video send.
Differential Revision: https://phabricator.services.mozilla.com/D102273
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d380a43d59f4f7cbc001f4eab9b63ee993b32cd8
---
audio/audio_send_stream.cc | 1 +
audio/channel_send.cc | 32 ++++++++++++++++++++++++++++++++
audio/channel_send.h | 1 +
call/audio_send_stream.h | 2 ++
4 files changed, 36 insertions(+)
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index e9e72b48e7..378a7a6596 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -442,6 +442,7 @@ webrtc::AudioSendStream::Stats AudioSendStream::GetStats(
webrtc::ChannelSendStatistics channel_stats =
channel_send_->GetRTCPStatistics();
+ stats.rtcp_packet_type_counts = channel_stats.rtcp_packet_type_counts;
stats.payload_bytes_sent = channel_stats.payload_bytes_sent;
stats.header_and_padding_bytes_sent =
channel_stats.header_and_padding_bytes_sent;
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 591b76960e..cf07c7014c 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -84,6 +84,32 @@ constexpr TimeDelta kMinRetransmissionWindow = TimeDelta::Millis(30);
class RtpPacketSenderProxy;
class TransportSequenceNumberProxy;
+class RtcpCounterObserver : public RtcpPacketTypeCounterObserver {
+ public:
+ explicit RtcpCounterObserver(uint32_t ssrc) : ssrc_(ssrc) {}
+
+ void RtcpPacketTypesCounterUpdated(
+ uint32_t ssrc,
+ const RtcpPacketTypeCounter& packet_counter) override {
+ if (ssrc_ != ssrc) {
+ return;
+ }
+
+ MutexLock lock(&mutex_);
+ packet_counter_ = packet_counter;
+ }
+
+ RtcpPacketTypeCounter GetCounts() {
+ MutexLock lock(&mutex_);
+ return packet_counter_;
+ }
+
+ private:
+ Mutex mutex_;
+ const uint32_t ssrc_;
+ RtcpPacketTypeCounter packet_counter_;
+};
+
class AudioBitrateAccountant {
public:
void RegisterPacketOverhead(int packet_byte_overhead) {
@@ -292,6 +318,8 @@ class ChannelSend : public ChannelSendInterface,
bool input_mute_ RTC_GUARDED_BY(volume_settings_mutex_) = false;
bool previous_frame_muted_ RTC_GUARDED_BY(encoder_queue_checker_) = false;
+ const std::unique_ptr<RtcpCounterObserver> rtcp_counter_observer_;
+
PacketRouter* packet_router_ RTC_GUARDED_BY(worker_thread_) = nullptr;
const std::unique_ptr<RtpPacketSenderProxy> rtp_packet_pacer_proxy_;
const std::unique_ptr<RateLimiter> retransmission_rate_limiter_;
@@ -512,6 +540,7 @@ ChannelSend::ChannelSend(
: env_(env),
worker_thread_(TaskQueueBase::Current()),
ssrc_(ssrc),
+ rtcp_counter_observer_(new RtcpCounterObserver(ssrc)),
rtp_packet_pacer_proxy_(new RtpPacketSenderProxy()),
retransmission_rate_limiter_(
new RateLimiter(&env_.clock(), kMaxRetransmissionWindow.ms())),
@@ -535,6 +564,8 @@ ChannelSend::ChannelSend(
configuration.paced_sender = rtp_packet_pacer_proxy_.get();
configuration.rtt_stats = rtcp_rtt_stats;
+ configuration.rtcp_packet_type_counter_observer =
+ rtcp_counter_observer_.get();
if (env_.field_trials().IsDisabled("WebRTC-DisableRtxRateLimiter")) {
configuration.retransmission_rate_limiter =
retransmission_rate_limiter_.get();
@@ -817,6 +848,7 @@ ChannelSendStatistics ChannelSend::GetRTCPStatistics() const {
RTC_DCHECK_RUN_ON(worker_thread_);
ChannelSendStatistics stats = {
.round_trip_time = rtp_rtcp_->LastRtt().value_or(TimeDelta::Zero())};
+ stats.rtcp_packet_type_counts = rtcp_counter_observer_->GetCounts();
StreamDataCounters rtp_stats;
StreamDataCounters rtx_stats;
diff --git a/audio/channel_send.h b/audio/channel_send.h
index 750d2a95b2..1ce1612e96 100644
--- a/audio/channel_send.h
+++ b/audio/channel_send.h
@@ -53,6 +53,7 @@ struct ChannelSendStatistics {
TimeDelta total_packet_send_delay = TimeDelta::Zero();
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-retransmittedpacketssent
uint64_t retransmitted_packets_sent;
+ RtcpPacketTypeCounter rtcp_packet_type_counts;
// A snapshot of Report Blocks with additional data of interest to statistics.
// Within this list, the sender-source SSRC pair is unique and per-pair the
// ReportBlockData represents the latest Report Block that was received for
diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h
index 46be3bcc47..0b6b924377 100644
--- a/call/audio_send_stream.h
+++ b/call/audio_send_stream.h
@@ -31,6 +31,7 @@
#include "api/units/time_delta.h"
#include "call/audio_sender.h"
#include "modules/rtp_rtcp/include/report_block_data.h"
+#include "modules/rtp_rtcp/include/rtcp_statistics.h"
namespace webrtc {
@@ -67,6 +68,7 @@ class AudioSendStream : public AudioSender {
ANAStats ana_statistics;
AudioProcessingStats apm_statistics;
+ RtcpPacketTypeCounter rtcp_packet_type_counts;
int64_t target_bitrate_bps = 0;
// A snapshot of Report Blocks with additional data of interest to