Bug 1821231: Take RTX stats into account for outbound-rtp stats. r=ng

Differential Revision: https://phabricator.services.mozilla.com/D172615
This commit is contained in:
Byron Campen 2023-03-20 13:44:35 +00:00
parent 5b6a2dae54
commit f162da1700
4 changed files with 28 additions and 2 deletions

View File

@ -347,14 +347,25 @@ nsTArray<RefPtr<dom::RTCStatsPromise>> RTCRtpSender::GetStatsInternal(
streamStats = Some(kv->second);
}
if (!streamStats ||
streamStats->rtp_stats.first_packet_time_ms == -1) {
if (!streamStats) {
// By spec: "The lifetime of all RTP monitored objects starts
// when the RTP stream is first used: When the first RTP packet
// is sent or received on the SSRC it represents"
return;
}
aConduit->GetAssociatedLocalRtxSSRC(ssrc).apply(
[&](const auto rtxSsrc) {
auto kv = videoStats->substreams.find(rtxSsrc);
if (kv != videoStats->substreams.end()) {
streamStats->rtp_stats.Add(kv->second.rtp_stats);
}
});
if (streamStats->rtp_stats.first_packet_time_ms == -1) {
return;
}
// First, fill in remote stat with rtcp receiver data, if present.
// ReceiverReports have less information than SenderReports, so fill
// in what we can.

View File

@ -404,6 +404,8 @@ class VideoSessionConduit : public MediaSessionConduit {
virtual bool AddFrameHistory(
dom::Sequence<dom::RTCVideoFrameHistoryInternal>* outHistories) const = 0;
virtual Maybe<Ssrc> GetAssociatedLocalRtxSSRC(Ssrc aSsrc) const = 0;
protected:
/* RTCP feedback settings, for unit testing purposes */
FrameRequestType mFrameRequestMethod;

View File

@ -835,6 +835,18 @@ std::vector<unsigned int> WebrtcVideoConduit::GetLocalSSRCs() const {
return mSendStreamConfig.rtp.ssrcs;
}
Maybe<Ssrc> WebrtcVideoConduit::GetAssociatedLocalRtxSSRC(Ssrc aSsrc) const {
MOZ_ASSERT(mCallThread->IsOnCurrentThread());
for (size_t i = 0; i < mSendStreamConfig.rtp.ssrcs.size() &&
i < mSendStreamConfig.rtp.rtx.ssrcs.size();
++i) {
if (mSendStreamConfig.rtp.ssrcs[i] == aSsrc) {
return Some(mSendStreamConfig.rtp.rtx.ssrcs[i]);
}
}
return Nothing();
}
void WebrtcVideoConduit::DeleteSendStream() {
MOZ_ASSERT(mCallThread->IsOnCurrentThread());
mMutex.AssertCurrentThreadOwns();

View File

@ -150,6 +150,7 @@ class WebrtcVideoConduit
MediaConduitErrorCode Init();
Ssrcs GetLocalSSRCs() const override;
Maybe<Ssrc> GetAssociatedLocalRtxSSRC(Ssrc aSsrc) const override;
Maybe<Ssrc> GetRemoteSSRC() const override;
// Call thread.