Add test for payload type H.264 profile-level-id behavior

Bug: webrtc:360058654
Change-Id: I055af71c455e398af88c77584734d66a207d43b2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370844
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43537}
This commit is contained in:
Harald Alvestrand 2024-12-10 12:47:47 +00:00 committed by WebRTC LUCI CQ
parent b97cbbcde4
commit afe5d2f758

View File

@ -13,10 +13,14 @@
#include "call/payload_type.h" #include "call/payload_type.h"
#include "media/base/codec.h" #include "media/base/codec.h"
#include "media/base/media_constants.h" #include "media/base/media_constants.h"
#include "test/gmock.h"
#include "test/gtest.h" #include "test/gtest.h"
namespace webrtc { namespace webrtc {
using testing::Eq;
using testing::Ne;
TEST(PayloadTypePicker, PayloadTypeAssignmentWorks) { TEST(PayloadTypePicker, PayloadTypeAssignmentWorks) {
// Note: This behavior is due to be deprecated and removed. // Note: This behavior is due to be deprecated and removed.
PayloadType pt_a(1); PayloadType pt_a(1);
@ -174,4 +178,27 @@ TEST(PayloadTypePicker, RecordedValueExcluded) {
EXPECT_NE(47, result.value()); EXPECT_NE(47, result.value());
} }
TEST(PayloadTypePicker, ChoosingH264Profiles) {
// No opinion on whether these are right or wrong, just that their
// behavior is consistent.
PayloadTypePicker picker;
cricket::Codec h264_constrained = cricket::CreateVideoCodec(SdpVideoFormat(
cricket::kH264CodecName, {{cricket::kH264FmtpProfileLevelId, "42e01f"},
{cricket::kH264FmtpLevelAsymmetryAllowed, "1"},
{cricket::kH264FmtpPacketizationMode, "1"}}));
cricket::Codec h264_high_1f = cricket::CreateVideoCodec(SdpVideoFormat(
cricket::kH264CodecName, {{cricket::kH264FmtpProfileLevelId, "640c1f"},
{cricket::kH264FmtpLevelAsymmetryAllowed, "1"},
{cricket::kH264FmtpPacketizationMode, "1"}}));
cricket::Codec h264_high_2a = cricket::CreateVideoCodec(SdpVideoFormat(
cricket::kH264CodecName, {{cricket::kH264FmtpProfileLevelId, "640c2a"},
{cricket::kH264FmtpLevelAsymmetryAllowed, "1"},
{cricket::kH264FmtpPacketizationMode, "1"}}));
PayloadType pt_constrained =
picker.SuggestMapping(h264_constrained, nullptr).value();
PayloadType pt_high_1f = picker.SuggestMapping(h264_high_1f, nullptr).value();
PayloadType pt_high_2a = picker.SuggestMapping(h264_high_2a, nullptr).value();
EXPECT_THAT(pt_constrained, Ne(pt_high_1f));
EXPECT_THAT(pt_high_1f, Eq(pt_high_2a));
}
} // namespace webrtc } // namespace webrtc