<video> element not garbage collected when a source is set |
||||||
Issue descriptionChrome Version: M-61+ What steps will reproduce the problem? (1) Load https://jsfiddle.net/op914008/1/ (2) Press the "Setup new video element" button (3) Repeat from (2) What is the expected result? When the <video> element is removed and references to it are dropped it should later be garbage collected. What happens instead? The <video> element is kept alive indefinitely which after a while make Chrome run into an internal limit of ~50 open streams. It's especially easy to see this behavior on Chrome OS when looking at open "Num active streams" in the result of 'cras_test_client --dump_s'. Setting videoElement.src = '' fixes the issue
,
Oct 4 2017
I've only actually observed that the streams remain active in CRAS, the part about garbage collection not happening and the possibility of a reference loop between the stream and the video element is just speculation.
,
Oct 4 2017
Do you see the same problem if you use srcObject instead of src and URLs?
,
Oct 4 2017
Never mind, the jsfiddle uses srcObject.
,
Oct 4 2017
,
Oct 4 2017
For the records: The bug appears both when using video.src and video.srcObject consistently for setting up and tearing down the video object. I updated the jsfiddle code to be consistent.
,
Oct 27 2017
Is this specific to streams coming from gUM?
,
Oct 30 2017
I'll take a look and will get back to the Blink>Media team if it's not specific to streams coming from gUM.
,
Nov 14 2017
,
Jan 18 2018
Any update on this issue?
,
Jan 18 2018
Patch is in review since yesterday actually! https://chromium-review.googlesource.com/c/chromium/src/+/867374
,
Mar 15 2018
What's the current state? Is the patch ready?
,
Apr 26 2018
Ping.
,
May 9 2018
Issue 701758 has been merged into this issue.
,
May 14 2018
,
May 15 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/fc2ee900e6e026e6c7ab0f804e64cec185959d2a commit fc2ee900e6e026e6c7ab0f804e64cec185959d2a Author: Guido Urdaneta <guidou@chromium.org> Date: Tue May 15 10:10:46 2018 Correctly update the networkState on media elements playing MediaStreams With this patch, the network state of elements playing inactive streams is NETWORK_IDLE and the state of elements playing active streams is NETWORK_LOADING. Before this CL, the network state was always NETWORK_LOADING, which prevented media elements from being garbage collected, which was a source of JavaScript memory leaks and made it easy to reach limits in the number of active low-level audio streams. Drive-by: Fix the case of addition of stopped tracks to a stream. Bug: 771550 Change-Id: Id0d8e27fc30c9850e5ad43d7a3887c03a9415a18 Reviewed-on: https://chromium-review.googlesource.com/1057808 Commit-Queue: Guido Urdaneta <guidou@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: Emircan Uysaler <emircan@chromium.org> Cr-Commit-Position: refs/heads/master@{#558655} [modify] https://crrev.com/fc2ee900e6e026e6c7ab0f804e64cec185959d2a/content/renderer/media/stream/webmediaplayer_ms.cc [modify] https://crrev.com/fc2ee900e6e026e6c7ab0f804e64cec185959d2a/content/renderer/media/stream/webmediaplayer_ms.h [add] https://crrev.com/fc2ee900e6e026e6c7ab0f804e64cec185959d2a/third_party/WebKit/LayoutTests/fast/mediastream/MediaStream-MediaElement-networkState.html [modify] https://crrev.com/fc2ee900e6e026e6c7ab0f804e64cec185959d2a/third_party/blink/public/platform/web_media_stream.h [modify] https://crrev.com/fc2ee900e6e026e6c7ab0f804e64cec185959d2a/third_party/blink/renderer/platform/mediastream/media_stream_descriptor.cc [modify] https://crrev.com/fc2ee900e6e026e6c7ab0f804e64cec185959d2a/third_party/blink/renderer/platform/mediastream/media_stream_descriptor.h
,
May 15 2018
,
Jun 7 2018
[bulk-edit: disregard if N/A] Can the owner please set milestone to this bug if applicable? |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by guidou@chromium.org
, Oct 4 2017Components: Blink>MediaStream Blink>Media
Status: Assigned (was: Untriaged)