Open Bug 2085162 Opened 28 days ago Updated 9 days ago

RTCOutboundRtpStreamStats.nackCount is always 0 for audio

Categories

(Core :: WebRTC: Networking, defect, P2)

defect

Tracking

()

UNCONFIRMED

People

(Reporter: deadbeef, Assigned: bwc)

References

(Regression)

Details

(Keywords: regression)

Steps to reproduce

Create a bidirectional WebRTC peer connection and simulate packet loss (for example with mac network link conditioner) and observe nackCount in about:webrtc

Actual results

Remains at 0.

Expected results

Should increment as NACKs are received.

Before upstream libwebrtc supported NACK stats on AudioSendStream::Stats, Mozilla added a local patch (RtcpCounterObserver in third_party/libwebrtc/audio/channel_send.cc and rtcp_packet_type_counts on CallSendStatistics / AudioSendStream::Stats) so that RTCRtpSender::GetStatsInternal (dom/media/webrtc/jsapi/RTCRtpSender.cpp) could populate outbound-rtp.nackCount for audio:

local.mNackCount.Construct(
    audioStats->rtcp_packet_type_counts.nack_packets);

Upstream libwebrtc later added audio NACK tracking directly to ChannelSend (making ChannelSend itself inherit from RtcpPacketTypeCounterObserver) and exposed nacks_received on CallSendStatistics / AudioSendStream::Stats.

When that upstream change was merged into Firefox's ChannelSend::ChannelSend constructor (third_party/libwebrtc/audio/channel_send.cc, lines 549–557), both observer assignments were kept on configuration.rtcp_packet_type_counter_observer:

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();
}
configuration.extmap_allow_mixed = extmap_allow_mixed;
configuration.rtcp_report_interval_ms = rtcp_report_interval_ms;
configuration.rtcp_packet_type_counter_observer = this;

Because = this overwrites = rtcp_counter_observer_.get(), RTCPReceiver only notifies ChannelSend::RtcpPacketTypesCounterUpdated (populating audioStats->nacks_received) and never updates rtcp_counter_observer_. As a result, audioStats->rtcp_packet_type_counts.nack_packets is permanently 0, so outbound-rtp.nackCount for audio is always 0 in getStats().

Suggested Fix:
Since audioStats->rtcp_packet_type_counts is only used for .nack_packets in RTCRtpSender.cpp, Firefox can switch RTCRtpSender.cpp to read upstream's audioStats->nacks_received:

local.mNackCount.Construct(audioStats->nacks_received);

and drop the custom RtcpCounterObserver / rtcp_packet_type_counts patch in third_party/libwebrtc.

Component: Untriaged → WebRTC: Networking
Product: Firefox → Core
Summary: RTCOutboundRtpStreamStats.nackCount is always 0 → RTCOutboundRtpStreamStats.nackCount is always 0 for audio

The severity field is not set for this bug.
:bwc, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(docfaraday)
Severity: -- → S2
Flags: needinfo?(docfaraday)
Priority: -- → P2

Let's fix this once we're done with the 158 update.

Depends on: 2086269
Assignee: nobody → docfaraday
You need to log in before you can comment on or make changes to this bug.