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

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

Issue 2459633002: Add functionality for parsing H264 profile-level-id (Closed)
Patch Set: Fix include order in common_video.gyp 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
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/common_video/h264/profile_level_id.h"
12
13 #include "webrtc/test/gtest.h"
14
15 namespace webrtc {
16 namespace H264 {
17
18 TEST(H264ProfileLevelIdParsing, TestInvalid) {
19 // Malformed strings.
20 EXPECT_FALSE(ParseProfileLevelId(""));
21 EXPECT_FALSE(ParseProfileLevelId(" 42e01f"));
22 EXPECT_FALSE(ParseProfileLevelId("4242e01f"));
23 EXPECT_FALSE(ParseProfileLevelId("e01f"));
24 EXPECT_FALSE(ParseProfileLevelId("gggggg"));
25
26 // Invalid level.
27 EXPECT_FALSE(ParseProfileLevelId("42e000"));
28 EXPECT_FALSE(ParseProfileLevelId("42e00f"));
29 EXPECT_FALSE(ParseProfileLevelId("42e0ff"));
30
31 // Invalid profile.
32 EXPECT_FALSE(ParseProfileLevelId("42e11f"));
33 EXPECT_FALSE(ParseProfileLevelId("58601f"));
34 EXPECT_FALSE(ParseProfileLevelId("64e01f"));
35 }
36
37 TEST(H264ProfileLevelIdParsing, TestLevel) {
38 EXPECT_EQ(kLevel3_1, ParseProfileLevelId("42e01f")->level);
39 EXPECT_EQ(kLevel1_1, ParseProfileLevelId("42e00b")->level);
40 EXPECT_EQ(kLevel1_b, ParseProfileLevelId("42f00b")->level);
41 EXPECT_EQ(kLevel4_2, ParseProfileLevelId("42C02A")->level);
42 EXPECT_EQ(kLevel5_2, ParseProfileLevelId("640c34")->level);
43 }
44
45 TEST(H264ProfileLevelIdParsing, TestConstrainedBaseline) {
46 EXPECT_EQ(kProfileConstrainedBaseline,
47 ParseProfileLevelId("42e01f")->profile);
48 EXPECT_EQ(kProfileConstrainedBaseline,
49 ParseProfileLevelId("42C02A")->profile);
50 EXPECT_EQ(kProfileConstrainedBaseline,
51 ParseProfileLevelId("4de01f")->profile);
52 EXPECT_EQ(kProfileConstrainedBaseline,
53 ParseProfileLevelId("58f01f")->profile);
54 }
55
56 TEST(H264ProfileLevelIdParsing, TestBaseline) {
57 EXPECT_EQ(kProfileBaseline, ParseProfileLevelId("42a01f")->profile);
58 EXPECT_EQ(kProfileBaseline, ParseProfileLevelId("58A01F")->profile);
59 }
60
61 TEST(H264ProfileLevelIdParsing, TestMain) {
62 EXPECT_EQ(kProfileMain, ParseProfileLevelId("4D401f")->profile);
63 }
64
65 TEST(H264ProfileLevelIdParsing, TestHigh) {
66 EXPECT_EQ(kProfileHigh, ParseProfileLevelId("64001f")->profile);
67 }
68
69 TEST(H264ProfileLevelIdParsing, TestConstrainedHigh) {
70 EXPECT_EQ(kProfileConstrainedHigh, ParseProfileLevelId("640c1f")->profile);
71 }
72
73 } // namespace H264
74 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_video/h264/profile_level_id.cc ('k') | webrtc/modules/video_coding/codec_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698