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

Unified Diff: content/common/gpu/media/h264_parser_unittest.cc

Issue 119153002: Move H264Parser and H264BitReader to media/filters. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | « content/common/gpu/media/h264_parser.cc ('k') | content/common/gpu/media/v4l2_video_decode_accelerator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/h264_parser_unittest.cc
diff --git a/content/common/gpu/media/h264_parser_unittest.cc b/content/common/gpu/media/h264_parser_unittest.cc
deleted file mode 100644
index d52bb5122094f519f409cd453af2245393092326..0000000000000000000000000000000000000000
--- a/content/common/gpu/media/h264_parser_unittest.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-#include "base/command_line.h"
-#include "base/files/memory_mapped_file.h"
-#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
-#include "content/common/gpu/media/h264_parser.h"
-
-using content::H264Parser;
-using content::H264NALU;
-
-const base::FilePath::CharType* test_stream_filename =
- FILE_PATH_LITERAL("content/common/gpu/testdata/test-25fps.h264");
-// Number of NALUs in the stream to be parsed.
-int num_nalus = 759;
-
-TEST(H264ParserTest, StreamFileParsing) {
- base::FilePath fp(test_stream_filename);
- base::MemoryMappedFile stream;
- CHECK(stream.Initialize(fp)) << "Couldn't open stream file: "
- << test_stream_filename;
- DVLOG(1) << "Parsing file: " << test_stream_filename;
-
- H264Parser parser;
- parser.SetStream(stream.data(), stream.length());
-
- // Parse until the end of stream/unsupported stream/error in stream is found.
- int num_parsed_nalus = 0;
- while (true) {
- content::H264SliceHeader shdr;
- content::H264SEIMessage sei_msg;
- H264NALU nalu;
- H264Parser::Result res = parser.AdvanceToNextNALU(&nalu);
- if (res == H264Parser::kEOStream) {
- DVLOG(1) << "Number of successfully parsed NALUs before EOS: "
- << num_parsed_nalus;
- ASSERT_EQ(num_nalus, num_parsed_nalus);
- return;
- }
- ASSERT_EQ(res, H264Parser::kOk);
-
- ++num_parsed_nalus;
-
- int id;
- switch (nalu.nal_unit_type) {
- case H264NALU::kIDRSlice:
- case H264NALU::kNonIDRSlice:
- ASSERT_EQ(parser.ParseSliceHeader(nalu, &shdr), H264Parser::kOk);
- break;
-
- case H264NALU::kSPS:
- ASSERT_EQ(parser.ParseSPS(&id), H264Parser::kOk);
- break;
-
- case H264NALU::kPPS:
- ASSERT_EQ(parser.ParsePPS(&id), H264Parser::kOk);
- break;
-
- case H264NALU::kSEIMessage:
- ASSERT_EQ(parser.ParseSEI(&sei_msg), H264Parser::kOk);
- break;
-
- default:
- // Skip unsupported NALU.
- DVLOG(4) << "Skipping unsupported NALU";
- break;
- }
- }
-}
-
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- CommandLine::Init(argc, argv);
-
- const CommandLine::SwitchMap& switches =
- CommandLine::ForCurrentProcess()->GetSwitches();
- for (CommandLine::SwitchMap::const_iterator it = switches.begin();
- it != switches.end(); ++it) {
- if (it->first == "test_stream") {
- test_stream_filename = it->second.c_str();
- } else if (it->first == "num_nalus") {
- CHECK(base::StringToInt(it->second, &num_nalus));
- } else {
- LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
- }
- }
-
- return RUN_ALL_TESTS();
-}
« no previous file with comments | « content/common/gpu/media/h264_parser.cc ('k') | content/common/gpu/media/v4l2_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698