Resolution test does not use selected camera #262
Description
In a system with multiple cameras (I have 5 listed) select different cameras and re-run the resolution tests. The camera used will not always be the camera selected. This does however work with the microphone.
Browsers and versions affected
Should be all - see Analysis below.
For completeness: MacOS 10.13.3, Chrome Version 65.0.3325.181 (Official Build) (64-bit).
Steps to reproduce
In a system with multiple cameras (I have 5 listed) select different cameras using the hamburger and re-run the resolution test. In my case CamTwist
is the first camera listed but ManyCam Virtual Camera
(or sometimes the Facetime HD Camera
) was the one used. I had selected the fourth option, a Logitech Brio
in this case.
This is visible by expanding a resolution test and comparing the output to the expectations, e.g.:
Check resolution 640x480
[ INFO ] cameraName: FaceTime HD Camera
Expected results
The resolution tests should be run with the camera selected in the configuration options.
Actual results
The camera used is chosen by the system and not the user.
Analysis
In testrtc-main.html
there is a method which is intended to inject the settings into the GUM
call:
doGetUserMedia: function(constraints, onSuccess, onFail) {
var self = this;
var traceGumEvent = report.traceEventAsync('getusermedia');
try {
// Append the constraints with the getSource constraints.
this.appendSourceId(this.$.audioSource.value, 'audio', constraints);
this.appendSourceId(this.$.videoSource.value, 'video', constraints);
traceGumEvent({'status': 'pending', 'constraints': constraints});
// Call into getUserMedia via the polyfill (adapter.js).
navigator.mediaDevices.getUserMedia(constraints)
In mictest.js
we can see where this is called:
MicTest.prototype = {
run: function() {
if (typeof audioContext === 'undefined') {
this.test.reportError('WebAudio is not supported, test cannot run.');
this.test.done();
} else {
doGetUserMedia(this.constraints, this.gotStream.bind(this));
}
},
however in camresolutionstest.js
we see this is not called:
startGetUserMedia: function(resolution) {
var constraints = {
audio: false,
video: {
width: {exact: resolution[0]},
height: {exact: resolution[1]}
}
};
navigator.mediaDevices.getUserMedia(constraints)
the code bypasses the doGetUserMedia
and call navigator.mediaDevices.getUserMedia
directly, bypassing the source injection.