OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/files/memory_mapped_file.h" |
| 6 #include "base/logging.h" |
| 7 #include "media/base/test_data_util.h" |
| 8 #include "media/filters/h265_parser.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 |
| 11 namespace media { |
| 12 |
| 13 TEST(H265ParserTest, RawHevcStreamFileParsing) { |
| 14 base::FilePath file_path = GetTestDataFilePath("bear.hevc"); |
| 15 // Number of NALUs in the test stream to be parsed. |
| 16 const int num_nalus = 35; |
| 17 |
| 18 base::MemoryMappedFile stream; |
| 19 ASSERT_TRUE(stream.Initialize(file_path)) |
| 20 << "Couldn't open stream file: " << file_path.MaybeAsASCII(); |
| 21 |
| 22 H265Parser parser; |
| 23 parser.SetStream(stream.data(), stream.length()); |
| 24 |
| 25 // Parse until the end of stream/unsupported stream/error in stream is found. |
| 26 int num_parsed_nalus = 0; |
| 27 while (true) { |
| 28 H265NALU nalu; |
| 29 H265Parser::Result res = parser.AdvanceToNextNALU(&nalu); |
| 30 if (res == H265Parser::kEOStream) { |
| 31 DVLOG(1) << "Number of successfully parsed NALUs before EOS: " |
| 32 << num_parsed_nalus; |
| 33 ASSERT_EQ(num_nalus, num_parsed_nalus); |
| 34 return; |
| 35 } |
| 36 ASSERT_EQ(res, H265Parser::kOk); |
| 37 |
| 38 ++num_parsed_nalus; |
| 39 DVLOG(4) << "Found NALU " << nalu.nal_unit_type; |
| 40 } |
| 41 } |
| 42 |
| 43 } // namespace media |
OLD | NEW |