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

Side by Side Diff: webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu_unittest.cc

Issue 2352063002: Fix modules_unittests on iOS. (Closed)
Patch Set: fix the fixed sizes 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 */
11 11
12 #include <memory> 12 #include <memory>
13 13
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 #include "webrtc/base/arraysize.h" 16 #include "webrtc/base/arraysize.h"
17 #include "webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.h" 17 #include "webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.h"
18 18
19 #if defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) 19 #if defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED)
20 20
21 namespace webrtc { 21 namespace webrtc {
22 22
23 static const uint8_t NALU_TEST_DATA_0[] = {0xAA, 0xBB, 0xCC}; 23 static const uint8_t NALU_TEST_DATA_0[] = {0xAA, 0xBB, 0xCC};
24 static const uint8_t NALU_TEST_DATA_1[] = {0xDE, 0xAD, 0xBE, 0xEF}; 24 static const uint8_t NALU_TEST_DATA_1[] = {0xDE, 0xAD, 0xBE, 0xEF};
25 25
26 TEST(H264VideoToolboxNaluTest, TestHasVideoFormatDescription) { 26 TEST(H264VideoToolboxNaluTest, TestHasVideoFormatDescription) {
27 const uint8_t sps_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x27}; 27 const uint8_t sps_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x27};
28 EXPECT_TRUE(H264AnnexBBufferHasVideoFormatDescription(sps_buffer, 28 EXPECT_TRUE(H264AnnexBBufferHasVideoFormatDescription(sps_buffer,
29 arraysize(sps_buffer))); 29 arraysize(sps_buffer)));
30 const uint8_t aud_sps_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x29, 30 const uint8_t aud_sps_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x29, 0x10,
31 0x00, 0x00, 0x00, 0x01, 0x27}; 31 0x00, 0x00, 0x00, 0x01, 0x27, 0xFF};
32 EXPECT_TRUE(H264AnnexBBufferHasVideoFormatDescription( 32 EXPECT_TRUE(H264AnnexBBufferHasVideoFormatDescription(
33 aud_sps_buffer, arraysize(aud_sps_buffer))); 33 aud_sps_buffer, arraysize(aud_sps_buffer)));
34 const uint8_t other_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x28}; 34 const uint8_t other_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x28};
35 EXPECT_FALSE(H264AnnexBBufferHasVideoFormatDescription( 35 EXPECT_FALSE(H264AnnexBBufferHasVideoFormatDescription(
36 other_buffer, arraysize(other_buffer))); 36 other_buffer, arraysize(other_buffer)));
37 const uint8_t aud_other_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x29, 37 const uint8_t aud_other_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x29,
38 0x00, 0x00, 0x00, 0x01, 0x28}; 38 0x00, 0x00, 0x00, 0x01, 0x28};
39 EXPECT_FALSE(H264AnnexBBufferHasVideoFormatDescription( 39 EXPECT_FALSE(H264AnnexBBufferHasVideoFormatDescription(
40 aud_other_buffer, arraysize(aud_other_buffer))); 40 aud_other_buffer, arraysize(aud_other_buffer)));
41 } 41 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 EXPECT_EQ(buffer_size, writer.BytesRemaining()); 187 EXPECT_EQ(buffer_size, writer.BytesRemaining());
188 EXPECT_FALSE(writer.WriteNalu(NALU_TEST_DATA_0, arraysize(NALU_TEST_DATA_0))); 188 EXPECT_FALSE(writer.WriteNalu(NALU_TEST_DATA_0, arraysize(NALU_TEST_DATA_0)));
189 EXPECT_EQ(buffer_size, writer.BytesRemaining()); 189 EXPECT_EQ(buffer_size, writer.BytesRemaining());
190 EXPECT_EQ(0, 190 EXPECT_EQ(0,
191 memcmp(expected_buffer, buffer.get(), arraysize(expected_buffer))); 191 memcmp(expected_buffer, buffer.get(), arraysize(expected_buffer)));
192 } 192 }
193 193
194 } // namespace webrtc 194 } // namespace webrtc
195 195
196 #endif // WEBRTC_VIDEO_TOOLBOX_SUPPORTED 196 #endif // WEBRTC_VIDEO_TOOLBOX_SUPPORTED
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/test/debug_dump_test.cc ('k') | webrtc/test/testsupport/fileutils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698