OLD | NEW |
(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 <vector> |
| 14 #include "webrtc/base/basictypes.h" |
| 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 |
OLD | NEW |