| 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/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "media/base/buffers.h" | 10 #include "media/base/buffers.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 EsParserAdts es_parser( | 40 EsParserAdts es_parser( |
| 41 base::Bind(&EsParserAdtsTest::NewAudioConfig, base::Unretained(this)), | 41 base::Bind(&EsParserAdtsTest::NewAudioConfig, base::Unretained(this)), |
| 42 base::Bind(&EsParserAdtsTest::EmitBuffer, base::Unretained(this)), | 42 base::Bind(&EsParserAdtsTest::EmitBuffer, base::Unretained(this)), |
| 43 false); | 43 false); |
| 44 return ProcessPesPackets(&es_parser, pes_packets, force_timing); | 44 return ProcessPesPackets(&es_parser, pes_packets, force_timing); |
| 45 } | 45 } |
| 46 | 46 |
| 47 TEST_F(EsParserAdtsTest, NoInitialPts) { | 47 TEST_F(EsParserAdtsTest, NoInitialPts) { |
| 48 LoadStream("bear.adts"); | 48 LoadStream("bear.adts"); |
| 49 std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); | 49 std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); |
| 50 EXPECT_FALSE(Process(pes_packets, false)); | 50 // Process should succeed even without timing info, we should just skip the |
| 51 // audio frames without timing info, but still should be able to parse and |
| 52 // play the stream after that. |
| 53 EXPECT_TRUE(Process(pes_packets, false)); |
| 54 EXPECT_EQ(1u, config_count_); |
| 51 EXPECT_EQ(0u, buffer_count_); | 55 EXPECT_EQ(0u, buffer_count_); |
| 52 } | 56 } |
| 53 | 57 |
| 54 TEST_F(EsParserAdtsTest, SinglePts) { | 58 TEST_F(EsParserAdtsTest, SinglePts) { |
| 55 LoadStream("bear.adts"); | 59 LoadStream("bear.adts"); |
| 56 | 60 |
| 57 std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); | 61 std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); |
| 58 pes_packets.front().pts = base::TimeDelta::FromSeconds(10); | 62 pes_packets.front().pts = base::TimeDelta::FromSeconds(10); |
| 59 | 63 |
| 60 EXPECT_TRUE(Process(pes_packets, false)); | 64 EXPECT_TRUE(Process(pes_packets, false)); |
| 61 EXPECT_EQ(1u, config_count_); | 65 EXPECT_EQ(1u, config_count_); |
| 62 EXPECT_EQ(45u, buffer_count_); | 66 EXPECT_EQ(45u, buffer_count_); |
| 63 } | 67 } |
| 64 | 68 |
| 65 } // namespace mp2t | 69 } // namespace mp2t |
| 66 } // namespace media | 70 } // namespace media |
| 67 | 71 |
| OLD | NEW |