After end of stream, we can still use same ranges without
clearing them (e.g after eos is elided for configuration
change). Before this patch, in such situation ranges always
returned that any pts is in range which is not correct.
Instead of setting range to inifinity, it's patched to
contain all the previous timestamps.
Bug: https://jira-eu.sec.samsung.net/browse/VDGAME-709
Change-Id: I6563e0a134dad2c165d86c13c0e2f97c76ffbff5
Signed-off-by: Jakub Gajownik <j.gajownik2@samsung.com>
// Check for EOS packet, which has |kNoTimestamp| dts.
if (buffer.end_of_stream()) {
if (ranges_.size() != 0) {
- ranges_.clear();
- ranges_.Add(base::TimeDelta::Min(), base::TimeDelta::Max());
+ ranges_.Add(ranges_.start(0), ranges_.end(ranges_.size() - 1));
}
} else if (buffer.dts() != kNoTimestamp) {
if (last_dts_ != kNoTimestamp) {
EXPECT_TRUE(ranges.IsInRange(base::Milliseconds(15)));
}
+TEST_F(LazyFrameRangesTest, RangeIsCorrectAfterEos) {
+ InsertKeyframe(base::Milliseconds(0), base::Milliseconds(0));
+ EXPECT_TRUE(ranges.IsInRange(base::Milliseconds(0)));
+
+ InsertEOS();
+
+ EXPECT_FALSE(ranges.IsInRange(base::Milliseconds(10)));
+}
+
} // namespace media