[webkit-reviews] review denied: [Bug 225800] [MSE] MediaSample that need to be removed with SourceBufferPrivate::evictCodedFrames() may not be removed. : [Attachment 428607] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 20 23:59:17 PDT 2021


Jer Noble <jer.noble at apple.com> has denied Toshio Ogasawara
<toshio.ogasawara at access-company.com>'s request for review:
Bug 225800: [MSE] MediaSample that need to be removed with
SourceBufferPrivate::evictCodedFrames() may not be removed.
https://bugs.webkit.org/show_bug.cgi?id=225800

Attachment 428607: patch

https://bugs.webkit.org/attachment.cgi?id=428607&action=review




--- Comment #6 from Jer Noble <jer.noble at apple.com> ---
Comment on attachment 428607
  --> https://bugs.webkit.org/attachment.cgi?id=428607
patch

> >Comparing `rangeEnd` to `mininimumRangeStart` feels wrong here. 
> 
> I think it is correct to compare with rangeEnd.

No, it's definitely not. You can see why it's wrong here:

-	     rangeEnd = buffered.start(endTimeRange);
+	     if (endTimeRange == notFound)
+		 rangeStart = buffered.end(startTimeRange);
+	     else
+		 rangeEnd = buffered.start(endTimeRange);

If that comparison was correct, this change would be unnecessary. This just
adds a complicated calculation to an already overcomplicated while loop.

The correct fix would look more like this:

@@ -689,7 +689,7 @@ void SourceBufferPrivate::evictCodedFrames(uint64_t
newDataSize, uint64_t pendin
	 return;
     }

-    MediaTime minimumRangeStart = currentTime + thirtySeconds;
+    MediaTime minimumRangeStart = std::min(currentTime + thirtySeconds,
buffered.end(currentTimeRange));

     rangeEnd = duration;
     if (!rangeEnd.isFinite()) {

This sets up minimumRangeStart correctly to be located at the end of the
current range, or 30s after currentTime, whichever is lower.

@@ -701,16 +701,6 @@ void SourceBufferPrivate::evictCodedFrames(uint64_t
newDataSize, uint64_t pendin

     rangeStart = rangeEnd - thirtySeconds;
     while (rangeStart > minimumRangeStart) {
-	 // Do not evict data from the time range that contains currentTime.
-	 uint64_t startTimeRange = buffered.find(rangeStart);
-	 if (currentTimeRange != notFound && startTimeRange ==
currentTimeRange) {
-	     uint64_t endTimeRange = buffered.find(rangeEnd);
-	     if (currentTimeRange != notFound && endTimeRange ==
currentTimeRange)
-		 break;
-
-	     rangeEnd = buffered.start(endTimeRange);
-	 }
-

And now we don't need to do a complicated recalculation at every step through
the loop. It just walks back in 30s increments until it reaches
minimumRangeStart.


More information about the webkit-reviews mailing list