Skip to content

Commit

Permalink
Bug 1892299 - Vendor libwebrtc from db2f52ba88
Browse files Browse the repository at this point in the history
Upstream commit: https://webrtc.googlesource.com/src/+/db2f52ba88cf9f98211df2dabb3f8aca9251c4a2
    Reland "Make setCodecPreferences only look at receive codecs"

    This is a reland of commit 1cce1d7ddcbde3a3648007b5a131bd0c2638724b
    after updating the WPT that broke on Mac.

    Original change's description:
    > Make setCodecPreferences only look at receive codecs
    >
    > which is what is noted in JSEP:
    >   https://www.rfc-editor.org/rfc/rfc8829.html#name-setcodecpreferences
    >
    > Some W3C spec modifications are required since the W3C specification
    > currently takes into account send codecs as well.
    >
    > Spec issue:
    >   w3c/webrtc-pc#2888
    > Spec PR:
    >  w3c/webrtc-pc#2926
    >
    > setCodecPreferences continues to modify the codecs in an offer.
    >
    > Also rename RtpSender::SetCodecPreferences to RtpSender::SetSendCodecs for consistent semantics.
    >
    > BUG=webrtc:15396
    >
    > Change-Id: I1e8fbe77cb2670575578a777ed1336567a1e4031
    > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/328780
    > Reviewed-by: Henrik Boström <[email protected]>
    > Commit-Queue: Philipp Hancke <[email protected]>
    > Reviewed-by: Harald Alvestrand <[email protected]>
    > Cr-Commit-Position: refs/heads/main@{#41719}

    Bug: webrtc:15396
    Change-Id: I0c7b17f00de02286f176b500460e17980b83b35b
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339541
    Commit-Queue: Philipp Hancke <[email protected]>
    Reviewed-by: Harald Alvestrand <[email protected]>
    Cr-Commit-Position: refs/heads/main@{#41807}
  • Loading branch information
na-g committed Apr 26, 2024
1 parent 509171c commit 29f7e69
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 228 deletions.
3 changes: 3 additions & 0 deletions third_party/libwebrtc/README.moz-ff-commit
Original file line number Diff line number Diff line change
Expand Up @@ -29175,3 +29175,6 @@ c7a4b2a7eb
# MOZ_LIBWEBRTC_SRC=/Users/ng/dev/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
d99499abba
# MOZ_LIBWEBRTC_SRC=/Users/ng/dev/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
db2f52ba88
2 changes: 2 additions & 0 deletions third_party/libwebrtc/README.mozilla
Original file line number Diff line number Diff line change
Expand Up @@ -19474,3 +19474,5 @@ libwebrtc updated from /Users/ng/dev/elm/.moz-fast-forward/moz-libwebrtc commit
libwebrtc updated from /Users/ng/dev/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-04-26T08:10:12.207928.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/ng/dev/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /Users/ng/dev/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-04-26T16:16:56.695304.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/ng/dev/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /Users/ng/dev/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-04-26T16:18:10.249663.
18 changes: 8 additions & 10 deletions third_party/libwebrtc/media/base/media_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ std::vector<webrtc::RtpExtension> GetDefaultEnabledRtpHeaderExtensions(

webrtc::RTCError CheckScalabilityModeValues(
const webrtc::RtpParameters& rtp_parameters,
rtc::ArrayView<cricket::Codec> codec_preferences,
rtc::ArrayView<cricket::Codec> send_codecs,
absl::optional<cricket::Codec> send_codec) {
using webrtc::RTCErrorType;

if (codec_preferences.empty()) {
if (send_codecs.empty()) {
// This is an audio sender or an extra check in the stack where the codec
// list is not available and we can't check the scalability_mode values.
return webrtc::RTCError::OK();
Expand All @@ -80,7 +80,7 @@ webrtc::RTCError CheckScalabilityModeValues(
for (size_t i = 0; i < rtp_parameters.encodings.size(); ++i) {
if (rtp_parameters.encodings[i].codec) {
bool codecFound = false;
for (const cricket::VideoCodec& codec : codec_preferences) {
for (const cricket::Codec& codec : send_codecs) {
if (codec.MatchesRtpCodec(*rtp_parameters.encodings[i].codec)) {
codecFound = true;
send_codec = codec;
Expand All @@ -97,7 +97,7 @@ webrtc::RTCError CheckScalabilityModeValues(
if (rtp_parameters.encodings[i].scalability_mode) {
if (!send_codec) {
bool scalabilityModeFound = false;
for (const cricket::VideoCodec& codec : codec_preferences) {
for (const cricket::Codec& codec : send_codecs) {
for (const auto& scalability_mode : codec.scalability_modes) {
if (ScalabilityModeToString(scalability_mode) ==
*rtp_parameters.encodings[i].scalability_mode) {
Expand Down Expand Up @@ -139,7 +139,7 @@ webrtc::RTCError CheckScalabilityModeValues(

webrtc::RTCError CheckRtpParametersValues(
const webrtc::RtpParameters& rtp_parameters,
rtc::ArrayView<cricket::Codec> codec_preferences,
rtc::ArrayView<cricket::Codec> send_codecs,
absl::optional<cricket::Codec> send_codec) {
using webrtc::RTCErrorType;

Expand Down Expand Up @@ -196,8 +196,7 @@ webrtc::RTCError CheckRtpParametersValues(
}
}

return CheckScalabilityModeValues(rtp_parameters, codec_preferences,
send_codec);
return CheckScalabilityModeValues(rtp_parameters, send_codecs, send_codec);
}

webrtc::RTCError CheckRtpParametersInvalidModificationAndValues(
Expand All @@ -210,7 +209,7 @@ webrtc::RTCError CheckRtpParametersInvalidModificationAndValues(
webrtc::RTCError CheckRtpParametersInvalidModificationAndValues(
const webrtc::RtpParameters& old_rtp_parameters,
const webrtc::RtpParameters& rtp_parameters,
rtc::ArrayView<cricket::Codec> codec_preferences,
rtc::ArrayView<cricket::Codec> send_codecs,
absl::optional<cricket::Codec> send_codec) {
using webrtc::RTCErrorType;
if (rtp_parameters.encodings.size() != old_rtp_parameters.encodings.size()) {
Expand Down Expand Up @@ -246,8 +245,7 @@ webrtc::RTCError CheckRtpParametersInvalidModificationAndValues(
"Attempted to set RtpParameters with modified SSRC");
}

return CheckRtpParametersValues(rtp_parameters, codec_preferences,
send_codec);
return CheckRtpParametersValues(rtp_parameters, send_codecs, send_codec);
}

CompositeMediaEngine::CompositeMediaEngine(
Expand Down
6 changes: 3 additions & 3 deletions third_party/libwebrtc/media/base/media_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@ namespace cricket {
// least one video codec of the list. If the list is empty, no check is done.
webrtc::RTCError CheckScalabilityModeValues(
const webrtc::RtpParameters& new_parameters,
rtc::ArrayView<cricket::Codec> codec_preferences,
rtc::ArrayView<cricket::Codec> send_codecs,
absl::optional<cricket::Codec> send_codec);

// Checks the parameters have valid and supported values, and checks parameters
// with CheckScalabilityModeValues().
webrtc::RTCError CheckRtpParametersValues(
const webrtc::RtpParameters& new_parameters,
rtc::ArrayView<cricket::Codec> codec_preferences,
rtc::ArrayView<cricket::Codec> send_codecs,
absl::optional<cricket::Codec> send_codec);

// Checks that the immutable values have not changed in new_parameters and
// checks all parameters with CheckRtpParametersValues().
webrtc::RTCError CheckRtpParametersInvalidModificationAndValues(
const webrtc::RtpParameters& old_parameters,
const webrtc::RtpParameters& new_parameters,
rtc::ArrayView<cricket::Codec> codec_preferences,
rtc::ArrayView<cricket::Codec> send_codecs,
absl::optional<cricket::Codec> send_codec);

// Checks that the immutable values have not changed in new_parameters and
Expand Down
Loading

0 comments on commit 29f7e69

Please sign in to comment.