New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 824866 link

Starred by 7 users

Issue metadata

Status: WontFix
Owner:
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 1
Type: Bug-Regression



Sign in to add a comment

local (and remote) video does not get black after setting MediaStreamTrack.enabled = false

Reported by fi...@appear.in, Mar 22 2018

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/64.0.3282.167 Chrome/64.0.3282.167 Safari/537.36

Steps to reproduce the problem:
I've been investigating failures of the automated webrtc tests for appear.in. It seems there is an issue with the video not going black in the following scenario

1. open an appear.in room in two chrome tabs
2. make sure both tabs are connected and sending video to each other
3. mute video in the first tab

I am use chrome fake devices.

What is the expected behavior?
the first tab (or browser windows) should send black video. My tests complain the video sent is not black.

What went wrong?
The video is hidden (using an angular ng-hidden class) after the user mutes. This also sets the MediaStreamTrack's enabled attribute to false.
Additionally the video stream is released after five seconds but there should be blackness sent so that is probably just inconvenient.

This is reproducible but only 20-30% of the time.

I've seen two incarnations of this:
1) local video is black, remote video is not (freeze2.png)
2) both local and remote video is not black (scrot3.png)

The actual video element can be make visible by pasting this into the JS console:
document.querySelectorAll(".jstest-video-frame").forEach(e => e.classList.remove("ng-hide"))

Since this started happening in M66 I suspected autoplay (due to the experience with  issue 804091 ) I ran a couple of tests with no command line flag and specifying --autoplay-policy=no-user-gesture-required

Out of 40 runs with no-user-gesture-required none failed.
10 out of 40 runs with no command line flag failed.

This suggests it might be related to the autoplay changes.

Did this work before? Yes M65

Does this work in other browsers? Yes

Chrome version: Google Chrome 66.0.3359.45  Channel: n/a
OS Version: 
Flash Version: 

as far as I can see this does not impact the actual user-visible behaviour but the test is somewhat important for us to ensure that the mute functionality actually sends black video.
 
freeze2.png
224 KB View Download
scrot3.png
193 KB View Download
Labels: Needs-Bisect Needs-Triage-M66
Cc: sindhu.chelamcherla@chromium.org
Labels: Triaged-ET Needs-Feedback
Unable to reproduce this issue on reported version 66.0.3359.45 using Ubuntu 17.10 with steps mentioned in comment#0.

1. Started video call in appear.in and joined in another tab.
2. Muted video of first tab and didn't observe video on both first and second tabs. Attaching screenshot for reference. 

@Reporter: Could you please let us know if we miss anything from steps. Any further information on reproducing the issue will be helpful.

Thanks!
824866.png
1.7 MB View Download

Comment 3 by fi...@appear.in, Mar 23 2018

#2: you need to run this in the JS console:
document.querySelectorAll(".jstest-video-frame").forEach(e => e.classList.remove("ng-hide"))
and check that the upper left and lower right videos are black. Also unclear if this works with real hardware or if its just with the --use-fake-device-for-media-stream command line flag.

Also reproducibility is somewhere between 10 and 20%. I can attach a screen recording if that helps.
Project Member

Comment 4 by sheriffbot@chromium.org, Mar 23 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: mlamouri@chromium.org
Labels: -Needs-Bisect
As per comment#3 checked the issue on reported version 66.0.3359.45 using Ubuntu 17.10 and is not reproducible.

1. Launched chrome using --autoplay-policy=no-user-gesture-required
2. Started video call in appear.in and joined in another tab.
3. Muted video of first tab and didn't observed black video on both first and second tabs. Attaching screenshot for reference. 

Tried the same scenario for almost 10 times and able to see black video on both ends. Also as per comment#0 and #3 reproducibility chance is very less. As issue is not reproducible from TE end and as issue is inconsistent from reporter end removing Needs-Bisect label.

Also cc'ing mlamouri@ from similar  bug 804091  for further inputs on this.

Could someone from Blink>GetUserMEdia team please have a look at this issue.

Thanks!
824866 _M66.png
374 KB View Download
Regarding similarity to  bug 804091 , it was discussed over there and this bug was created because it was different. Is there something that makes you think that might not be true?

Comment 7 by fi...@appear.in, Mar 26 2018

#6: the only similarity is that it does not happen with the old autoplay policy. 

This is a case of continuing to play a stream while/after hiding the video element and not getting the expected result.
Labels: TE-NeedsTriageHelp
As per comment#2 and #5 issue is not reproducible from TE end. Could someone from Blink>GetUserMedia team please have a look at this issue. Hence adding TE-NeedsTriageHelp label.

Thanks!

Comment 9 by guidou@chromium.org, Apr 16 2018

Labels: -Pri-2 Pri-1
Owner: guidou@chromium.org
Status: Assigned (was: Unconfirmed)
there is a change in behaviour here which seems related and is much easier to reproduce (always!). Many thanks Guido for making me look at the right thing.

1. go to appear.in in a single tab
2. mute the camera
3. observe document.querySelectorAll("video").forEach(v => console.log(v.currentTime))

In M65 or with the --autoplay-policy=no-user-gesture-required flag currentTime advances. In M66+ v.currentTime does not advance.

If *for some reason* the video stops playing before the track.enabled comes into effect this might explain the behaviour I am seeing.
and the video's paused is true.

I can explain what happens at least for the remote video element. This is a race between hiding the video element (which now seems to cause it to be paused because it is muted?) which is signaled via the appearin signaling servers and the black frame being rendered. I bet this is much easier to reproduce in a network which includes udp packet loss.

I do not have a good explanation for the local behaviour. This is possibly a race between hiding the video element (which causes a pause) and telling webrtc.org to generate black frames.

I've managed to somewhat reproduce this in a simpler environment. On 
https://webrtc.github.io/samples/src/content/peerconnection/pc1/
run the following script after making a call:
localStream.getVideoTracks()[0].enabled = false;
var remoteVideo = document.querySelectorAll("video")[1];
remoteVideo.style.display = 'none';
setTimeout(() => {
  var canvas = document.createElement("canvas");
  canvas.width = remoteVideo.videoWidth;
  canvas.height = remoteVideo.videoHeight;
  var context = canvas.getContext("2d");
  context.drawImage(remoteVideo, 0, 0, canvas.width, canvas.height);
  canvas.style.width = '320px'; canvas.style.height = '240px';
  document.body.appendChild(canvas);
}, 1000)

In M66 this *sometimes* gives a non-black canvas element.
on https://webrtc.github.io/samples/src/content/peerconnection/pc1/
paste the following:
  var v = document.querySelector("video");
  v.muted = true;
then click "start" and paste this:  
  v.style.display = 'none';
and then run this a couple of times:
  console.log(v.paused, v.currentTime, v.webkitDecodedFrameCount)

this changes behaviour of the following:
1) videoElement.currentTime
2) videoElement.webkitDecodedFrameCount
3) drawing videoElement to a canvas

I don't see this kind of stuff being mentioned in https://developers.google.com/web/updates/2017/09/autoplay-policy-changes or anywhere else. 
Cc: -mlamouri@chromium.org guidou@chromium.org
Components: -Blink>GetUserMedia Blink>Media>Autoplay
Owner: mlamouri@chromium.org
So the issue is that the default autoplay policy pauses the muted video element when doing 
   v.style.display = 'none'

Assigning to mlamouri@ for further analysis/triaging from the autoplay policy side.

Cc: tma...@stageten.tv
Cc: huib@chromium.org
Cc: -tma...@stageten.tv mlamouri@chromium.org
Owner: beccahughes@chromium.org
Status: WontFix (was: Assigned)
Yes this is being paused by AutoplayPolicy because we do not allow videos to play if they are not visible.

You can get around this by using play() instead of the "autoplay" attribute.
Cc: tma...@stageten.tv
beccahughes: i disagree but lets continue discussion in 835767. No point in having the same discussion in two different issues.

Sign in to add a comment