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

Unified Diff: media/formats/mp2t/es_parser_adts_unittest.cc

Issue 2063443002: Return parsed sample frequency of ADTS header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SBR Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/formats/mp2t/es_parser_adts.cc ('k') | media/formats/mp2t/es_parser_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp2t/es_parser_adts_unittest.cc
diff --git a/media/formats/mp2t/es_parser_adts_unittest.cc b/media/formats/mp2t/es_parser_adts_unittest.cc
index 59fa85047c1cf298a54a4a7f1db92614968b4dbe..1303e59fc9e4c671aaa220d446f2b9bc975861dc 100644
--- a/media/formats/mp2t/es_parser_adts_unittest.cc
+++ b/media/formats/mp2t/es_parser_adts_unittest.cc
@@ -17,6 +17,9 @@ namespace media {
class AudioDecoderConfig;
namespace mp2t {
+namespace {
+const char kAac44100PacketTimestamp[] = "(0) (23) (46) (69)";
+}
class EsParserAdtsTest : public EsParserTestBase,
public testing::Test {
@@ -24,7 +27,7 @@ class EsParserAdtsTest : public EsParserTestBase,
EsParserAdtsTest();
protected:
- bool Process(const std::vector<Packet>& pes_packets, bool force_timing);
+ bool Process(const std::vector<Packet>& pes_packets, bool sbr_in_mimetype);
private:
DISALLOW_COPY_AND_ASSIGN(EsParserAdtsTest);
@@ -33,14 +36,13 @@ class EsParserAdtsTest : public EsParserTestBase,
EsParserAdtsTest::EsParserAdtsTest() {
}
-bool EsParserAdtsTest::Process(
- const std::vector<Packet>& pes_packets,
- bool force_timing) {
+bool EsParserAdtsTest::Process(const std::vector<Packet>& pes_packets,
+ bool sbr_in_mimetype) {
EsParserAdts es_parser(
base::Bind(&EsParserAdtsTest::NewAudioConfig, base::Unretained(this)),
base::Bind(&EsParserAdtsTest::EmitBuffer, base::Unretained(this)),
- false);
- return ProcessPesPackets(&es_parser, pes_packets, force_timing);
+ sbr_in_mimetype);
+ return ProcessPesPackets(&es_parser, pes_packets, false /* force_timing */);
chcunningham 2016/06/14 00:13:07 Missed one ;)
yucliu1 2016/06/14 00:23:28 Which one is missing?
yucliu1 2016/06/14 22:01:05 Ping~ I'm not sure what I'm missing here.
chcunningham 2016/06/14 23:27:41 sorry, I just mean that your comment says force_ti
yucliu1 2016/06/14 23:42:25 Ah, this one should be force_timing. It's used in
}
TEST_F(EsParserAdtsTest, NoInitialPts) {
@@ -49,7 +51,7 @@ TEST_F(EsParserAdtsTest, NoInitialPts) {
// Process should succeed even without timing info, we should just skip the
// audio frames without timing info, but still should be able to parse and
// play the stream after that.
- EXPECT_TRUE(Process(pes_packets, false));
+ EXPECT_TRUE(Process(pes_packets, false /* sbr_in_mimetype */));
EXPECT_EQ(1u, config_count_);
EXPECT_EQ(0u, buffer_count_);
}
@@ -60,7 +62,7 @@ TEST_F(EsParserAdtsTest, SinglePts) {
std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512);
pes_packets.front().pts = base::TimeDelta::FromSeconds(10);
- EXPECT_TRUE(Process(pes_packets, false));
+ EXPECT_TRUE(Process(pes_packets, false /* sbr_in_mimetype */));
EXPECT_EQ(1u, config_count_);
EXPECT_EQ(45u, buffer_count_);
}
@@ -69,10 +71,20 @@ TEST_F(EsParserAdtsTest, AacLcAdts) {
LoadStream("sfx.adts");
std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512);
pes_packets.front().pts = base::TimeDelta::FromSeconds(1);
- EXPECT_TRUE(Process(pes_packets, false));
+ EXPECT_TRUE(Process(pes_packets, false /* sbr_in_mimetype */));
EXPECT_EQ(1u, config_count_);
EXPECT_EQ(14u, buffer_count_);
}
+
+TEST_F(EsParserAdtsTest, AacSampleRate) {
+ std::vector<Packet> pes_packets =
+ LoadPacketsFromFiles("aac-44100-packet-%d", 4);
+
+ pes_packets.front().pts = base::TimeDelta::FromSeconds(0);
+ EXPECT_TRUE(Process(pes_packets, true /* sbr_in_mimetype */));
+ EXPECT_EQ(4u, buffer_count_);
+ EXPECT_EQ(kAac44100PacketTimestamp, buffer_timestamps_);
+}
} // namespace mp2t
} // namespace media
« no previous file with comments | « media/formats/mp2t/es_parser_adts.cc ('k') | media/formats/mp2t/es_parser_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698