durationchange event can be sent after update/updateend event (MSE appendBuffer() case)
Reported by
ddy...@vewd.com,
Oct 20 2017
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36 Example URL: https://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2018.html?test_type=conformance-test&command=run&tests=31 Steps to reproduce the problem: With https://bugs.chromium.org/p/chromium/issues/detail?id=776704 fixed it should be easy to reproduce going with this reproduction scenario. ----- 1. Host attached test case on any web server (it's stripped down version of 2018's QUAL MSE-conformance, mainly test `31. DurationAfterAppendOpusAudio`) 2. Run in Chrome/Chromium link: http://localhost/path/to/attached/qual/test/2018.html?test_type=conformance-test&command=run&tests=31 3. Observe printed logs 3.1. There are some extra logs added which will print fired events (they start with `###`) 4. Note that `durationchange` event will come after `updateend` and not between `updatestart` and `update` events. Version with plan QUAL 2018 (MSE-conformance test) using built-in DevTools: 1. Run: https://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2018.html?test_type=conformance-test&command=run&tests=31 2. Open DevTools -> Sources tab 3. Open file from unit-tests/js/tests/2018/conformanceTest-$ver$.js 4. Find `createDurationAfterAppendTest()` function 5. Add some extra logs in there on `media` variable for `durationchange` event on HTMLMediaElement and `updatestart`, `update` and `updateend` events on SourceBuffer object. 6. Note that `durationchange` event will come after `updateend` and not between `updatestart` and `update` events. What is the expected behavior? According to MSE specification (https://www.w3.org/TR/media-source/) when `appendBuffer()` is called on SourceBuffer object (https://www.w3.org/TR/media-source/#dom-sourcebuffer-appendbuffer), we should do: ... 4. Queue a task to fire a simple event named updatestart at this SourceBuffer object. 5. Asynchronously run the buffer append algorithm. Now if we inspect buffer append algorithm (https://www.w3.org/TR/media-source/#sourcebuffer-buffer-append), we will note that the order of steps is as follows: 1. Run the segment parser loop algorithm. ... 4. Queue a task to fire a simple event named update at this SourceBuffer object. 5. Queue a task to fire a simple event named updateend at this SourceBuffer object. If we inspect "segment parser loop algorithm" (https://www.w3.org/TR/media-source/#sourcebuffer-segment-parser-loop) we can find that it might lead to duration change algorithm (either when parsing initialization segment or media segment exceeds current duration) and that algorithm (https://www.w3.org/TR/media-source/#duration-change-algorithm) invokes HTMLMediaElement duration change algorithm (https://www.w3.org/TR/html51/semantics-embedded-content.html#durationChange) which forces browser to fire `durationchange` event. As we can see, that `durationchange` event SHOULD be sent BEFORE firing `update` and `updateend` events. What went wrong? In Chrome/Chromium, `durationchange` event can came AFTER firing `update` and `updateend` events. This is due to the fact, that code in `SourceBuffer::AppendBufferAsyncPart()` (https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp?sq=package:chromium&l=1219) invokes `WebSourceBufferImpl::Append()` (https://cs.chromium.org/chromium/src/media/blink/websourcebuffer_impl.cc?sq=package:chromium&l=132) for last chunk of data and then immediately schedules events `update` and `updateend`. The problem is that this code assumes that `Append()` call on `WebSourceBuffer` there is synchronous, but in fact this is not true! This append will lead right through: `ChunkDemuxer::AppendData()` (https://cs.chromium.org/chromium/src/media/filters/chunk_demuxer.cc?sq=package:chromium&l=859) (right here it will go through some classes, but if it will parse initialization segment and find duration, or it will parse media segment which exceeds current duration, then this will be called:) `ChunkDemuxer::UpdateDuration()` (https://cs.chromium.org/chromium/src/media/filters/chunk_demuxer.cc?sq=package:chromium&l=1313) and this will go through ` PipelineImpl::RendererWrapper::SetDuration()` (https://cs.chromium.org/chromium/src/media/base/pipeline_impl.cc?sq=package:chromium&l=503) which post-tasks work regarding setting duration. Due to that fact, Chromium will first issue `update` and `updateend` events (on the same task) and only when that posted task will execute, only then `durationchange` event will be called. Did this work before? N/A Is it a problem with Flash or HTML5? HTML5 Does this work in other browsers? N/A Chrome version: 62.0.3202.62 Channel: stable OS Version: Flash Version: Contents of chrome://gpu: Note: To properly save this page, select the "Webpage, Complete" option in the Save File dialog. Graphics Feature Status Canvas: Software only, hardware acceleration unavailable CheckerImaging: Disabled Flash: Software only, hardware acceleration unavailable Flash Stage3D: Software only, hardware acceleration unavailable Flash Stage3D Baseline profile: Software only, hardware acceleration unavailable Compositing: Software only, hardware acceleration unavailable Multiple Raster Threads: Enabled Native GpuMemoryBuffers: Software only. Hardware acceleration disabled Rasterization: Software only, hardware acceleration unavailable Video Decode: Software only, hardware acceleration unavailable Video Encode: Software only, hardware acceleration unavailable WebGL: Hardware accelerated but at reduced performance WebGL2: Unavailable Problems Detected ATI/AMD cards with older drivers in Linux are crash-prone: 71381, 76428, 73910, 101225, 136240, 357314 Disabled Features: flash_stage3d, gpu_compositing, panel_fitting, flash3d, gpu_rasterization, accelerated_2d_canvas, accelerated_video_decode, webgl2, accelerated_webgl, flash_stage3d_baseline, accelerated_video_encode Accelerated video decode is unavailable on Linux: 137247 Disabled Features: accelerated_video_decode Accelerated video encode is unavailable on Linux Disabled Features: accelerated_video_encode Native GpuMemoryBuffers have been disabled, either via about:flags or command line. Disabled Features: native_gpu_memory_buffers Checker-imaging has been disabled via finch trial or the command line. Disabled Features: checker_imaging Version Information Data exported 10/20/2017, 1:56:55 PM Chrome version Chrome/62.0.3202.62 Operating system Linux 4.10.0-37-generic Software rendering list version 13.12 Driver bug list version 10.30 ANGLE commit id e8ef2bc4bd01 2D graphics backend Skia/62 e74b41c6c84638d5a9ee6d254a715bcd9e17c603- Command Line /usr/bin/google-chrome-stable --enable-blink-features=MediaSourceNewAbortAndDuration --flag-switches-begin --flag-switches-end Driver Information Initialization time 0 In-process GPU true Passthrough Command Decoder false Supports overlays false Sandboxed false GPU0 VENDOR = 0x1002, DEVICE= 0x6610 Optimus false Optimus false AMD switchable false Driver vendor Google Inc. Driver version 3.3.0.2 Driver date 2017/04/07 Pixel shader version 3.0 Vertex shader version 3.0 Max. MSAA samples 4 Machine model name Machine model version GL_VENDOR Google Inc. GL_RENDERER Google SwiftShader GL_VERSION OpenGL ES 2.0 SwiftShader GL_EXTENSIONS Disabled Extensions Window system binding vendor Window system binding version Window system binding extensions Window manager Compiz XDG_CURRENT_DESKTOP Unity GDMSESSION ubuntu Compositing manager Yes Direct rendering Yes Reset notification strategy 0x0000 GPU process crash count 0 System visual ID 0 RGBA visual ID 0 Compositor Information Tile Update Mode One-copy Partial Raster Enabled GpuMemoryBuffers Status ATC Software only ATCIA Software only DXT1 Software only DXT5 Software only ETC1 Software only R_8 Software only R_16 Software only RG_88 Software only BGR_565 Software only RGBA_4444 Software only RGBX_8888 Software only RGBA_8888 Software only BGRX_8888 Software only BGRA_8888 Software only RGBA_F16 Software only YVU_420 Software only YUV_420_BIPLANAR Software only UYVY_422 Software only - Much easier to reproduce when https://bugs.chromium.org/p/chromium/issues/detail?id=776704 will be finished. - Breaks conformance with MSE specification.
,
Oct 20 2017
,
Oct 23 2017
Thanks for reporting this issue. I have some pending related clean-up drafted (but not ready for review or landing yet) already in https://chromium-review.googlesource.com/c/chromium/src/+/611046 to which I'll note that it should also eventually include a fix for this issue. |
|||
►
Sign in to add a comment |
|||
Comment 1 by manoranj...@chromium.org
, Oct 20 2017