commit 6b65f78d1d636d66ae7a6996d1df6aa1b428d05e
parent 03b229a0d1b6c9dc764002fe282d0e9b265ee409
Author: Dan Baker <dbaker@mozilla.com>
Date: Tue, 2 Dec 2025 00:32:45 -0700
Bug 2000941 - Vendor libwebrtc from a8fc9d940f
Upstream commit: https://webrtc.googlesource.com/src/+/a8fc9d940f64604cc45a64eb536435b9f24d0523
Reland "Store a raw_packetization bool in RtpSenderVideo rather than inferring"
This reverts commit 37ba143ad7d89961d109c91448dd284d16397cbd.
Reason for revert: Reland without the CHECK to allow changing downstream to set RTPSenderVideo::Config::raw_packetization rather than calling SendVideo with an absent codec_type.
Original change's description:
> Revert "Store a raw_packetization bool in RtpSenderVideo rather than inferring"
>
> This reverts commit fc1cbcf05221bf26b6fa94ecb018a5225060ddb4.
>
> Reason for revert: Reverting while we figure out why the check is triggering downstream
>
> Original change's description:
> > Store a raw_packetization bool in RtpSenderVideo rather than inferring
> >
> > Ensure all calls to SendVideo() use a raw packetizer when they should
> > rather than inferring it from the absence of |codec_type| - an issue
> > when the caller doesn't know the correct packetization (eg
> > RTPSenderVideoFrameTransformerDelegate).
> >
> > Bug: b/446768451
> > Change-Id: Ib628d69ac1697de63cc293c5f4c681d6450f72d9
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/411560
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Auto-Submit: Tony Herre <herre@google.com>
> > Reviewed-by: Henrik Boström <hbos@webrtc.org>
> > Commit-Queue: Henrik Boström <hbos@webrtc.org>
> > Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#45724}
>
> Bug: b/446768451
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Change-Id: I456daecded27f9e52e126b8e5760238704f67300
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/411940
> Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#45731}
Bug: b/446768451
Change-Id: I828c13259c99a6b973c510d20b8646258454d25e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/412000
Commit-Queue: Tony Herre <herre@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Auto-Submit: Tony Herre <herre@google.com>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45736}
Diffstat:
7 files changed, 48 insertions(+), 12 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-12-02T07:28:48.145910+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T07:32:31.832700+00:00.
# base of lastest vendoring
-73282ed449
+a8fc9d940f
diff --git a/third_party/libwebrtc/call/rtp_video_sender.cc b/third_party/libwebrtc/call/rtp_video_sender.cc
@@ -324,6 +324,8 @@ std::vector<RtpStreamSender> CreateRtpStreamSenders(
}
video_config.frame_transformer = frame_transformer;
video_config.task_queue_factory = &env.task_queue_factory();
+ video_config.raw_packetization = rtp_config.raw_payload;
+
auto sender_video = std::make_unique<RTPSenderVideo>(video_config);
rtp_streams.emplace_back(std::move(rtp_rtcp), std::move(sender_video),
std::move(fec_generator));
diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video.cc
@@ -177,6 +177,7 @@ RTPSenderVideo::RTPSenderVideo(const Config& config)
require_frame_encryption_(config.require_frame_encryption),
generic_descriptor_auth_experiment_(
!config.field_trials->IsDisabled("WebRTC-GenericDescriptorAuth")),
+ raw_packetization_(config.raw_packetization),
absolute_capture_time_sender_(config.clock),
frame_transformer_delegate_(
config.frame_transformer
@@ -499,6 +500,9 @@ bool RTPSenderVideo::SendVideo(int payload_type,
std::vector<uint32_t> csrcs) {
RTC_CHECK_RUNS_SERIALIZED(&send_checker_);
+ // TODO(b/446768451): Add a check that Codec type can only be absent when
+ // using raw packetization once downstream projects have been updated.
+
if (video_header.frame_type == VideoFrameType::kEmptyFrame)
return true;
@@ -675,7 +679,8 @@ bool RTPSenderVideo::SendVideo(int payload_type,
}
std::unique_ptr<RtpPacketizer> packetizer =
- RtpPacketizer::Create(codec_type, payload, limits, video_header);
+ RtpPacketizer::Create(raw_packetization_ ? std::nullopt : codec_type,
+ payload, limits, video_header);
const size_t num_packets = packetizer->NumPackets();
diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video.h b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video.h
@@ -90,6 +90,7 @@ class RTPSenderVideo : public RTPVideoFrameSenderInterface {
const FieldTrialsView* field_trials = nullptr;
scoped_refptr<FrameTransformerInterface> frame_transformer;
TaskQueueFactory* task_queue_factory = nullptr;
+ bool raw_packetization = false;
};
explicit RTPSenderVideo(const Config& config);
@@ -249,6 +250,8 @@ class RTPSenderVideo : public RTPVideoFrameSenderInterface {
// Set to true if the generic descriptor should be authenticated.
const bool generic_descriptor_auth_experiment_;
+ const bool raw_packetization_;
+
AbsoluteCaptureTimeSender absolute_capture_time_sender_
RTC_GUARDED_BY(send_checker_);
// Tracks updates to the active decode targets and decides when active decode
diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc
@@ -166,12 +166,14 @@ class TestRtpSenderVideo : public RTPSenderVideo {
public:
TestRtpSenderVideo(Clock* clock,
RTPSender* rtp_sender,
- const FieldTrialsView& field_trials)
+ const FieldTrialsView& field_trials,
+ bool raw_packetization)
: RTPSenderVideo([&] {
Config config;
config.clock = clock;
config.rtp_sender = rtp_sender;
config.field_trials = &field_trials;
+ config.raw_packetization = raw_packetization;
return config;
}()) {}
~TestRtpSenderVideo() override {}
@@ -187,7 +189,7 @@ class TestRtpSenderVideo : public RTPSenderVideo {
class RtpSenderVideoTest : public ::testing::Test {
public:
- RtpSenderVideoTest()
+ explicit RtpSenderVideoTest(bool raw_packetization = false)
: fake_clock_(kStartTime),
env_(CreateEnvironment(&fake_clock_)),
retransmission_rate_limiter_(&fake_clock_, 1000),
@@ -201,7 +203,8 @@ class RtpSenderVideoTest : public ::testing::Test {
rtp_sender_video_(
std::make_unique<TestRtpSenderVideo>(&fake_clock_,
rtp_module_.RtpSender(),
- env_.field_trials())) {
+ env_.field_trials(),
+ raw_packetization)) {
rtp_module_.SetSequenceNumber(kSeqNum);
rtp_module_.SetStartTimestamp(0);
}
@@ -1356,7 +1359,8 @@ TEST_F(RtpSenderVideoTest,
TEST_F(RtpSenderVideoTest, AbsoluteCaptureTime) {
rtp_sender_video_ = std::make_unique<TestRtpSenderVideo>(
- &fake_clock_, rtp_module_.RtpSender(), env_.field_trials());
+ &fake_clock_, rtp_module_.RtpSender(), env_.field_trials(),
+ /*raw_packetization=*/false);
constexpr Timestamp kAbsoluteCaptureTimestamp = Timestamp::Millis(12345678);
uint8_t kFrame[kMaxPacketLength];
@@ -1522,7 +1526,12 @@ TEST_F(RtpSenderVideoTest, SendGenericVideo) {
EXPECT_THAT(sent_payload.subview(1), ElementsAreArray(kDeltaPayload));
}
-TEST_F(RtpSenderVideoTest, SendRawVideo) {
+class RtpSenderVideoRawPacketizationTest : public RtpSenderVideoTest {
+ public:
+ RtpSenderVideoRawPacketizationTest() : RtpSenderVideoTest(true) {}
+};
+
+TEST_F(RtpSenderVideoRawPacketizationTest, SendRawVideo) {
const uint8_t kPayloadTypeRaw = 111;
const uint8_t kPayload[] = {11, 22, 33, 44, 55};
@@ -1538,6 +1547,23 @@ TEST_F(RtpSenderVideoTest, SendRawVideo) {
EXPECT_THAT(sent_payload, ElementsAreArray(kPayload));
}
+TEST_F(RtpSenderVideoRawPacketizationTest, SendVideoWithSetCodecTypeStillRaw) {
+ const uint8_t kPayloadTypeRaw = 111;
+ const uint8_t kPayload[] = {11, 22, 33, 44, 55};
+
+ // Send a frame with codectype "generic"
+ RTPVideoHeader video_header;
+ video_header.frame_type = VideoFrameType::kVideoFrameKey;
+ ASSERT_TRUE(rtp_sender_video_->SendVideo(
+ kPayloadTypeRaw, VideoCodecType::kVideoCodecGeneric, 1234,
+ fake_clock_.CurrentTime(), kPayload, sizeof(kPayload), video_header,
+ TimeDelta::PlusInfinity(), {}));
+
+ // Should still be packetized as raw.
+ EXPECT_THAT(transport_.last_sent_packet().payload(),
+ ElementsAreArray(kPayload));
+}
+
class RtpSenderVideoWithFrameTransformerTest : public ::testing::Test {
public:
RtpSenderVideoWithFrameTransformerTest()
diff --git a/third_party/libwebrtc/moz-patch-stack/s0072.patch b/third_party/libwebrtc/moz-patch-stack/s0072.patch
@@ -45,10 +45,10 @@ index 80c1c84043..2c900dde28 100644
return flexfec_ssrc_;
}
diff --git a/modules/rtp_rtcp/source/rtp_sender_video.cc b/modules/rtp_rtcp/source/rtp_sender_video.cc
-index ee7414b582..d8c46a5819 100644
+index f5ea03a158..1cd415a9aa 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video.cc
-@@ -184,6 +184,7 @@ RTPSenderVideo::RTPSenderVideo(const Config& config)
+@@ -185,6 +185,7 @@ RTPSenderVideo::RTPSenderVideo(const Config& config)
this,
config.frame_transformer,
rtp_sender_->SSRC(),
diff --git a/third_party/libwebrtc/moz-patch-stack/s0082.patch b/third_party/libwebrtc/moz-patch-stack/s0082.patch
@@ -18,10 +18,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d92a578327f524ec3
4 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/call/rtp_video_sender.cc b/call/rtp_video_sender.cc
-index 25cc81396c..4fa0e8c5e7 100644
+index 78144121d1..3829abcee1 100644
--- a/call/rtp_video_sender.cc
+++ b/call/rtp_video_sender.cc
-@@ -534,6 +534,7 @@ void RtpVideoSender::SetModuleIsActive(bool sending,
+@@ -536,6 +536,7 @@ void RtpVideoSender::SetModuleIsActive(bool sending,
return;
}