Exclude TrayIMETest.PerformActionOnDetailedView under valgrind, where it crashes.
[chromium-blink-merge.git] / media / filters / vp8_parser_unittest.cc
blob3087ed0cfdfef940646f7ec445cdccb1cfb3d61b
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.
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/ivf_parser.h"
9 #include "media/filters/vp8_parser.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 namespace media {
14 TEST(Vp8ParserTest, StreamFileParsing) {
15 base::FilePath file_path = GetTestDataFilePath("test-25fps.vp8");
16 base::MemoryMappedFile stream;
17 ASSERT_TRUE(stream.Initialize(file_path))
18 << "Couldn't open stream file: " << file_path.MaybeAsASCII();
20 IvfParser ivf_parser;
21 IvfFileHeader ivf_file_header = {};
22 ASSERT_TRUE(
23 ivf_parser.Initialize(stream.data(), stream.length(), &ivf_file_header));
24 ASSERT_EQ(ivf_file_header.fourcc, 0x30385056u); // VP80
26 Vp8Parser vp8_parser;
27 IvfFrameHeader ivf_frame_header = {};
28 size_t num_parsed_frames = 0;
30 // Parse until the end of stream/unsupported stream/error in stream is found.
31 const uint8_t* payload = nullptr;
32 while (ivf_parser.ParseNextFrame(&ivf_frame_header, &payload)) {
33 Vp8FrameHeader fhdr;
35 ASSERT_TRUE(
36 vp8_parser.ParseFrame(payload, ivf_frame_header.frame_size, &fhdr));
38 ++num_parsed_frames;
41 DVLOG(1) << "Number of successfully parsed frames before EOS: "
42 << num_parsed_frames;
44 EXPECT_EQ(ivf_file_header.num_frames, num_parsed_frames);
47 } // namespace media