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

Side by Side Diff: media/mp4/es_descriptor_unittest.cc

Issue 10780026: Add HE AAC support to ISO BMFF. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove aac.h. Created 8 years, 5 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/mp4/es_descriptor.cc ('k') | media/mp4/mp4_stream_parser.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 (c) 2012 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/mp4/es_descriptor.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace media {
10
11 namespace mp4 {
12
13 TEST(ESDescriptorTest, SingleByteLengthTest) {
14 ESDescriptor es_desc;
15 uint8 buffer[] = {
16 0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x40,
17 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18 0x00, 0x00, 0x00, 0x00, 0x05, 0x02, 0x12, 0x10,
19 0x06, 0x01, 0x02
20 };
21 std::vector<uint8> data;
22
23 data.assign(buffer, buffer + sizeof(buffer));
24
25 EXPECT_EQ(es_desc.object_type(), kForbidden);
26 EXPECT_TRUE(es_desc.Parse(data));
27 EXPECT_EQ(es_desc.object_type(), kISO_14496_3);
28 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u);
29 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12);
30 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10);
31 }
32
33 TEST(ESDescriptorTest, NonAACTest) {
34 ESDescriptor es_desc;
35 uint8 buffer[] = {
36 0x03, 0x19, 0x00, 0x01, 0x00, 0x04, 0x11, 0x66,
37 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38 0x00, 0x00, 0x00, 0x00, 0x05, 0x02, 0x12, 0x10,
39 0x06, 0x01, 0x02
40 };
41 std::vector<uint8> data;
42
43 data.assign(buffer, buffer + sizeof(buffer));
44
45 EXPECT_TRUE(es_desc.Parse(data));
46 EXPECT_NE(es_desc.object_type(), kISO_14496_3);
47 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u);
48 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12);
49 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10);
50 }
51
52 TEST(ESDescriptorTest, MultiByteLengthTest) {
53 ESDescriptor es_desc;
54 uint8 buffer[] = {
55 0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80,
56 0x80, 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00,
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
58 0x80, 0x80, 0x80, 0x02, 0x12, 0x10, 0x06, 0x01,
59 0x02
60 };
61 std::vector<uint8> data;
62
63 data.assign(buffer, buffer + sizeof(buffer));
64
65 EXPECT_TRUE(es_desc.Parse(data));
66 EXPECT_EQ(es_desc.object_type(), kISO_14496_3);
67 EXPECT_EQ(es_desc.decoder_specific_info().size(), 2u);
68 EXPECT_EQ(es_desc.decoder_specific_info()[0], 0x12);
69 EXPECT_EQ(es_desc.decoder_specific_info()[1], 0x10);
70 }
71
72 TEST(ESDescriptorTest, FiveByteLengthTest) {
73 ESDescriptor es_desc;
74 uint8 buffer[] = {
75 0x03, 0x80, 0x19, 0x00, 0x01, 0x00, 0x04, 0x80,
76 0x80, 0x11, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00,
77 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
78 0x80, 0x80, 0x80, 0x80, 0x02, 0x12, 0x10, 0x06,
79 0x01, 0x02
80 };
81 std::vector<uint8> data;
82
83 data.assign(buffer, buffer + sizeof(buffer));
84
85 EXPECT_TRUE(es_desc.Parse(data));
86 EXPECT_EQ(es_desc.object_type(), kISO_14496_3);
87 EXPECT_EQ(es_desc.decoder_specific_info().size(), 0u);
88 }
89
90 } // namespace mp4
91
92 } // namespace media
OLDNEW
« no previous file with comments | « media/mp4/es_descriptor.cc ('k') | media/mp4/mp4_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698