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 #if defined(USE_PROPRIETARY_CODECS) && defined(ENABLE_HEVC_DEMUXING) |
| 5 |
| 6 #include "base/files/memory_mapped_file.h" |
| 7 #include "base/logging.h" |
| 8 #include "media/base/test_data_util.h" |
| 9 #include "media/filters/h265_parser.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 |
| 12 namespace media { |
| 13 |
| 14 TEST(H265ParserTest, RawHevcStreamFileParsing) { |
| 15 base::FilePath file_path = GetTestDataFilePath("bear.hevc"); |
| 16 // Number of NALUs in the test stream to be parsed. |
| 17 int num_nalus = 35; |
| 18 |
| 19 base::MemoryMappedFile stream; |
| 20 ASSERT_TRUE(stream.Initialize(file_path)) |
| 21 << "Couldn't open stream file: " << file_path.MaybeAsASCII(); |
| 22 |
| 23 H265Parser parser; |
| 24 parser.SetStream(stream.data(), stream.length()); |
| 25 |
| 26 // Parse until the end of stream/unsupported stream/error in stream is found. |
| 27 int num_parsed_nalus = 0; |
| 28 while (true) { |
| 29 H265NALU nalu; |
| 30 H265Parser::Result res = parser.AdvanceToNextNALU(&nalu); |
| 31 if (res == H265Parser::kEOStream) { |
| 32 DVLOG(1) << "Number of successfully parsed NALUs before EOS: " |
| 33 << num_parsed_nalus; |
| 34 ASSERT_EQ(num_nalus, num_parsed_nalus); |
| 35 return; |
| 36 } |
| 37 ASSERT_EQ(res, H265Parser::kOk); |
| 38 |
| 39 ++num_parsed_nalus; |
| 40 DVLOG(4) << "Found NALU " << nalu.nal_unit_type; |
| 41 } |
| 42 } |
| 43 |
| 44 } // namespace media |
| 45 |
| 46 #endif |
OLD | NEW |