blob: 27b5e4f2edb8c5f0dedc833548ddb9f9a7a5cbb6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright 2014 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/common/stream_parser_test_base.h"
#include "media/formats/mpeg/adts_stream_parser.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
class ADTSStreamParserTest : public StreamParserTestBase, public testing::Test {
public:
ADTSStreamParserTest()
: StreamParserTestBase(make_scoped_ptr(new ADTSStreamParser())) {}
};
// Test parsing with small prime sized chunks to smoke out "power of
// 2" field size assumptions.
TEST_F(ADTSStreamParserTest, UnalignedAppend) {
const std::string expected =
"NewSegment"
"{ 0K }"
"{ 0K }"
"{ 0K }"
"{ 0K }"
"{ 0K }"
"{ 0K }"
"{ 0K }"
"{ 0K }"
"{ 0K }"
"EndOfSegment"
"NewSegment"
"{ 0K }"
"{ 0K }"
"{ 0K }"
"{ 0K }"
"{ 0K }"
"EndOfSegment";
EXPECT_EQ(expected, ParseFile("sfx.adts", 17));
}
// Test parsing with a larger piece size to verify that multiple buffers
// are passed to |new_buffer_cb_|.
TEST_F(ADTSStreamParserTest, UnalignedAppend512) {
const std::string expected =
"NewSegment"
"{ 0K 23K 46K }"
"{ 0K 23K 46K 69K 92K }"
"{ 0K 23K 46K 69K 92K }"
"EndOfSegment"
"NewSegment"
"{ 0K }"
"EndOfSegment";
EXPECT_EQ(expected, ParseFile("sfx.adts", 512));
}
} // namespace media
|