Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: webrtc/common_video/h264/profile_level_id_unittest.cc

Issue 2470133002: Add function for getting supported H264 level from max resolution and fps (Closed)
Patch Set: Return rtc::Optional<Level> instead Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 TEST(H264ProfileLevelId, TestParsingHigh) { 65 TEST(H264ProfileLevelId, TestParsingHigh) {
66 EXPECT_EQ(kProfileHigh, ParseProfileLevelId("64001f")->profile); 66 EXPECT_EQ(kProfileHigh, ParseProfileLevelId("64001f")->profile);
67 } 67 }
68 68
69 TEST(H264ProfileLevelId, TestParsingConstrainedHigh) { 69 TEST(H264ProfileLevelId, TestParsingConstrainedHigh) {
70 EXPECT_EQ(kProfileConstrainedHigh, ParseProfileLevelId("640c1f")->profile); 70 EXPECT_EQ(kProfileConstrainedHigh, ParseProfileLevelId("640c1f")->profile);
71 } 71 }
72 72
73 TEST(H264ProfileLevelId, TestSupportedLevel) {
74 EXPECT_EQ(kLevel2_1, *SupportedLevel(640 * 480, 25));
75 EXPECT_EQ(kLevel3_1, *SupportedLevel(1280 * 720, 30));
76 EXPECT_EQ(kLevel4_2, *SupportedLevel(1920 * 1280, 60));
77 }
78
79 // Test supported level below level 1 requirements.
80 TEST(H264ProfileLevelId, TestSupportedLevelInvalid) {
81 EXPECT_FALSE(SupportedLevel(0, 0));
82 EXPECT_FALSE(SupportedLevel(1280 * 720, 5));
83 EXPECT_FALSE(SupportedLevel(183 * 137, 30));
hta-webrtc 2016/11/03 14:04:32 Please add a comment as to why these resolution/fr
magjed_webrtc 2016/11/03 14:53:39 Done.
84 }
85
73 TEST(H264ProfileLevelId, TestToString) { 86 TEST(H264ProfileLevelId, TestToString) {
74 EXPECT_EQ("42e01f", ProfileLevelIdToString(ProfileLevelId( 87 EXPECT_EQ("42e01f", ProfileLevelIdToString(ProfileLevelId(
75 kProfileConstrainedBaseline, kLevel3_1))); 88 kProfileConstrainedBaseline, kLevel3_1)));
76 EXPECT_EQ("42000a", 89 EXPECT_EQ("42000a",
77 ProfileLevelIdToString(ProfileLevelId(kProfileBaseline, kLevel1))); 90 ProfileLevelIdToString(ProfileLevelId(kProfileBaseline, kLevel1)));
78 EXPECT_EQ("4D001f", 91 EXPECT_EQ("4D001f",
79 ProfileLevelIdToString(ProfileLevelId(kProfileMain, kLevel3_1))); 92 ProfileLevelIdToString(ProfileLevelId(kProfileMain, kLevel3_1)));
80 EXPECT_EQ("640c2a", ProfileLevelIdToString( 93 EXPECT_EQ("640c2a", ProfileLevelIdToString(
81 ProfileLevelId(kProfileConstrainedHigh, kLevel4_2))); 94 ProfileLevelId(kProfileConstrainedHigh, kLevel4_2)));
82 EXPECT_EQ("64002a", 95 EXPECT_EQ("64002a",
(...skipping 13 matching lines...) Expand all
96 EXPECT_EQ("", 109 EXPECT_EQ("",
97 ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel1_b))); 110 ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel1_b)));
98 EXPECT_EQ("", ProfileLevelIdToString( 111 EXPECT_EQ("", ProfileLevelIdToString(
99 ProfileLevelId(kProfileConstrainedHigh, kLevel1_b))); 112 ProfileLevelId(kProfileConstrainedHigh, kLevel1_b)));
100 EXPECT_EQ("", ProfileLevelIdToString( 113 EXPECT_EQ("", ProfileLevelIdToString(
101 ProfileLevelId(static_cast<Profile>(255), kLevel3_1))); 114 ProfileLevelId(static_cast<Profile>(255), kLevel3_1)));
102 } 115 }
103 116
104 } // namespace H264 117 } // namespace H264
105 } // namespace webrtc 118 } // namespace webrtc
OLDNEW
« webrtc/common_video/h264/profile_level_id.cc ('K') | « webrtc/common_video/h264/profile_level_id.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698