| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 EsParserMpeg1AudioTest::EsParserMpeg1AudioTest() { | 34 EsParserMpeg1AudioTest::EsParserMpeg1AudioTest() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool EsParserMpeg1AudioTest::Process( | 37 bool EsParserMpeg1AudioTest::Process( |
| 38 const std::vector<Packet>& pes_packets, | 38 const std::vector<Packet>& pes_packets, |
| 39 bool force_timing) { | 39 bool force_timing) { |
| 40 EsParserMpeg1Audio es_parser( | 40 EsParserMpeg1Audio es_parser( |
| 41 base::Bind(&EsParserMpeg1AudioTest::NewAudioConfig, | 41 base::Bind(&EsParserMpeg1AudioTest::NewAudioConfig, |
| 42 base::Unretained(this)), | 42 base::Unretained(this)), |
| 43 base::Bind(&EsParserMpeg1AudioTest::EmitBuffer, | 43 base::Bind(&EsParserMpeg1AudioTest::EmitBuffer, base::Unretained(this)), |
| 44 base::Unretained(this)), | 44 new MediaLog()); |
| 45 LogCB()); | |
| 46 return ProcessPesPackets(&es_parser, pes_packets, force_timing); | 45 return ProcessPesPackets(&es_parser, pes_packets, force_timing); |
| 47 } | 46 } |
| 48 | 47 |
| 49 TEST_F(EsParserMpeg1AudioTest, SinglePts) { | 48 TEST_F(EsParserMpeg1AudioTest, SinglePts) { |
| 50 LoadStream("sfx.mp3"); | 49 LoadStream("sfx.mp3"); |
| 51 | 50 |
| 52 std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); | 51 std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); |
| 53 pes_packets.front().pts = base::TimeDelta::FromSeconds(10); | 52 pes_packets.front().pts = base::TimeDelta::FromSeconds(10); |
| 54 | 53 |
| 55 // Note: there is no parsing of metadata as part of Mpeg2 TS, | 54 // Note: there is no parsing of metadata as part of Mpeg2 TS, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 74 // Process should succeed even without timing info, we should just skip the | 73 // Process should succeed even without timing info, we should just skip the |
| 75 // audio frames without timing info, but still should be able to parse and | 74 // audio frames without timing info, but still should be able to parse and |
| 76 // play the stream after that. | 75 // play the stream after that. |
| 77 EXPECT_TRUE(Process(pes_packets, false)); | 76 EXPECT_TRUE(Process(pes_packets, false)); |
| 78 EXPECT_EQ(1u, config_count_); | 77 EXPECT_EQ(1u, config_count_); |
| 79 EXPECT_EQ(0u, buffer_count_); | 78 EXPECT_EQ(0u, buffer_count_); |
| 80 } | 79 } |
| 81 | 80 |
| 82 } // namespace mp2t | 81 } // namespace mp2t |
| 83 } // namespace media | 82 } // namespace media |
| OLD | NEW |