Skip to content

Commit

Permalink
Bug 1892299 - Vendor libwebrtc from a55ff9e83e
Browse files Browse the repository at this point in the history
Upstream commit: https://webrtc.googlesource.com/src/+/a55ff9e83e4592010969d428bee656bace8cbc3b
    [M124] Use predefined SdpVideoFormats when returning supported formats

    The predefined SdpVideoFormats were not used everywhere,
    which caused a discrepancy between send/receive capabilities
    for AV1. This CL solves the immediate problems by making sure
    send/receive capabilities for AV1 are reported the same way.

    (cherry picked from commit 82598402e095ec6638b6cf3dc8e7f6d35cc3d737)

    Fixed: chromium:331565934
    Change-Id: I073091b7b5f987c7f434c17276fd84047ec723c2
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/344681
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Commit-Queue: Johannes Kron <kron@webrtc.org>
    Cr-Original-Commit-Position: refs/heads/main@{#41991}
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/348720
    Cr-Commit-Position: refs/branch-heads/6367@{#3}
    Cr-Branched-From: 802552a8030d82ad07b72aa738f814f3a0030810-refs/heads/main@{#41921}
  • Loading branch information
na-g committed May 2, 2024

Verified

This commit was signed with the committer’s verified signature.
wezm Wesley Moore
1 parent 70c140f commit 56f295d
Showing 9 changed files with 32 additions and 21 deletions.
3 changes: 3 additions & 0 deletions third_party/libwebrtc/README.moz-ff-commit
Original file line number Diff line number Diff line change
@@ -29526,3 +29526,6 @@ bdb867f163
# 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
93e9ac6285
# 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
a55ff9e83e
2 changes: 2 additions & 0 deletions third_party/libwebrtc/README.mozilla
Original file line number Diff line number Diff line change
@@ -19708,3 +19708,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-05-02T09:54:14.297719.
# ./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-05-02T09:55:22.721893.
# ./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-05-02T09:56:37.029156.
7 changes: 7 additions & 0 deletions third_party/libwebrtc/api/video_codecs/sdp_video_format.cc
Original file line number Diff line number Diff line change
@@ -138,6 +138,13 @@ SdpVideoFormat::SdpVideoFormat(
parameters(parameters),
scalability_modes(scalability_modes) {}

SdpVideoFormat::SdpVideoFormat(
const SdpVideoFormat& format,
const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>& modes)
: SdpVideoFormat(format) {
scalability_modes = modes;
}

SdpVideoFormat::SdpVideoFormat(const SdpVideoFormat&) = default;
SdpVideoFormat::SdpVideoFormat(SdpVideoFormat&&) = default;
SdpVideoFormat& SdpVideoFormat::operator=(const SdpVideoFormat&) = default;
8 changes: 8 additions & 0 deletions third_party/libwebrtc/api/video_codecs/sdp_video_format.h
Original file line number Diff line number Diff line change
@@ -36,6 +36,14 @@ struct RTC_EXPORT SdpVideoFormat {
const CodecParameterMap& parameters,
const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>&
scalability_modes);
// Creates a new SdpVideoFormat object identical to the supplied
// SdpVideoFormat except the scalability_modes that are set to be the same as
// the supplied scalability modes.
SdpVideoFormat(
const SdpVideoFormat& format,
const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>&
scalability_modes);

SdpVideoFormat(const SdpVideoFormat&);
SdpVideoFormat(SdpVideoFormat&&);
SdpVideoFormat& operator=(const SdpVideoFormat&);
Original file line number Diff line number Diff line change
@@ -21,10 +21,7 @@
namespace webrtc {
struct Dav1dDecoderTemplateAdapter {
static std::vector<SdpVideoFormat> SupportedFormats() {
return {SdpVideoFormat("AV1"),
SdpVideoFormat(
"AV1", {{"profile",
AV1ProfileToString(AV1Profile::kProfile1).data()}})};
return {SdpVideoFormat::AV1Profile0(), SdpVideoFormat::AV1Profile1()};
}

static std::unique_ptr<VideoDecoder> CreateDecoder(
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ struct LibaomAv1EncoderTemplateAdapter {
static std::vector<SdpVideoFormat> SupportedFormats() {
absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>
scalability_modes = LibaomAv1EncoderSupportedScalabilityModes();
return {SdpVideoFormat("AV1", CodecParameterMap(), scalability_modes)};
return {SdpVideoFormat(SdpVideoFormat::AV1Profile0(), scalability_modes)};
}

static std::unique_ptr<VideoEncoder> CreateEncoder(
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ struct LibvpxVp8EncoderTemplateAdapter {
scalability_modes.push_back(scalability_mode);
}

return {SdpVideoFormat("VP8", CodecParameterMap(), scalability_modes)};
return {SdpVideoFormat(SdpVideoFormat::VP8(), scalability_modes)};
}

static std::unique_ptr<VideoEncoder> CreateEncoder(
Original file line number Diff line number Diff line change
@@ -178,7 +178,9 @@ SdpVideoFormat CreateSdpVideoFormat(

return SdpVideoFormat(config.codec_name, codec_params);
} else if (config.codec_settings.codecType == kVideoCodecVP9) {
return SdpVideoFormat(config.codec_name, {{"profile-id", "0"}});
return SdpVideoFormat::VP9Profile0();
} else if (config.codec_settings.codecType == kVideoCodecAV1) {
return SdpVideoFormat::AV1Profile0();
}

return SdpVideoFormat(config.codec_name);
20 changes: 6 additions & 14 deletions third_party/libwebrtc/modules/video_coding/codecs/vp9/vp9.cc
Original file line number Diff line number Diff line change
@@ -46,15 +46,11 @@ std::vector<SdpVideoFormat> SupportedVP9Codecs(bool add_scalability_modes) {
}
}
}
std::vector<SdpVideoFormat> supported_formats{SdpVideoFormat(
cricket::kVp9CodecName,
{{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}},
scalability_modes)};
std::vector<SdpVideoFormat> supported_formats{
SdpVideoFormat(SdpVideoFormat::VP9Profile0(), scalability_modes)};
if (vpx_supports_high_bit_depth) {
supported_formats.push_back(SdpVideoFormat(
cricket::kVp9CodecName,
{{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile2)}},
scalability_modes));
supported_formats.push_back(
SdpVideoFormat(SdpVideoFormat::VP9Profile2(), scalability_modes));
}

return supported_formats;
@@ -69,12 +65,8 @@ std::vector<SdpVideoFormat> SupportedVP9DecoderCodecs() {
// The WebRTC internal decoder supports VP9 profile 1 and 3. However, there's
// currently no way of sending VP9 profile 1 or 3 using the internal encoder.
// It would require extended support for I444, I422, and I440 buffers.
supported_formats.push_back(SdpVideoFormat(
cricket::kVp9CodecName,
{{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile1)}}));
supported_formats.push_back(SdpVideoFormat(
cricket::kVp9CodecName,
{{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile3)}}));
supported_formats.push_back(SdpVideoFormat::VP9Profile1());
supported_formats.push_back(SdpVideoFormat::VP9Profile3());
return supported_formats;
#else
return std::vector<SdpVideoFormat>();

0 comments on commit 56f295d

Please sign in to comment.