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

Side by Side Diff: media/formats/ac3/ac3_util_unittest.cc

Issue 2572573007: Use passthrough decoder for (E)AC3 formats (Closed)
Patch Set: Sanity checks Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « media/formats/ac3/ac3_util.cc ('k') | media/mojo/common/media_type_converters.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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 "media/formats/ac3/ac3_util.h"
6
7 #include "base/files/file_util.h"
8 #include "media/base/test_data_util.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace media {
12
13 namespace {
14
15 struct Ac3StreamInfo {
16 size_t size;
17 int pcm_frame_count;
18 };
19
20 } // namespace anonymous
21
22 TEST(Ac3UtilTest, ParseTotalAc3SampleCount) {
23 char buffer[8192];
24 const int buffer_size = sizeof(buffer);
25 const Ac3StreamInfo ac3StreamInfo[] = {
26 {834, 1 * 1536}, {1670, 2 * 1536}, {2506, 3 * 1536},
27 };
28
29 for (const Ac3StreamInfo& info : ac3StreamInfo) {
30 memset(buffer, 0, buffer_size);
31 int data_size =
32 base::ReadFile(GetTestDataFilePath("bear.ac3"), buffer, info.size);
33
34 EXPECT_EQ(info.pcm_frame_count,
35 ::media::Ac3Util::ParseTotalAc3SampleCount(
36 reinterpret_cast<const uint8_t*>(buffer), data_size));
37 }
38 }
39
40 TEST(Ac3UtilTest, ParseTotalEac3SampleCount) {
41 char buffer[8192];
42 const int buffer_size = sizeof(buffer);
43 const Ac3StreamInfo ac3StreamInfo[] = {
44 {870, 1 * 1536}, {1742, 2 * 1536}, {2612, 3 * 1536},
45 };
46
47 for (const Ac3StreamInfo& info : ac3StreamInfo) {
48 memset(buffer, 0, buffer_size);
49 int data_size =
50 base::ReadFile(GetTestDataFilePath("bear.eac3"), buffer, info.size);
51
52 EXPECT_EQ(info.pcm_frame_count,
53 ::media::Ac3Util::ParseTotalEac3SampleCount(
54 reinterpret_cast<const uint8_t*>(buffer), data_size));
55 }
56 }
57
58 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/ac3/ac3_util.cc ('k') | media/mojo/common/media_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698