Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6366)

Unified Diff: chrome/test/data/webrtc/manual/peerconnection_manual.js

Issue 338853008: Renamed erronous element id refresh_devices to get_devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed according to comments Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webrtc/manual/peerconnection_manual.js
diff --git a/chrome/test/data/webrtc/manual/peerconnection_manual.js b/chrome/test/data/webrtc/manual/peerconnection_manual.js
index cf0b1d8613007112f660c778a8f83b89ba58661c..17c06d1d4560231e5f3e253d0b9f18075548ae48 100644
--- a/chrome/test/data/webrtc/manual/peerconnection_manual.js
+++ b/chrome/test/data/webrtc/manual/peerconnection_manual.js
@@ -194,39 +194,37 @@ function forceIsacChanged() {
/**
* Updates the constraints in the getusermedia-constraints text box with a
- * MediaStreamConstraints string. This string is created based on the status of
- * the checkboxes for audio and video. If device enumeration is supported and
- * device source id's are not null they will be added to the constraints string.
- * Fetches the screen size using "screen" in Chrome as we need to pass a max
- * resolution else it defaults to 640x480 in the constraints for screen
- * capturing.
+ * MediaStreamConstraints string. This string is created based on the state
phoglund_chromium 2014/06/19 11:54:35 Nit: don't indent comments like this.
jansson 2014/06/19 13:02:32 Done.
+ * of the 'audiosrc' and 'videosrc' checboxes.
phoglund_chromium 2014/06/19 11:54:35 Nit: checkboxes
jansson 2014/06/19 13:02:32 Done.
+ * If device enumeration is supported and device source id's are not null they
+ * will be added to the constraints string.
*/
function updateGetUserMediaConstraints() {
- var audioSelected = $('audiosrc');
- var videoSelected = $('videosrc');
- var constraints = {
- audio: $('audio').checked,
- video: $('video').checked
+ var selectedAudioDevice = $('audiosrc');
+ var selectedVideoDevice = $('videosrc');
+ var constraints = {audio: $('audio').checked,
+ video: $('video').checked
};
- if (audioSelected.disabled == false && videoSelected.disabled == false) {
- var devices = getSourcesFromField_(audioSelected, videoSelected);
- if ($('audio').checked == true) {
- if (devices.audioId != null) {
+ if ($('video').checked) {
+ // Default optional constraints placed here.
+ constraints.video = {optional: [{minWidth: $('video-width').value},
+ {minHeight: $('video-height').value},
+ {googLeakyBucket: true}]};
+ }
+
+ if (!selectedAudioDevice.disabled && !selectedAudioDevice.disabled) {
+ var devices = getSourcesFromField_(selectedAudioDevice,
+ selectedVideoDevice);
+
+ if ($('audio').checked) {
+ if (devices.audioId != null)
constraints.audio = {optional: [{sourceId: devices.audioId}]};
- } else {
- constraints.audio = true;
- }
}
- if ($('video').checked == true) {
- // Default optional constraints placed here.
- constraints.video = {optional: [{minWidth: $('video-width').value},
- {minHeight: $('video-height').value},
- {googLeakyBucket: true}]
- };
- if (devices.videoId != null) {
+
+ if ($('video').checked) {
+ if (devices.videoId != null)
constraints.video.optional.push({sourceId: devices.videoId});
- }
}
}
@@ -237,10 +235,11 @@ function updateGetUserMediaConstraints() {
maxWidth: screen.width,
maxHeight: screen.height}}
};
- if ($('audio').checked == true)
+ if ($('audio').checked)
print_('Audio for screencapture is not implemented yet, please ' +
'try to set audio = false prior requesting screencapture');
}
+
$('getusermedia-constraints').value = JSON.stringify(constraints, null, ' ');
}
@@ -303,43 +302,46 @@ function removeLocalStreamFromPeerConnection(peerConnection) {
/**
* Enumerates the audio and video devices available in Chrome and adds the
- * devices to the HTML elements with Id 'audiosrc' and 'videosrc'.
+ * devices to the HTML elements with Id 'audiosrc' and 'videosrc'.
phoglund_chromium 2014/06/19 11:54:35 Nit: don't indent here either.
jansson 2014/06/19 13:02:32 Done.
* Checks if device enumeration is supported and if the 'audiosrc' + 'videosrc'
- * elements exists, if not a debug printout will be displayed.
+ * elements exists, if not a debug printout will be displayed.
* If the device label is empty, audio/video + sequence number will be used to
- * populate the name. Also makes sure the children has been loaded in order
- * to update the constraints.
+ * populate the name. Also makes sure the children has been loaded in order
+ * to update the constraints.
*/
function getDevices() {
- var audio_select = $('audiosrc');
- var video_select = $('videosrc');
- var get_devices = $('get-devices');
- audio_select.innerHTML = '';
- video_select.innerHTML = '';
+ selectedAudioDevice = $('audiosrc');
+ selectedVideoDevice = $('videosrc');
+ selectedAudioDevice.innerHTML = '';
+ selectedVideoDevice.innerHTML = '';
+
try {
eval(MediaStreamTrack.getSources(function() {}));
} catch (exception) {
- audio_select.disabled = true;
- video_select.disabled = true;
- refresh_devices.disabled = true;
+ selectedAudioDevice.disabled = true;
+ selectedVideoDevice.disabled = true;
+ $('get-devices').disabled = true;
+ $('get-devices-onload').disabled = true;
updateGetUserMediaConstraints();
error_('Device enumeration not supported. ' + exception);
}
+
MediaStreamTrack.getSources(function(devices) {
for (var i = 0; i < devices.length; i++) {
var option = document.createElement('option');
option.value = devices[i].id;
option.text = devices[i].label;
+
if (devices[i].kind == 'audio') {
if (option.text == '') {
option.text = devices[i].id;
}
- audio_select.appendChild(option);
+ selectedAudioDevice.appendChild(option);
} else if (devices[i].kind == 'video') {
if (option.text == '') {
option.text = devices[i].id;
}
- video_select.appendChild(option);
+ selectedVideoDevice.appendChild(option);
} else {
error_('Device type ' + devices[i].kind + ' not recognized, ' +
'cannot enumerate device. Currently only device types' +
@@ -349,12 +351,13 @@ function getDevices() {
}
}
});
+
checkIfDeviceDropdownsArePopulated_();
}
/**
* Sets the transform to apply just before setting the local description and
- * sending to the peer.
+ * sending to the peer.
* @param {function} transformFunction A function which takes one SDP string as
* argument and returns the modified SDP string.
*/
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698