| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>media-source-append-overlapping-dts</title> |
| <script src="mock-media-source.js"></script> |
| <script src="../video-test.js"></script> |
| <script> |
| var source; |
| var sourceBuffer; |
| var initSegment; |
| |
| if (window.internals) |
| internals.initializeMockMediaSource(); |
| |
| window.addEventListener('load', async event => { |
| |
| findMediaElement(); |
| |
| source = new MediaSource(); |
| run('video.src = URL.createObjectURL(source)'); |
| await waitFor(source, 'sourceopen'); |
| |
| run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")'); |
| initSegment = makeAInit(8, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]); |
| run('sourceBuffer.appendBuffer(initSegment)'); |
| |
| await waitFor(sourceBuffer, 'updateend'); |
| |
| samples = concatenateSamples([ |
| makeASample(0, 0, 1, 1, 1, SAMPLE_FLAG.SYNC, 0), |
| makeASample(1, 1, 1, 1, 1, SAMPLE_FLAG.NONE, 0), |
| makeASample(2, 2, 1, 1, 1, SAMPLE_FLAG.NONE, 0), |
| makeASample(3, 3, 1, 1, 1, SAMPLE_FLAG.NONE, 0), |
| makeASample(4, 4, 1, 1, 1, SAMPLE_FLAG.SYNC, 0), |
| makeASample(5, 5, 1, 1, 1, SAMPLE_FLAG.NONE, 0), |
| makeASample(6, 6, 1, 1, 1, SAMPLE_FLAG.NONE, 0), |
| makeASample(7, 7, 1, 1, 1, SAMPLE_FLAG.NONE, 0), |
| ]); |
| run('sourceBuffer.appendBuffer(samples)'); |
| await waitFor(sourceBuffer, 'updateend'); |
| |
| samples = concatenateSamples([ |
| makeASample(6, 4, 1, 1, 1, SAMPLE_FLAG.SYNC, 1), |
| makeASample(7, 5, 1, 1, 1, SAMPLE_FLAG.NONE, 1), |
| makeASample(4, 6, 1, 1, 1, SAMPLE_FLAG.NONE, 1), |
| makeASample(5, 7, 1, 1, 1, SAMPLE_FLAG.NONE, 1), |
| ]); |
| run('sourceBuffer.appendBuffer(samples)'); |
| await waitFor(sourceBuffer, 'updateend'); |
| |
| bufferedSamples = await internals.bufferedSamplesForTrackId(sourceBuffer, 1); |
| testExpected("bufferedSamples.length", 9); |
| bufferedSamples.forEach(consoleWrite); |
| endTest(); |
| |
| }, {once: true}); |
| </script> |
| </head> |
| <body> |
| <div>This tests that an overlapping append of samples with reordered presentation timestamps will correctly remove previously appended non-reordered samples.</div> |
| <video></video> |
| </body> |
| </html> |