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

Unified Diff: webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu_unittest.cc

Issue 2356793002: Add support for 3-byte headers in VideoToolbox NALU parser. (Closed)
Patch Set: rebase Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu_unittest.cc
diff --git a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu_unittest.cc b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu_unittest.cc
index b5e3195cac7aba290cbd8c23f38275ab21cb8c2f..df71f54fa49297d916a9c1385b033ab7880e2a98 100644
--- a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu_unittest.cc
+++ b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu_unittest.cc
@@ -87,11 +87,25 @@ TEST(AnnexBBufferReaderTest, TestReadSingleNalu) {
EXPECT_EQ(0u, nalu_length);
}
+TEST(AnnexBBufferReaderTest, TestReadSingleNalu3ByteHeader) {
+ const uint8_t annex_b_test_data[] = {0x00, 0x00, 0x01, 0xAA};
+ AnnexBBufferReader reader(annex_b_test_data, arraysize(annex_b_test_data));
+ const uint8_t* nalu = nullptr;
+ size_t nalu_length = 0;
+ EXPECT_EQ(arraysize(annex_b_test_data), reader.BytesRemaining());
+ EXPECT_TRUE(reader.ReadNalu(&nalu, &nalu_length));
+ EXPECT_EQ(annex_b_test_data + 3, nalu);
+ EXPECT_EQ(1u, nalu_length);
+ EXPECT_EQ(0u, reader.BytesRemaining());
+ EXPECT_FALSE(reader.ReadNalu(&nalu, &nalu_length));
+ EXPECT_EQ(nullptr, nalu);
+ EXPECT_EQ(0u, nalu_length);
+}
+
TEST(AnnexBBufferReaderTest, TestReadMissingNalu) {
// clang-format off
const uint8_t annex_b_test_data[] = {0x01,
0x00, 0x01,
- 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0xFF};
// clang-format on
AnnexBBufferReader reader(annex_b_test_data, arraysize(annex_b_test_data));
@@ -108,9 +122,8 @@ TEST(AnnexBBufferReaderTest, TestReadMultipleNalus) {
const uint8_t annex_b_test_data[] = {0x00, 0x00, 0x00, 0x01, 0xFF,
0x01,
0x00, 0x01,
- 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0xFF,
- 0x00, 0x00, 0x00, 0x01, 0xAA, 0xBB};
+ 0x00, 0x00, 0x01, 0xAA, 0xBB};
// clang-format on
AnnexBBufferReader reader(annex_b_test_data, arraysize(annex_b_test_data));
const uint8_t* nalu = nullptr;
@@ -118,10 +131,10 @@ TEST(AnnexBBufferReaderTest, TestReadMultipleNalus) {
EXPECT_EQ(arraysize(annex_b_test_data), reader.BytesRemaining());
EXPECT_TRUE(reader.ReadNalu(&nalu, &nalu_length));
EXPECT_EQ(annex_b_test_data + 4, nalu);
- EXPECT_EQ(11u, nalu_length);
+ EXPECT_EQ(8u, nalu_length);
EXPECT_EQ(6u, reader.BytesRemaining());
EXPECT_TRUE(reader.ReadNalu(&nalu, &nalu_length));
- EXPECT_EQ(annex_b_test_data + 19, nalu);
+ EXPECT_EQ(annex_b_test_data + 16, nalu);
EXPECT_EQ(2u, nalu_length);
EXPECT_EQ(0u, reader.BytesRemaining());
EXPECT_FALSE(reader.ReadNalu(&nalu, &nalu_length));
« no previous file with comments | « webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698