OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/mp4/aac.h" | 5 #include "media/mp4/aac.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 EXPECT_TRUE(aac.Parse(data)); | 32 EXPECT_TRUE(aac.Parse(data)); |
33 EXPECT_EQ(aac.GetOutputSamplesPerSecond(false), 48000); | 33 EXPECT_EQ(aac.GetOutputSamplesPerSecond(false), 48000); |
34 EXPECT_EQ(aac.GetOutputSamplesPerSecond(true), 48000); | 34 EXPECT_EQ(aac.GetOutputSamplesPerSecond(true), 48000); |
35 EXPECT_EQ(aac.GetChannelLayout(false), CHANNEL_LAYOUT_STEREO); | 35 EXPECT_EQ(aac.GetChannelLayout(false), CHANNEL_LAYOUT_STEREO); |
36 } | 36 } |
37 | 37 |
38 // Test implicit SBR with mono channel config. | 38 // Test implicit SBR with mono channel config. |
39 // Mono channel layout should only be reported if SBR is not | 39 // Mono channel layout should only be reported if SBR is not |
40 // specified. Otherwise stereo should be reported. | 40 // specified. Otherwise stereo should be reported. |
41 // See ISO-14496-3 Section 1.6.6.1.2 for details about this special casing. | 41 // See ISO-14496-3 Section 1.6.6.1.2 for details about this special casing. |
42 TEST(AACTest, TestImplicitSBR_ChannelConfig0) { | 42 TEST(AACTest, ImplicitSBR_ChannelConfig0) { |
43 AAC aac; | 43 AAC aac; |
44 uint8 buffer[] = {0x13, 0x08}; | 44 uint8 buffer[] = {0x13, 0x08}; |
45 std::vector<uint8> data; | 45 std::vector<uint8> data; |
46 | 46 |
47 data.assign(buffer, buffer + sizeof(buffer)); | 47 data.assign(buffer, buffer + sizeof(buffer)); |
48 | 48 |
49 EXPECT_TRUE(aac.Parse(data)); | 49 EXPECT_TRUE(aac.Parse(data)); |
50 | 50 |
51 // Test w/o implict SBR. | 51 // Test w/o implict SBR. |
52 EXPECT_EQ(aac.GetOutputSamplesPerSecond(false), 24000); | 52 EXPECT_EQ(aac.GetOutputSamplesPerSecond(false), 24000); |
53 EXPECT_EQ(aac.GetChannelLayout(false), CHANNEL_LAYOUT_MONO); | 53 EXPECT_EQ(aac.GetChannelLayout(false), CHANNEL_LAYOUT_MONO); |
54 | 54 |
55 // Test implicit SBR. | 55 // Test implicit SBR. |
56 EXPECT_EQ(aac.GetOutputSamplesPerSecond(true), 48000); | 56 EXPECT_EQ(aac.GetOutputSamplesPerSecond(true), 48000); |
57 EXPECT_EQ(aac.GetChannelLayout(true), CHANNEL_LAYOUT_STEREO); | 57 EXPECT_EQ(aac.GetChannelLayout(true), CHANNEL_LAYOUT_STEREO); |
58 } | 58 } |
59 | 59 |
60 // Tests implicit SBR with a stereo channel config. | 60 // Tests implicit SBR with a stereo channel config. |
61 TEST(AACTest, TestImplicitSBR_ChannelConfig1) { | 61 TEST(AACTest, ImplicitSBR_ChannelConfig1) { |
62 AAC aac; | 62 AAC aac; |
63 uint8 buffer[] = {0x13, 0x10}; | 63 uint8 buffer[] = {0x13, 0x10}; |
64 std::vector<uint8> data; | 64 std::vector<uint8> data; |
65 | 65 |
66 data.assign(buffer, buffer + sizeof(buffer)); | 66 data.assign(buffer, buffer + sizeof(buffer)); |
67 | 67 |
68 EXPECT_TRUE(aac.Parse(data)); | 68 EXPECT_TRUE(aac.Parse(data)); |
69 | 69 |
70 // Test w/o implict SBR. | 70 // Test w/o implict SBR. |
71 EXPECT_EQ(aac.GetOutputSamplesPerSecond(false), 24000); | 71 EXPECT_EQ(aac.GetOutputSamplesPerSecond(false), 24000); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 EXPECT_FALSE(aac.Parse(data)); | 138 EXPECT_FALSE(aac.Parse(data)); |
139 | 139 |
140 data[1] = 0x08; | 140 data[1] = 0x08; |
141 EXPECT_TRUE(aac.Parse(data)); | 141 EXPECT_TRUE(aac.Parse(data)); |
142 } | 142 } |
143 | 143 |
144 } // namespace mp4 | 144 } // namespace mp4 |
145 | 145 |
146 } // namespace media | 146 } // namespace media |
OLD | NEW |