Update RED PT in SetProtectionPayloadTypes
Update of red_payload_type_ was unintentionally removed in https://webrtc-review.googlesource.com/c/src/+/271640/5 which led to rejecting of video packets if RED payload changes.
Bug: webrtc:11993, b/255730463
Change-Id: I58635dd6c76689b01fd88d6c5c717b56493e7270
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/281260
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38521}
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 2d82bcf..169aeb4 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -1047,6 +1047,7 @@
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
RTC_DCHECK(red_payload_type >= -1 && red_payload_type < 0x80);
RTC_DCHECK(ulpfec_payload_type >= -1 && ulpfec_payload_type < 0x80);
+ red_payload_type_ = red_payload_type;
ulpfec_receiver_ = MaybeConstructUlpfecReceiver(
config_.rtp.remote_ssrc, red_payload_type, ulpfec_payload_type,
config_.rtp.extensions, this, clock_);
diff --git a/video/rtp_video_stream_receiver2_unittest.cc b/video/rtp_video_stream_receiver2_unittest.cc
index 325188e..2ffe478 100644
--- a/video/rtp_video_stream_receiver2_unittest.cc
+++ b/video/rtp_video_stream_receiver2_unittest.cc
@@ -371,6 +371,16 @@
video_header);
}
+TEST_F(RtpVideoStreamReceiver2Test, SetProtectionPayloadTypes) {
+ EXPECT_NE(rtp_video_stream_receiver_->red_payload_type(), 104);
+ EXPECT_NE(rtp_video_stream_receiver_->ulpfec_payload_type(), 107);
+
+ rtp_video_stream_receiver_->SetProtectionPayloadTypes(104, 107);
+
+ EXPECT_EQ(rtp_video_stream_receiver_->red_payload_type(), 104);
+ EXPECT_EQ(rtp_video_stream_receiver_->ulpfec_payload_type(), 107);
+}
+
TEST_F(RtpVideoStreamReceiver2Test, PacketInfoIsPropagatedIntoVideoFrames) {
constexpr uint64_t kAbsoluteCaptureTimestamp = 12;
constexpr int kId0 = 1;