mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-14 22:30:40 +01:00

I've added a basic AV1 impl to Chrome Remote Desktop and am looking into what is needed to test with I444 (Profile-1) in our platform. This CL adds a few helper functions, constants, and enums that can be used to configure the SDP with different AV1 profiles. More work is still needed but I wanted to get this in place first so I can build on it in the CRD host code. Change-Id: I1af9ebf31f833138e8c36e0c0a30e32289e7b58e Bug: chromium:1329660 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264000 Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Joe Downing <joedow@google.com> Cr-Commit-Position: refs/heads/main@{#37182}
103 lines
4.5 KiB
C++
103 lines
4.5 KiB
C++
/*
|
|
* Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "api/video_codecs/sdp_video_format.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "media/base/media_constants.h"
|
|
#include "test/gtest.h"
|
|
|
|
namespace webrtc {
|
|
|
|
typedef SdpVideoFormat Sdp;
|
|
typedef SdpVideoFormat::Parameters Params;
|
|
|
|
TEST(SdpVideoFormatTest, SameCodecNameNoParameters) {
|
|
EXPECT_TRUE(Sdp("H264").IsSameCodec(Sdp("h264")));
|
|
EXPECT_TRUE(Sdp("VP8").IsSameCodec(Sdp("vp8")));
|
|
EXPECT_TRUE(Sdp("VP9").IsSameCodec(Sdp("vp9")));
|
|
EXPECT_TRUE(Sdp("AV1").IsSameCodec(Sdp("Av1")));
|
|
}
|
|
|
|
TEST(SdpVideoFormatTest, DifferentCodecNameNoParameters) {
|
|
EXPECT_FALSE(Sdp("H264").IsSameCodec(Sdp("VP8")));
|
|
EXPECT_FALSE(Sdp("VP8").IsSameCodec(Sdp("VP9")));
|
|
EXPECT_FALSE(Sdp("AV1").IsSameCodec(Sdp("VP8")));
|
|
}
|
|
|
|
TEST(SdpVideoFormatTest, SameCodecNameSameParameters) {
|
|
EXPECT_TRUE(Sdp("VP9").IsSameCodec(Sdp("VP9", Params{{"profile-id", "0"}})));
|
|
EXPECT_TRUE(Sdp("VP9", Params{{"profile-id", "0"}})
|
|
.IsSameCodec(Sdp("VP9", Params{{"profile-id", "0"}})));
|
|
EXPECT_TRUE(Sdp("VP9", Params{{"profile-id", "2"}})
|
|
.IsSameCodec(Sdp("VP9", Params{{"profile-id", "2"}})));
|
|
EXPECT_TRUE(
|
|
Sdp("H264", Params{{"profile-level-id", "42e01f"}})
|
|
.IsSameCodec(Sdp("H264", Params{{"profile-level-id", "42e01f"}})));
|
|
EXPECT_TRUE(
|
|
Sdp("H264", Params{{"profile-level-id", "640c34"}})
|
|
.IsSameCodec(Sdp("H264", Params{{"profile-level-id", "640c34"}})));
|
|
EXPECT_TRUE(Sdp("AV1").IsSameCodec(Sdp("AV1", Params{{"profile", "0"}})));
|
|
EXPECT_TRUE(Sdp("AV1", Params{{"profile", "0"}})
|
|
.IsSameCodec(Sdp("AV1", Params{{"profile", "0"}})));
|
|
EXPECT_TRUE(Sdp("AV1", Params{{"profile", "2"}})
|
|
.IsSameCodec(Sdp("AV1", Params{{"profile", "2"}})));
|
|
}
|
|
|
|
TEST(SdpVideoFormatTest, SameCodecNameDifferentParameters) {
|
|
EXPECT_FALSE(Sdp("VP9").IsSameCodec(Sdp("VP9", Params{{"profile-id", "2"}})));
|
|
EXPECT_FALSE(Sdp("VP9", Params{{"profile-id", "0"}})
|
|
.IsSameCodec(Sdp("VP9", Params{{"profile-id", "1"}})));
|
|
EXPECT_FALSE(Sdp("VP9", Params{{"profile-id", "2"}})
|
|
.IsSameCodec(Sdp("VP9", Params{{"profile-id", "0"}})));
|
|
EXPECT_FALSE(
|
|
Sdp("H264", Params{{"profile-level-id", "42e01f"}})
|
|
.IsSameCodec(Sdp("H264", Params{{"profile-level-id", "640c34"}})));
|
|
EXPECT_FALSE(
|
|
Sdp("H264", Params{{"profile-level-id", "640c34"}})
|
|
.IsSameCodec(Sdp("H264", Params{{"profile-level-id", "42f00b"}})));
|
|
EXPECT_FALSE(Sdp("AV1").IsSameCodec(Sdp("AV1", Params{{"profile", "1"}})));
|
|
EXPECT_FALSE(Sdp("AV1", Params{{"profile", "0"}})
|
|
.IsSameCodec(Sdp("AV1", Params{{"profile", "1"}})));
|
|
EXPECT_FALSE(Sdp("AV1", Params{{"profile", "1"}})
|
|
.IsSameCodec(Sdp("AV1", Params{{"profile", "2"}})));
|
|
}
|
|
|
|
TEST(SdpVideoFormatTest, DifferentCodecNameSameParameters) {
|
|
EXPECT_FALSE(Sdp("VP9", Params{{"profile-id", "0"}})
|
|
.IsSameCodec(Sdp("H264", Params{{"profile-id", "0"}})));
|
|
EXPECT_FALSE(Sdp("VP9", Params{{"profile-id", "2"}})
|
|
.IsSameCodec(Sdp("VP8", Params{{"profile-id", "2"}})));
|
|
EXPECT_FALSE(
|
|
Sdp("H264", Params{{"profile-level-id", "42e01f"}})
|
|
.IsSameCodec(Sdp("VP9", Params{{"profile-level-id", "42e01f"}})));
|
|
EXPECT_FALSE(
|
|
Sdp("H264", Params{{"profile-level-id", "640c34"}})
|
|
.IsSameCodec(Sdp("VP8", Params{{"profile-level-id", "640c34"}})));
|
|
EXPECT_FALSE(Sdp("AV1", Params{{"profile", "0"}})
|
|
.IsSameCodec(Sdp("H264", Params{{"profile", "0"}})));
|
|
EXPECT_FALSE(Sdp("AV1", Params{{"profile", "2"}})
|
|
.IsSameCodec(Sdp("VP9", Params{{"profile", "2"}})));
|
|
}
|
|
|
|
TEST(SdpVideoFormatTest, H264PacketizationMode) {
|
|
// The default packetization mode is 0.
|
|
EXPECT_TRUE(Sdp("H264", Params{{cricket::kH264FmtpPacketizationMode, "0"}})
|
|
.IsSameCodec(Sdp("H264")));
|
|
EXPECT_FALSE(Sdp("H264", Params{{cricket::kH264FmtpPacketizationMode, "1"}})
|
|
.IsSameCodec(Sdp("H264")));
|
|
|
|
EXPECT_TRUE(
|
|
Sdp("H264", Params{{cricket::kH264FmtpPacketizationMode, "1"}})
|
|
.IsSameCodec(
|
|
Sdp("H264", Params{{cricket::kH264FmtpPacketizationMode, "1"}})));
|
|
}
|
|
} // namespace webrtc
|