Allow multiple AV1 profiles to be specified in the SDP
I am working on enabling AV1 profile-1 support for Chrome Remote Desktop and I noticed that when our host adds both AV1 profile-0 and AV1 profile-1 codecs to the SDP, the second codec is stripped. I tracked the problem down to this class as the IsSameCodecSpecific function was not looking at the format params to determine whether the additional AV1 codec entries were duplciates of the first. Bug: chromium:1329660 Change-Id: I6ee0c264657203631a43f74f64e08153dca4f63a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273981 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Joe Downing <joedow@google.com> Cr-Commit-Position: refs/heads/main@{#38020}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
d8479c5b4f
commit
903ba6d736
@ -12,6 +12,7 @@
|
||||
|
||||
#include "absl/algorithm/container.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/video_codecs/av1_profile.h"
|
||||
#include "api/video_codecs/h264_profile_level_id.h"
|
||||
#include "api/video_codecs/vp9_profile.h"
|
||||
#include "rtc_base/checks.h"
|
||||
@ -54,6 +55,8 @@ bool IsSameCodecSpecific(const std::string& name1,
|
||||
IsSameH264PacketizationMode(params1, params2);
|
||||
if (either_name_matches(kVp9CodecName))
|
||||
return webrtc::VP9IsSameProfile(params1, params2);
|
||||
if (either_name_matches(kAv1CodecName))
|
||||
return webrtc::AV1IsSameProfile(params1, params2);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#include "api/video_codecs/av1_profile.h"
|
||||
#include "api/video_codecs/h264_profile_level_id.h"
|
||||
#include "api/video_codecs/vp9_profile.h"
|
||||
#include "modules/video_coding/codecs/h264/include/h264.h"
|
||||
@ -234,6 +235,52 @@ TEST(CodecTest, TestVideoCodecMatchesWithDifferentPacketization) {
|
||||
EXPECT_TRUE(c1.Matches(c0));
|
||||
}
|
||||
|
||||
// AV1 codecs compare profile information.
|
||||
TEST(CodecTest, TestAV1CodecMatches) {
|
||||
const char kProfile0[] = "0";
|
||||
const char kProfile1[] = "1";
|
||||
const char kProfile2[] = "2";
|
||||
|
||||
VideoCodec c_no_profile(95, cricket::kAv1CodecName);
|
||||
VideoCodec c_profile0(95, cricket::kAv1CodecName);
|
||||
c_profile0.params[webrtc::kAV1FmtpProfile] = kProfile0;
|
||||
VideoCodec c_profile1(95, cricket::kAv1CodecName);
|
||||
c_profile1.params[webrtc::kAV1FmtpProfile] = kProfile1;
|
||||
VideoCodec c_profile2(95, cricket::kAv1CodecName);
|
||||
c_profile2.params[webrtc::kAV1FmtpProfile] = kProfile2;
|
||||
|
||||
// An AV1 entry with no profile specified should be treated as profile-0.
|
||||
EXPECT_TRUE(c_profile0.Matches(c_no_profile));
|
||||
|
||||
{
|
||||
// Two AV1 entries without a profile specified are treated as duplicates.
|
||||
VideoCodec c_no_profile_eq(95, cricket::kAv1CodecName);
|
||||
EXPECT_TRUE(c_no_profile.Matches(c_no_profile_eq));
|
||||
}
|
||||
|
||||
{
|
||||
// Two AV1 entries with profile 0 specified are treated as duplicates.
|
||||
VideoCodec c_profile0_eq(95, cricket::kAv1CodecName);
|
||||
c_profile0_eq.params[webrtc::kAV1FmtpProfile] = kProfile0;
|
||||
EXPECT_TRUE(c_profile0.Matches(c_profile0_eq));
|
||||
}
|
||||
|
||||
{
|
||||
// Two AV1 entries with profile 1 specified are treated as duplicates.
|
||||
VideoCodec c_profile1_eq(95, cricket::kAv1CodecName);
|
||||
c_profile1_eq.params[webrtc::kAV1FmtpProfile] = kProfile1;
|
||||
EXPECT_TRUE(c_profile1.Matches(c_profile1_eq));
|
||||
}
|
||||
|
||||
// AV1 entries with different profiles (0 and 1) are seen as distinct.
|
||||
EXPECT_FALSE(c_profile0.Matches(c_profile1));
|
||||
EXPECT_FALSE(c_no_profile.Matches(c_profile1));
|
||||
|
||||
// AV1 entries with different profiles (0 and 2) are seen as distinct.
|
||||
EXPECT_FALSE(c_profile0.Matches(c_profile2));
|
||||
EXPECT_FALSE(c_no_profile.Matches(c_profile2));
|
||||
}
|
||||
|
||||
// VP9 codecs compare profile information.
|
||||
TEST(CodecTest, TestVP9CodecMatches) {
|
||||
const char kProfile0[] = "0";
|
||||
|
Reference in New Issue
Block a user