Per spec MSE spec and the Coded Frame Processing algorithm [1] "5. if the media segment contains data beyond the current duration, then run the duration change algorithm with new duration set to the maximum of the current duration and the [[group end timestamp]]." Which occurs once all frames of a buffer added to a source buffer have been processed. However, the SourceBufferPrivate.cpp didReceiveSample performs this step for every single frame received. https://jyavenard.github.io/htmltests/tests/mse_webm/vorbis_timestampOffset.html (need bug 252782 fixed) results in the following result: ``` 1237: ok(true) Receive a sourceopen event 1303: got abort event 1303: got emptied event 1306: got loadstart event 1371: got durationchange event 1373: got loadedmetadata event 1374: got durationchange event 1381: Append a media segment. 1390: SourceBuffer buffered ranges grew from TimeRanges: to TimeRanges: [0, 1.3392199546485262) 1390: Append a media segment. 1439: got durationchange event 1440: got loadeddata event 1440: got canplay event 1441: got canplaythrough event 1457: SourceBuffer buffered ranges grew from TimeRanges: [0, 1.3392199546485262) to TimeRanges: [0, 2.678440657773526) 1458: Append a media segment. 1520: got durationchange event 1521: got durationchange event 1522: got durationchange event 1522: got durationchange event 1523: got durationchange event 1523: got durationchange event 1524: got durationchange event 1525: got durationchange event 1526: got durationchange event 1526: got durationchange event 1527: got durationchange event 1528: got durationchange event 1529: got durationchange event 1530: got durationchange event 1530: got durationchange event 1531: got durationchange event 1532: got durationchange event 1532: got durationchange event 1533: got durationchange event 1534: got durationchange event 1535: got durationchange event 1537: got durationchange event 1538: got durationchange event 1539: got durationchange event 1539: got durationchange event 1540: got durationchange event 1541: got durationchange event ``` We get one `durationchange` event for every single frame added to the second buffer after the initial `durationchange` fired following the first segment. Only one `durationchange` event should be fired. [1] https://w3c.github.io/media-source/#sourcebuffer-coded-frame-processing the last step is: [2] https://searchfox.org/wubkat/rev/e4f3157afc6ca0cf36b48e57e2337b4ceb66d459/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp#1088-1093
<rdar://problem/105870526>
Pull request: https://github.com/WebKit/WebKit/pull/10777
Committed 261029@main (04a684748a69): <https://commits.webkit.org/261029@main> Reviewed commits have been landed. Closing PR #10777 and removing active labels.