[TTVD] Fix range calculation after end of stream 99/325099/4
authorJakub Gajownik <j.gajownik2@samsung.com>
Fri, 23 May 2025 11:05:29 +0000 (13:05 +0200)
committerj.gajownik2 <j.gajownik2@samsung.com>
Mon, 2 Jun 2025 15:44:50 +0000 (15:44 +0000)
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>
media/filters/tizen/lazy_frame_ranges.cc
media/filters/tizen/lazy_frame_ranges_test.cc

index 51d53adca62d445527d23a72dc81fbc783c4f170..511f04c99df8a18fe25b3d6d5ddda3c2b3645962 100644 (file)
@@ -12,8 +12,7 @@ void LazyFrameRanges::Insert(const DecoderBuffer& buffer) {
   // 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) {
index 9642aa9ca61a181eb228b1461b11e7f27c911ac1..08ab335aa9cbe34d2855be1c34cf1653909e07de 100644 (file)
@@ -176,4 +176,13 @@ TEST_F(LazyFrameRangesTest, FillGap) {
   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