commit 09719747b70c9cfe02f732cc47431c8e920b2bb0
parent 71f66de474b284e8ba6be5794a6ff86e7c75f62a
Author: Dan Baker <dbaker@mozilla.com>
Date: Mon, 27 Oct 2025 14:05:28 -0600
Bug 1995393 - Vendor libwebrtc from a60b9a4162
Upstream commit: https://webrtc.googlesource.com/src/+/a60b9a4162bfb8f4f7134e096a5dccfdcc99dc48
Test inbound-rtp is created for the early media use case.
Once DTLS has been established, you can offer to receive media and have
packets flowing before returning to "stable". Because we can receive
packets early like this, we should also have "early" inbound-rtp stats
object creation.
Bug: chromium:406585888
Change-Id: I3bf7eff5099f4c070b77487a301a9ee6f003aadc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/406521
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45451}
Diffstat:
2 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor
@@ -1,4 +1,4 @@
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
-libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-27T20:02:19.638234+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-27T20:05:11.729217+00:00.
# base of lastest vendoring
-1c1c160ff9
+a60b9a4162
diff --git a/third_party/libwebrtc/pc/rtc_stats_integrationtest.cc b/third_party/libwebrtc/pc/rtc_stats_integrationtest.cc
@@ -24,9 +24,12 @@
#include "api/field_trials.h"
#include "api/make_ref_counted.h"
#include "api/media_stream_interface.h"
+#include "api/media_types.h"
#include "api/peer_connection_interface.h"
#include "api/rtp_receiver_interface.h"
#include "api/rtp_sender_interface.h"
+#include "api/rtp_transceiver_direction.h"
+#include "api/rtp_transceiver_interface.h"
#include "api/scoped_refptr.h"
#include "api/stats/attribute.h"
#include "api/stats/rtc_stats.h"
@@ -1369,6 +1372,58 @@ TEST_F(RTCStatsRtpLifetimeTest, VideoInboundRtpMissingBeforeFirstPacket) {
ASSERT_THAT(inbound_rtps, SizeIs(1));
EXPECT_GT(inbound_rtps[0]->packets_received.value_or(0), 0u);
}
+
+TEST_F(RTCStatsRtpLifetimeTest, InboundRtpForEarlyMedia) {
+ // Dummy m-section needed for DTLS to be established. Early media is not
+ // possible before then. Also exchange ICE candidates.
+ RtpTransceiverInit init;
+ init.direction = RtpTransceiverDirection::kSendOnly;
+ caller_->pc()->AddTransceiver(MediaType::VIDEO, init);
+ caller_->ListenForRemoteIceCandidates(callee_);
+ callee_->ListenForRemoteIceCandidates(caller_);
+ PeerConnectionTestWrapper::AwaitNegotiation(caller_.get(), callee_.get());
+ caller_->AwaitAddRemoteIceCandidates();
+ callee_->AwaitAddRemoteIceCandidates();
+
+ // In a follow-up exchange, offer to receive.
+ init.direction = RtpTransceiverDirection::kRecvOnly;
+ caller_->pc()->AddTransceiver(MediaType::VIDEO, init);
+ auto offer = caller_->AwaitCreateOffer();
+ caller_->AwaitSetLocalDescription(offer.get());
+ callee_->AwaitSetRemoteDescription(offer.get());
+ // Answer to send.
+ scoped_refptr<MediaStreamInterface> stream = callee_->GetUserMedia(
+ /*audio=*/false, {}, /*video=*/true);
+ scoped_refptr<VideoTrackInterface> track = stream->GetVideoTracks()[0];
+ auto transceivers = callee_->pc()->GetTransceivers();
+ ASSERT_EQ(transceivers.size(), 2u);
+ transceivers[1]->sender()->SetTrack(track.get());
+ EXPECT_THAT(transceivers[1]->SetDirectionWithError(
+ RtpTransceiverDirection::kSendOnly),
+ IsRtcOk());
+ auto answer = callee_->AwaitCreateAnswer();
+ callee_->AwaitSetLocalDescription(answer.get());
+
+ // We never set the remote answer...
+ ASSERT_EQ(caller_->pc()->signaling_state(),
+ PeerConnectionInterface::SignalingState::kHaveLocalOffer);
+ // But because of early media, we're still able to receive packets.
+ // - Whether or not we unmute the track in response to this is outside the
+ // scope of this stats test.
+ scoped_refptr<const RTCStatsReport> report;
+ std::vector<const RTCInboundRtpStreamStats*> inbound_rtps;
+ EXPECT_THAT(WaitUntil(
+ [&] {
+ report = GetStats(caller_->pc());
+ inbound_rtps =
+ report->GetStatsOfType<RTCInboundRtpStreamStats>();
+ return inbound_rtps.size() > 0;
+ },
+ IsTrue(), {.timeout = TimeDelta::Millis(kGetStatsTimeoutMs)}),
+ IsRtcOk());
+ ASSERT_THAT(inbound_rtps, SizeIs(1));
+ EXPECT_GT(inbound_rtps[0]->packets_received.value_or(0), 0u);
+}
#endif // WEBRTC_HAVE_SCTP
} // namespace