diff options
Diffstat (limited to 'media/mp4/mp4_stream_parser_unittest.cc')
-rw-r--r-- | media/mp4/mp4_stream_parser_unittest.cc | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/media/mp4/mp4_stream_parser_unittest.cc b/media/mp4/mp4_stream_parser_unittest.cc index db2555f..63e1382 100644 --- a/media/mp4/mp4_stream_parser_unittest.cc +++ b/media/mp4/mp4_stream_parser_unittest.cc @@ -28,21 +28,16 @@ class MP4StreamParserTest : public testing::Test { public: MP4StreamParserTest() : parser_(new MP4StreamParser(false)), - got_configs_(false) { + configs_received_(false) { } protected: scoped_ptr<MP4StreamParser> parser_; base::TimeDelta segment_start_; - bool got_configs_; + bool configs_received_; bool AppendData(const uint8* data, size_t length) { - parser_->Parse(data, length); - return true; - } - - bool AppendDataInPieces(const uint8* data, size_t length) { - return AppendDataInPieces(data, length, 7); + return parser_->Parse(data, length); } bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { @@ -71,8 +66,8 @@ class MP4StreamParserTest : public testing::Test { // TODO(strobe): Until http://crbug.com/122913 is fixed, we want to make // sure that this callback isn't called more than once per stream. Remove // when that bug is fixed. - EXPECT_FALSE(got_configs_); - got_configs_ = true; + EXPECT_FALSE(configs_received_); + configs_received_ = true; return true; } @@ -83,7 +78,7 @@ class MP4StreamParserTest : public testing::Test { DVLOG(3) << " n=" << buf - bufs.begin() << ", size=" << (*buf)->GetDataSize() << ", dur=" << (*buf)->GetDuration().InMilliseconds(); - EXPECT_LE(segment_start_, (*buf)->GetTimestamp()); + EXPECT_GE((*buf)->GetTimestamp(), segment_start_); } return true; } @@ -108,22 +103,28 @@ class MP4StreamParserTest : public testing::Test { base::Bind(&MP4StreamParserTest::NewSegmentF, base::Unretained(this))); } - bool ParseMP4File(const std::string& filename, int append_size) { + bool ParseMP4File(const std::string& filename, int append_bytes) { InitializeParser(); scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename); EXPECT_TRUE(AppendDataInPieces(buffer->GetData(), buffer->GetDataSize(), - append_size)); + append_bytes)); return true; } }; -TEST_F(MP4StreamParserTest, TestParseBearDASH) { + + +TEST_F(MP4StreamParserTest, TestUnalignedAppend) { + // Test small, non-segment-aligned appends (small enough to exercise + // incremental append system) ParseMP4File("bear.1280x720_dash.mp4", 512); } TEST_F(MP4StreamParserTest, TestMultiFragmentAppend) { + // Large size ensures multiple fragments are appended in one call (size is + // larger than this particular test file) ParseMP4File("bear.1280x720_dash.mp4", 768432); } |