OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class EsParserMpeg1AudioTest : public EsParserTestBase, | 22 class EsParserMpeg1AudioTest : public EsParserTestBase, |
23 public testing::Test { | 23 public testing::Test { |
24 public: | 24 public: |
25 EsParserMpeg1AudioTest(); | 25 EsParserMpeg1AudioTest(); |
26 | 26 |
27 protected: | 27 protected: |
28 bool Process(const std::vector<Packet>& pes_packets, bool force_timing); | 28 bool Process(const std::vector<Packet>& pes_packets, bool force_timing); |
29 | 29 |
30 private: | 30 private: |
| 31 MediaLog media_log_; |
31 DISALLOW_COPY_AND_ASSIGN(EsParserMpeg1AudioTest); | 32 DISALLOW_COPY_AND_ASSIGN(EsParserMpeg1AudioTest); |
32 }; | 33 }; |
33 | 34 |
34 EsParserMpeg1AudioTest::EsParserMpeg1AudioTest() { | 35 EsParserMpeg1AudioTest::EsParserMpeg1AudioTest() { |
35 } | 36 } |
36 | 37 |
37 bool EsParserMpeg1AudioTest::Process( | 38 bool EsParserMpeg1AudioTest::Process( |
38 const std::vector<Packet>& pes_packets, | 39 const std::vector<Packet>& pes_packets, |
39 bool force_timing) { | 40 bool force_timing) { |
40 EsParserMpeg1Audio es_parser( | 41 EsParserMpeg1Audio es_parser( |
41 base::Bind(&EsParserMpeg1AudioTest::NewAudioConfig, | 42 base::Bind(&EsParserMpeg1AudioTest::NewAudioConfig, |
42 base::Unretained(this)), | 43 base::Unretained(this)), |
43 base::Bind(&EsParserMpeg1AudioTest::EmitBuffer, base::Unretained(this)), | 44 base::Bind(&EsParserMpeg1AudioTest::EmitBuffer, base::Unretained(this)), |
44 new MediaLog()); | 45 &media_log_); |
45 return ProcessPesPackets(&es_parser, pes_packets, force_timing); | 46 return ProcessPesPackets(&es_parser, pes_packets, force_timing); |
46 } | 47 } |
47 | 48 |
48 TEST_F(EsParserMpeg1AudioTest, SinglePts) { | 49 TEST_F(EsParserMpeg1AudioTest, SinglePts) { |
49 LoadStream("sfx.mp3"); | 50 LoadStream("sfx.mp3"); |
50 | 51 |
51 std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); | 52 std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); |
52 pes_packets.front().pts = base::TimeDelta::FromSeconds(10); | 53 pes_packets.front().pts = base::TimeDelta::FromSeconds(10); |
53 | 54 |
54 // Note: there is no parsing of metadata as part of Mpeg2 TS, | 55 // Note: there is no parsing of metadata as part of Mpeg2 TS, |
(...skipping 18 matching lines...) Expand all Loading... |
73 // Process should succeed even without timing info, we should just skip the | 74 // Process should succeed even without timing info, we should just skip the |
74 // audio frames without timing info, but still should be able to parse and | 75 // audio frames without timing info, but still should be able to parse and |
75 // play the stream after that. | 76 // play the stream after that. |
76 EXPECT_TRUE(Process(pes_packets, false)); | 77 EXPECT_TRUE(Process(pes_packets, false)); |
77 EXPECT_EQ(1u, config_count_); | 78 EXPECT_EQ(1u, config_count_); |
78 EXPECT_EQ(0u, buffer_count_); | 79 EXPECT_EQ(0u, buffer_count_); |
79 } | 80 } |
80 | 81 |
81 } // namespace mp2t | 82 } // namespace mp2t |
82 } // namespace media | 83 } // namespace media |
OLD | NEW |