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

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: Change fps type to float 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
« no previous file with comments | « webrtc/common_video/h264/profile_level_id.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // All levels support fps > 5.
83 EXPECT_FALSE(SupportedLevel(1280 * 720, 5));
84 // All levels support frame sizes > 183 * 137.
85 EXPECT_FALSE(SupportedLevel(183 * 137, 30));
86 }
87
73 TEST(H264ProfileLevelId, TestToString) { 88 TEST(H264ProfileLevelId, TestToString) {
74 EXPECT_EQ("42e01f", *ProfileLevelIdToString(ProfileLevelId( 89 EXPECT_EQ("42e01f", *ProfileLevelIdToString(ProfileLevelId(
75 kProfileConstrainedBaseline, kLevel3_1))); 90 kProfileConstrainedBaseline, kLevel3_1)));
76 EXPECT_EQ("42000a", 91 EXPECT_EQ("42000a",
77 *ProfileLevelIdToString(ProfileLevelId(kProfileBaseline, kLevel1))); 92 *ProfileLevelIdToString(ProfileLevelId(kProfileBaseline, kLevel1)));
78 EXPECT_EQ("4d001f", 93 EXPECT_EQ("4d001f",
79 ProfileLevelIdToString(ProfileLevelId(kProfileMain, kLevel3_1))); 94 ProfileLevelIdToString(ProfileLevelId(kProfileMain, kLevel3_1)));
80 EXPECT_EQ("640c2a", *ProfileLevelIdToString( 95 EXPECT_EQ("640c2a", *ProfileLevelIdToString(
81 ProfileLevelId(kProfileConstrainedHigh, kLevel4_2))); 96 ProfileLevelId(kProfileConstrainedHigh, kLevel4_2)));
82 EXPECT_EQ("64002a", 97 EXPECT_EQ("64002a",
(...skipping 21 matching lines...) Expand all
104 TEST(H264ProfileLevelId, TestToStringInvalid) { 119 TEST(H264ProfileLevelId, TestToStringInvalid) {
105 EXPECT_FALSE(ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel1_b))); 120 EXPECT_FALSE(ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel1_b)));
106 EXPECT_FALSE(ProfileLevelIdToString( 121 EXPECT_FALSE(ProfileLevelIdToString(
107 ProfileLevelId(kProfileConstrainedHigh, kLevel1_b))); 122 ProfileLevelId(kProfileConstrainedHigh, kLevel1_b)));
108 EXPECT_FALSE(ProfileLevelIdToString( 123 EXPECT_FALSE(ProfileLevelIdToString(
109 ProfileLevelId(static_cast<Profile>(255), kLevel3_1))); 124 ProfileLevelId(static_cast<Profile>(255), kLevel3_1)));
110 } 125 }
111 126
112 } // namespace H264 127 } // namespace H264
113 } // namespace webrtc 128 } // namespace webrtc
OLDNEW
« no previous file with comments | « 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