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

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

Issue 1732953003: Fix VideoToolbox backgrounding issues (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: CR comments Created 4 years, 9 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 4087dbc79dbe1666ac5577018689b6752323d26a..4ac9cd0db192e8290bde3ab5ee7e4748b610d3aa 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
@@ -16,11 +16,44 @@
#include "webrtc/base/arraysize.h"
#include "webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.h"
+#if defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED)
+
namespace webrtc {
static const uint8_t NALU_TEST_DATA_0[] = {0xAA, 0xBB, 0xCC};
static const uint8_t NALU_TEST_DATA_1[] = {0xDE, 0xAD, 0xBE, 0xEF};
+TEST(H264VideoToolboxNaluTest, TestHasVideoFormatDescription) {
+ const uint8_t sps_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x27};
+ EXPECT_TRUE(H264AnnexBBufferHasVideoFormatDescription(sps_buffer,
+ arraysize(sps_buffer)));
+ const uint8_t other_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x28};
+ EXPECT_FALSE(H264AnnexBBufferHasVideoFormatDescription(
+ other_buffer, arraysize(other_buffer)));
+}
+
+TEST(H264VideoToolboxNaluTest, TestCreateVideoFormatDescription) {
+ const uint8_t sps_pps_buffer[] = {
+ // SPS nalu.
+ 0x00, 0x00, 0x00, 0x01,
+ 0x27, 0x42, 0x00, 0x1E, 0xAB, 0x40, 0xF0, 0x28, 0xD3, 0x70, 0x20, 0x20,
+ 0x20, 0x20,
+ // PPS nalu.
+ 0x00, 0x00, 0x00, 0x01,
+ 0x28, 0xCE, 0x3C, 0x30
+ };
+ CMVideoFormatDescriptionRef description =
+ CreateVideoFormatDescription(sps_pps_buffer, arraysize(sps_pps_buffer));
+ EXPECT_TRUE(description);
+ if (description) {
+ CFRelease(description);
+ description = nullptr;
+ }
+ const uint8_t other_buffer[] = {0x00, 0x00, 0x00, 0x01, 0x28};
+ EXPECT_FALSE(CreateVideoFormatDescription(other_buffer,
+ arraysize(other_buffer)));
+}
+
TEST(AnnexBBufferReaderTest, TestReadEmptyInput) {
const uint8_t annex_b_test_data[] = {0x00};
AnnexBBufferReader reader(annex_b_test_data, 0);
@@ -151,3 +184,5 @@ TEST(AvccBufferWriterTest, TestOverflow) {
}
} // namespace webrtc
+
+#endif // WEBRTC_VIDEO_TOOLBOX_SUPPORTED
« 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