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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/ac3/ac3_util_unittest.cc
diff --git a/media/formats/ac3/ac3_util_unittest.cc b/media/formats/ac3/ac3_util_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..59bea645cf328adb9f8718b53de0a398b66b33ad
--- /dev/null
+++ b/media/formats/ac3/ac3_util_unittest.cc
@@ -0,0 +1,58 @@
+// Copyright 2017 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 "media/formats/ac3/ac3_util.h"
+
+#include "base/files/file_util.h"
+#include "media/base/test_data_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace media {
+
+namespace {
+
+struct Ac3StreamInfo {
+ size_t size;
+ int pcm_frame_count;
+};
+
+} // namespace anonymous
+
+TEST(Ac3UtilTest, ParseTotalAc3SampleCount) {
+ char buffer[8192];
+ const int buffer_size = sizeof(buffer);
+ const Ac3StreamInfo ac3StreamInfo[] = {
+ {834, 1 * 1536}, {1670, 2 * 1536}, {2506, 3 * 1536},
+ };
+
+ for (const Ac3StreamInfo& info : ac3StreamInfo) {
+ memset(buffer, 0, buffer_size);
+ int data_size =
+ base::ReadFile(GetTestDataFilePath("bear.ac3"), buffer, info.size);
+
+ EXPECT_EQ(info.pcm_frame_count,
+ ::media::Ac3Util::ParseTotalAc3SampleCount(
+ reinterpret_cast<const uint8_t*>(buffer), data_size));
+ }
+}
+
+TEST(Ac3UtilTest, ParseTotalEac3SampleCount) {
+ char buffer[8192];
+ const int buffer_size = sizeof(buffer);
+ const Ac3StreamInfo ac3StreamInfo[] = {
+ {870, 1 * 1536}, {1742, 2 * 1536}, {2612, 3 * 1536},
+ };
+
+ for (const Ac3StreamInfo& info : ac3StreamInfo) {
+ memset(buffer, 0, buffer_size);
+ int data_size =
+ base::ReadFile(GetTestDataFilePath("bear.eac3"), buffer, info.size);
+
+ EXPECT_EQ(info.pcm_frame_count,
+ ::media::Ac3Util::ParseTotalEac3SampleCount(
+ reinterpret_cast<const uint8_t*>(buffer), data_size));
+ }
+}
+
+} // namespace media
« 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