Add default AV1 parameters to SdpVideoFormat comparison
BUG=webrtc:15703 Change-Id: Ib3195b61b27c38a27d851119cdbf55c679b839c8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/337540 Commit-Queue: Philipp Hancke <phancke@microsoft.com> Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41681}
This commit is contained in:
parent
5c7bc9fa02
commit
6de9d6add0
@ -29,14 +29,21 @@ namespace webrtc {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
std::string H264GetPacketizationModeOrDefault(const CodecParameterMap& params) {
|
std::string GetFmtpParameterOrDefault(const CodecParameterMap& params,
|
||||||
const auto it = params.find(cricket::kH264FmtpPacketizationMode);
|
const std::string& name,
|
||||||
|
const std::string& default_value) {
|
||||||
|
const auto it = params.find(name);
|
||||||
if (it != params.end()) {
|
if (it != params.end()) {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
return default_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string H264GetPacketizationModeOrDefault(const CodecParameterMap& params) {
|
||||||
// If packetization-mode is not present, default to "0".
|
// If packetization-mode is not present, default to "0".
|
||||||
// https://tools.ietf.org/html/rfc6184#section-6.2
|
// https://tools.ietf.org/html/rfc6184#section-6.2
|
||||||
return "0";
|
return GetFmtpParameterOrDefault(params, cricket::kH264FmtpPacketizationMode,
|
||||||
|
"0");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool H264IsSamePacketizationMode(const CodecParameterMap& left,
|
bool H264IsSamePacketizationMode(const CodecParameterMap& left,
|
||||||
@ -45,6 +52,28 @@ bool H264IsSamePacketizationMode(const CodecParameterMap& left,
|
|||||||
H264GetPacketizationModeOrDefault(right);
|
H264GetPacketizationModeOrDefault(right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string AV1GetTierOrDefault(const CodecParameterMap& params) {
|
||||||
|
// If the parameter is not present, the tier MUST be inferred to be 0.
|
||||||
|
// https://aomediacodec.github.io/av1-rtp-spec/#72-sdp-parameters
|
||||||
|
return GetFmtpParameterOrDefault(params, cricket::kAv1FmtpTier, "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AV1IsSameTier(const CodecParameterMap& left,
|
||||||
|
const CodecParameterMap& right) {
|
||||||
|
return AV1GetTierOrDefault(left) == AV1GetTierOrDefault(right);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AV1GetLevelIdxOrDefault(const CodecParameterMap& params) {
|
||||||
|
// If the parameter is not present, it MUST be inferred to be 5 (level 3.1).
|
||||||
|
// https://aomediacodec.github.io/av1-rtp-spec/#72-sdp-parameters
|
||||||
|
return GetFmtpParameterOrDefault(params, cricket::kAv1FmtpLevelIdx, "5");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AV1IsSameLevelIdx(const CodecParameterMap& left,
|
||||||
|
const CodecParameterMap& right) {
|
||||||
|
return AV1GetLevelIdxOrDefault(left) == AV1GetLevelIdxOrDefault(right);
|
||||||
|
}
|
||||||
|
|
||||||
// Some (video) codecs are actually families of codecs and rely on parameters
|
// Some (video) codecs are actually families of codecs and rely on parameters
|
||||||
// to distinguish different incompatible family members.
|
// to distinguish different incompatible family members.
|
||||||
bool IsSameCodecSpecific(const SdpVideoFormat& format1,
|
bool IsSameCodecSpecific(const SdpVideoFormat& format1,
|
||||||
@ -62,7 +91,9 @@ bool IsSameCodecSpecific(const SdpVideoFormat& format1,
|
|||||||
case kVideoCodecVP9:
|
case kVideoCodecVP9:
|
||||||
return VP9IsSameProfile(format1.parameters, format2.parameters);
|
return VP9IsSameProfile(format1.parameters, format2.parameters);
|
||||||
case kVideoCodecAV1:
|
case kVideoCodecAV1:
|
||||||
return AV1IsSameProfile(format1.parameters, format2.parameters);
|
return AV1IsSameProfile(format1.parameters, format2.parameters) &&
|
||||||
|
AV1IsSameTier(format1.parameters, format2.parameters) &&
|
||||||
|
AV1IsSameLevelIdx(format1.parameters, format2.parameters);
|
||||||
#ifdef RTC_ENABLE_H265
|
#ifdef RTC_ENABLE_H265
|
||||||
case kVideoCodecH265:
|
case kVideoCodecH265:
|
||||||
return H265IsSameProfileTierLevel(format1.parameters, format2.parameters);
|
return H265IsSameProfileTierLevel(format1.parameters, format2.parameters);
|
||||||
@ -71,6 +102,7 @@ bool IsSameCodecSpecific(const SdpVideoFormat& format1,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
SdpVideoFormat::SdpVideoFormat(const std::string& name) : name(name) {}
|
SdpVideoFormat::SdpVideoFormat(const std::string& name) : name(name) {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user