This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
In the spec, in the duration change algorithm we have: http://w3c.github.io/media-source/index.html#duration-change-algorithm "3. Update duration to new duration. 4. If the new duration is less than old duration, then run the range removal algorithm with new duration and old duration as the start and end of the removal range. " Note that the mediasource duration is updated prior to running the range removal algorithm. The range removal algorithm will call the coded frame removal algorithm (http://w3c.github.io/media-source/index.html#sourcebuffer-coded-frame-removal) Which states: "1. Let start be the starting presentation timestamp for the removal range. 2. Let end be the end presentation timestamp for the removal range. 3. For each track buffer in this source buffer, run the following steps: 3.1 Let remove end timestamp be the current value of duration" So remove end timestamp is set to the value of duration that was just set in the duration change algorithm. Because of this no data will be removed. An example: Say mediasource duration was +oo We have an audio track buffered range of 0 to 65.85 We set the mediasource duration to 32.925. As such, coded frame removal is called with start = 32.925 and end = +oo remove end timestamp is set to 32.925s; In the loop we will remove any frames >= 32.925 and < 32.925, that is none. In coded frame removal algorithm it should read: 3.1 Let remove end timestamp be the maximum of duration and the highest end time of the track buffer time range. Another change could have been: In the duration algorithm it should read: "1. If the current value of duration is equal to new duration, then return. 2. Set old duration to the current value of duration. 3. If the new duration is less than old duration, then run the range removal algorithm with new duration and old duration as the start and end of the removal range. 4. Update duration to new duration. " (steps 3 and and 4 inverted) However, as the coded frame algorithm is run asynchronously, we need to ensure that the new duration is only set once the coded frame algorithm has completed its course. Alternatively, "duration" should be passed to the coded frame removal algorithm so it doesn't have to rely on the timing at which it will be set.
This bug has been migrated to the GitHub issue tracker. Please follow/update progress using the GitHub issue: https://github.com/w3c/media-source/issues/26