diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /third_party/libwebrtc/media/base/codec.cc | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | third_party/libwebrtc/media/base/codec.cc | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/third_party/libwebrtc/media/base/codec.cc b/third_party/libwebrtc/media/base/codec.cc index c4e1c6f1f3..d18baf7132 100644 --- a/third_party/libwebrtc/media/base/codec.cc +++ b/third_party/libwebrtc/media/base/codec.cc @@ -15,6 +15,9 @@ #include "api/audio_codecs/audio_format.h" #include "api/video_codecs/av1_profile.h" #include "api/video_codecs/h264_profile_level_id.h" +#ifdef RTC_ENABLE_H265 +#include "api/video_codecs/h265_profile_tier_level.h" +#endif #include "api/video_codecs/vp9_profile.h" #include "media/base/media_constants.h" #include "rtc_base/checks.h" @@ -25,7 +28,8 @@ namespace cricket { namespace { -std::string GetH264PacketizationModeOrDefault(const CodecParameterMap& params) { +std::string GetH264PacketizationModeOrDefault( + const webrtc::CodecParameterMap& params) { auto it = params.find(kH264FmtpPacketizationMode); if (it != params.end()) { return it->second; @@ -35,18 +39,36 @@ std::string GetH264PacketizationModeOrDefault(const CodecParameterMap& params) { return "0"; } -bool IsSameH264PacketizationMode(const CodecParameterMap& left, - const CodecParameterMap& right) { +bool IsSameH264PacketizationMode(const webrtc::CodecParameterMap& left, + const webrtc::CodecParameterMap& right) { return GetH264PacketizationModeOrDefault(left) == GetH264PacketizationModeOrDefault(right); } +#ifdef RTC_ENABLE_H265 +std::string GetH265TxModeOrDefault(const webrtc::CodecParameterMap& params) { + auto it = params.find(kH265FmtpTxMode); + if (it != params.end()) { + return it->second; + } + // If TxMode is not present, a value of "SRST" must be inferred. + // https://tools.ietf.org/html/rfc7798@section-7.1 + return "SRST"; +} + +bool IsSameH265TxMode(const webrtc::CodecParameterMap& left, + const webrtc::CodecParameterMap& right) { + return absl::EqualsIgnoreCase(GetH265TxModeOrDefault(left), + GetH265TxModeOrDefault(right)); +} +#endif + // Some (video) codecs are actually families of codecs and rely on parameters // to distinguish different incompatible family members. bool IsSameCodecSpecific(const std::string& name1, - const CodecParameterMap& params1, + const webrtc::CodecParameterMap& params1, const std::string& name2, - const CodecParameterMap& params2) { + const webrtc::CodecParameterMap& params2) { // The names might not necessarily match, so check both. auto either_name_matches = [&](const std::string name) { return absl::EqualsIgnoreCase(name, name1) || @@ -59,6 +81,12 @@ bool IsSameCodecSpecific(const std::string& name1, return webrtc::VP9IsSameProfile(params1, params2); if (either_name_matches(kAv1CodecName)) return webrtc::AV1IsSameProfile(params1, params2); +#ifdef RTC_ENABLE_H265 + if (either_name_matches(kH265CodecName)) { + return webrtc::H265IsSameProfileTierLevel(params1, params2) && + IsSameH265TxMode(params1, params2); + } +#endif return true; } @@ -222,7 +250,7 @@ bool Codec::MatchesRtpCodec(const webrtc::RtpCodec& codec_capability) const { } bool Codec::GetParam(const std::string& name, std::string* out) const { - CodecParameterMap::const_iterator iter = params.find(name); + webrtc::CodecParameterMap::const_iterator iter = params.find(name); if (iter == params.end()) return false; *out = iter->second; @@ -230,7 +258,7 @@ bool Codec::GetParam(const std::string& name, std::string* out) const { } bool Codec::GetParam(const std::string& name, int* out) const { - CodecParameterMap::const_iterator iter = params.find(name); + webrtc::CodecParameterMap::const_iterator iter = params.find(name); if (iter == params.end()) return false; return rtc::FromString(iter->second, out); @@ -283,7 +311,8 @@ webrtc::RtpCodecParameters Codec::ToCodecParameters() const { } bool Codec::IsMediaCodec() const { - return !IsResiliencyCodec(); + return !IsResiliencyCodec() && + !absl::EqualsIgnoreCase(name, kComfortNoiseCodecName); } bool Codec::IsResiliencyCodec() const { |