SetOfferedRtpHeaderExtensions: fix error code.
For the case where an unknown header extension URI is attempted
to be modified by SetOfferedRtpHeaderExtensions, WebRTC emitted
INVALID_PARAMETER. Fix this by emitting UNSUPPORTED_PARAMETER.
Bug: chromium:1051821
Change-Id: I98b68e1e3a3f90f9cfa0d45833f46a307c246ad0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/201733
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32983}
diff --git a/pc/rtp_transceiver.cc b/pc/rtp_transceiver.cc
index 9e62f95..d11e04b 100644
--- a/pc/rtp_transceiver.cc
+++ b/pc/rtp_transceiver.cc
@@ -485,7 +485,7 @@
header_extensions_to_offer_.begin(), header_extensions_to_offer_.end(),
[&entry](const auto& offered) { return entry.uri == offered.uri; });
if (it == header_extensions_to_offer_.end()) {
- return RTCError(RTCErrorType::INVALID_PARAMETER,
+ return RTCError(RTCErrorType::UNSUPPORTED_PARAMETER,
"Attempted to modify an unoffered extension.");
}
diff --git a/pc/rtp_transceiver_unittest.cc b/pc/rtp_transceiver_unittest.cc
index 91e1aa3..7b72620 100644
--- a/pc/rtp_transceiver_unittest.cc
+++ b/pc/rtp_transceiver_unittest.cc
@@ -186,7 +186,7 @@
{RtpHeaderExtensionCapability("uri3", 1,
RtpTransceiverDirection::kSendRecv)});
EXPECT_THAT(transceiver_.SetOfferedRtpHeaderExtensions(modified_extensions),
- Property(&RTCError::type, RTCErrorType::INVALID_PARAMETER));
+ Property(&RTCError::type, RTCErrorType::UNSUPPORTED_PARAMETER));
EXPECT_EQ(transceiver_.HeaderExtensionsToOffer(), extensions_);
}