diff options
Diffstat (limited to 'third_party/libwebrtc/media/base/sdp_video_format_utils_unittest.cc')
-rw-r--r-- | third_party/libwebrtc/media/base/sdp_video_format_utils_unittest.cc | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/third_party/libwebrtc/media/base/sdp_video_format_utils_unittest.cc b/third_party/libwebrtc/media/base/sdp_video_format_utils_unittest.cc index d8ef9ab827..9f505c19d7 100644 --- a/third_party/libwebrtc/media/base/sdp_video_format_utils_unittest.cc +++ b/third_party/libwebrtc/media/base/sdp_video_format_utils_unittest.cc @@ -27,29 +27,28 @@ const char kVPxFmtpMaxFrameSize[] = "max-fs"; } // namespace TEST(SdpVideoFormatUtilsTest, TestH264GenerateProfileLevelIdForAnswerEmpty) { - SdpVideoFormat::Parameters answer_params; - H264GenerateProfileLevelIdForAnswer(SdpVideoFormat::Parameters(), - SdpVideoFormat::Parameters(), + CodecParameterMap answer_params; + H264GenerateProfileLevelIdForAnswer(CodecParameterMap(), CodecParameterMap(), &answer_params); EXPECT_TRUE(answer_params.empty()); } TEST(SdpVideoFormatUtilsTest, TestH264GenerateProfileLevelIdForAnswerLevelSymmetryCapped) { - SdpVideoFormat::Parameters low_level; + CodecParameterMap low_level; low_level["profile-level-id"] = "42e015"; - SdpVideoFormat::Parameters high_level; + CodecParameterMap high_level; high_level["profile-level-id"] = "42e01f"; // Level asymmetry is not allowed; test that answer level is the lower of the // local and remote levels. - SdpVideoFormat::Parameters answer_params; + CodecParameterMap answer_params; H264GenerateProfileLevelIdForAnswer(low_level /* local_supported */, high_level /* remote_offered */, &answer_params); EXPECT_EQ("42e015", answer_params["profile-level-id"]); - SdpVideoFormat::Parameters answer_params2; + CodecParameterMap answer_params2; H264GenerateProfileLevelIdForAnswer(high_level /* local_supported */, low_level /* remote_offered */, &answer_params2); @@ -58,13 +57,13 @@ TEST(SdpVideoFormatUtilsTest, TEST(SdpVideoFormatUtilsTest, TestH264GenerateProfileLevelIdForAnswerConstrainedBaselineLevelAsymmetry) { - SdpVideoFormat::Parameters local_params; + CodecParameterMap local_params; local_params["profile-level-id"] = "42e01f"; local_params["level-asymmetry-allowed"] = "1"; - SdpVideoFormat::Parameters remote_params; + CodecParameterMap remote_params; remote_params["profile-level-id"] = "42e015"; remote_params["level-asymmetry-allowed"] = "1"; - SdpVideoFormat::Parameters answer_params; + CodecParameterMap answer_params; H264GenerateProfileLevelIdForAnswer(local_params, remote_params, &answer_params); // When level asymmetry is allowed, we can answer a higher level than what was @@ -72,8 +71,38 @@ TEST(SdpVideoFormatUtilsTest, EXPECT_EQ("42e01f", answer_params["profile-level-id"]); } +#ifdef RTC_ENABLE_H265 +// Answer should not include explicit PTL info if neither local nor remote set +// any of them. +TEST(SdpVideoFormatUtilsTest, H265GenerateProfileTierLevelEmpty) { + CodecParameterMap answer_params; + H265GenerateProfileTierLevelForAnswer(CodecParameterMap(), + CodecParameterMap(), &answer_params); + EXPECT_TRUE(answer_params.empty()); +} + +// Answer must use the minimum level as supported by both local and remote. +TEST(SdpVideoFormatUtilsTest, H265GenerateProfileTierLevelNoEmpty) { + constexpr char kLocallySupportedLevelId[] = "93"; + constexpr char kRemoteOfferedLevelId[] = "120"; + + CodecParameterMap local_params; + local_params["profile-id"] = "1"; + local_params["tier-flag"] = "0"; + local_params["level-id"] = kLocallySupportedLevelId; + CodecParameterMap remote_params; + remote_params["profile-id"] = "1"; + remote_params["tier-flag"] = "0"; + remote_params["level-id"] = kRemoteOfferedLevelId; + CodecParameterMap answer_params; + H265GenerateProfileTierLevelForAnswer(local_params, remote_params, + &answer_params); + EXPECT_EQ(kLocallySupportedLevelId, answer_params["level-id"]); +} +#endif + TEST(SdpVideoFormatUtilsTest, MaxFrameRateIsMissingOrInvalid) { - SdpVideoFormat::Parameters params; + CodecParameterMap params; absl::optional<int> empty = ParseSdpForVPxMaxFrameRate(params); EXPECT_FALSE(empty); params[kVPxFmtpMaxFrameRate] = "-1"; @@ -85,7 +114,7 @@ TEST(SdpVideoFormatUtilsTest, MaxFrameRateIsMissingOrInvalid) { } TEST(SdpVideoFormatUtilsTest, MaxFrameRateIsSpecified) { - SdpVideoFormat::Parameters params; + CodecParameterMap params; params[kVPxFmtpMaxFrameRate] = "30"; EXPECT_EQ(ParseSdpForVPxMaxFrameRate(params), 30); params[kVPxFmtpMaxFrameRate] = "60"; @@ -93,7 +122,7 @@ TEST(SdpVideoFormatUtilsTest, MaxFrameRateIsSpecified) { } TEST(SdpVideoFormatUtilsTest, MaxFrameSizeIsMissingOrInvalid) { - SdpVideoFormat::Parameters params; + CodecParameterMap params; absl::optional<int> empty = ParseSdpForVPxMaxFrameSize(params); EXPECT_FALSE(empty); params[kVPxFmtpMaxFrameSize] = "-1"; @@ -105,7 +134,7 @@ TEST(SdpVideoFormatUtilsTest, MaxFrameSizeIsMissingOrInvalid) { } TEST(SdpVideoFormatUtilsTest, MaxFrameSizeIsSpecified) { - SdpVideoFormat::Parameters params; + CodecParameterMap params; params[kVPxFmtpMaxFrameSize] = "8100"; // 1920 x 1080 / (16^2) EXPECT_EQ(ParseSdpForVPxMaxFrameSize(params), 1920 * 1080); params[kVPxFmtpMaxFrameSize] = "32400"; // 3840 x 2160 / (16^2) |