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

Side by Side Diff: webrtc/modules/video_coding/h264_sprop_parameter_sets_unittest.cc

Issue 2544493005: Decode h264 fmtp sprop-parameter-sets to binary. (Closed)
Patch Set: Git cl format. Created 4 years 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/modules/video_coding/h264_sprop_parameter_sets.h"
12
13 #include <inttypes.h>
sprang_webrtc 2016/12/08 10:08:38 I think "webrtc/base/basictypes.h" is the preferre
johan 2016/12/08 11:14:37 Ok.
14 #include <vector>
15 #include "webrtc/test/gtest.h"
16
17 namespace webrtc {
18
19 class H264SpropParameterSetsTest : public testing::Test {
20 public:
21 H264SpropParameterSets h264_sprop;
22 };
23
24 TEST_F(H264SpropParameterSetsTest, Base64DecodeSprop) {
25 // Example sprop string from https://tools.ietf.org/html/rfc3984 .
26 EXPECT_TRUE(h264_sprop.DecodeSprop("Z0IACpZTBYmI,aMljiA=="));
27 static const std::vector<uint8_t> raw_sps{0x67, 0x42, 0x00, 0x0A, 0x96,
28 0x53, 0x05, 0x89, 0x88};
29 static const std::vector<uint8_t> raw_pps{0x68, 0xC9, 0x63, 0x88};
30 EXPECT_EQ(raw_sps, h264_sprop.sps_nalu());
31 EXPECT_EQ(raw_pps, h264_sprop.pps_nalu());
32 }
33
34 TEST_F(H264SpropParameterSetsTest, InvalidData) {
35 EXPECT_FALSE(h264_sprop.DecodeSprop(","));
36 EXPECT_FALSE(h264_sprop.DecodeSprop(""));
37 EXPECT_FALSE(h264_sprop.DecodeSprop(",iA=="));
38 EXPECT_FALSE(h264_sprop.DecodeSprop("iA==,"));
39 EXPECT_TRUE(h264_sprop.DecodeSprop("iA==,iA=="));
40 EXPECT_FALSE(h264_sprop.DecodeSprop("--,--"));
41 EXPECT_FALSE(h264_sprop.DecodeSprop(",,"));
42 EXPECT_FALSE(h264_sprop.DecodeSprop("iA=="));
43 }
44
45 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698