[Webkit-unassigned] [Bug 225800] [MSE] MediaSample that need to be removed with SourceBufferPrivate::evictCodedFrames() may not be removed.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu May 20 23:59:17 PDT 2021
https://bugs.webkit.org/show_bug.cgi?id=225800
Jer Noble <jer.noble at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #428607|review? |review-
Flags| |
--- 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.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210521/43557fc3/attachment.htm>
More information about the webkit-unassigned
mailing list