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

Unified Diff: chrome/test/data/webrtc/getusermedia.js

Issue 12472032: Add screen capture constraints, video tag resize and removed auto video resize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@testingscreen
Patch Set: removed line break Created 7 years, 9 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 | chrome/test/data/webrtc/jsep01_call.js » ('j') | chrome/test/data/webrtc/jsep01_call.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webrtc/getusermedia.js
diff --git a/chrome/test/data/webrtc/getusermedia.js b/chrome/test/data/webrtc/getusermedia.js
index bf21565aef739500f0987f2968f53c033a098520..9d854bef66259fcc0ac71d24e87322a808da4e2c 100644
--- a/chrome/test/data/webrtc/getusermedia.js
+++ b/chrome/test/data/webrtc/getusermedia.js
@@ -35,7 +35,7 @@ var gRequestWebcamAndMicrophoneResult = 'not-called-yet';
* appears in Chrome, which will run either the OK or failed callback as a
* a result. To see which callback was called, use obtainGetUserMediaResult().
*
- * @param{string} constraints Defines what to be requested, with mandatory
+ * @param {string} constraints Defines what to be requested, with mandatory
* and optional constraints defined. The contents of this parameter depends
* on the WebRTC version. This should be JavaScript code that we eval().
*/
@@ -84,7 +84,7 @@ function stopLocalStream() {
/**
* Adds the current local media stream to a peer connection.
- * @param{RTCPeerConnection} peerConnection
+ * @param {RTCPeerConnection} peerConnection
*/
function addLocalStreamToPeerConnection(peerConnection) {
if (gLocalStream == null)
@@ -101,7 +101,7 @@ function addLocalStreamToPeerConnection(peerConnection) {
/**
* Removes the local stream from the peer connection.
- * @param{rtcpeerconnection} peerconnection
+ * @param {rtcpeerconnection} peerConnection
*/
function removeLocalStreamFromPeerConnection(peerConnection) {
if (gLocalStream == null)
@@ -136,23 +136,44 @@ function getUserMediaOkCallback_(stream) {
// Due to crbug.com/110938 the size is 0 when onloadedmetadata fires.
// videoTag.onloadedmetadata = updateVideoTagSize_('local-view');
kjellander_chromium 2013/03/25 13:33:58 Update this line (meant to be the code used when 1
jansson 2013/04/05 10:29:42 Done.
kjellander_chromium 2013/04/08 14:19:51 You must have missed this, it's still not updated.
// Use setTimeout as a workaround for now.
- setTimeout(function() {updateVideoTagSize_('local-view')}, 500);
+ // setTimeout(function() {updateVideoTagSize_('local-view')}, 500);
kjellander_chromium 2013/03/25 13:33:58 Clean out the old code instead of commenting it.
jansson 2013/04/05 10:29:42 Done.
gRequestWebcamAndMicrophoneResult = 'ok-got-stream';
+ setTimeout(function() {displayVideoSize(videoTag);}, 500);
}
/**
* @private
* @param {string} videoTagId The ID of the video tag to update.
+ * @param {string} width The width of the video to update the video
kjellander_chromium 2013/03/25 13:33:58 The implementation is not exactly as documented, a
jansson 2013/04/05 10:29:42 Done.
+ * tag, if 0 size will be taken from videoTag.videoWidth.
+ * @param {string} height The height of the video to update the video
+ * tag, if 0 size will be taken from the videoTag.videoHeight.
*/
-function updateVideoTagSize_(videoTagId) {
+function updateVideoTagSize_(videoTagId, width, height) {
var videoTag = $(videoTagId);
- // Don't update if sizes are 0 (happens for Chrome M23).
- if (videoTag.videoWidth > 0 && videoTag.videoHeight > 0) {
- debug('Set video tag "' + videoTagId + '" width and height to ' +
- videoTag.videoWidth + 'x' + videoTag.videoHeight);
+ if (width && height > 0) {
kjellander_chromium 2013/03/25 13:33:58 This is confusing since width is probably always t
jansson 2013/04/05 10:29:42 Done.
+ videoTag.width = width;
+ videoTag.height = height;
+ }
+ else {
videoTag.width = videoTag.videoWidth;
videoTag.height = videoTag.videoHeight;
}
+ debug('Set video tag "' + videoTagId + '" width and height to ' +
kjellander_chromium 2013/03/25 13:33:58 I prefer replacing "width and height" with just "s
jansson 2013/04/05 10:29:42 Done.
+ videoTag.width + 'x' + videoTag.height);
+ displayVideoSize(videoTag);
+}
+
+/**
+ * @private
+ * @param {string} videoTag The ID of the video tag + stream to
+ * write the size to a HTML tag based on id.
+ */
+function displayVideoSize(videoTag) {
kjellander_chromium 2013/03/25 13:33:58 private functions shall end with underscore. http:
jansson 2013/04/05 10:29:42 Done.
kjellander_chromium 2013/04/08 14:19:51 Move underscore to the end of the function name, n
jansson 2013/04/10 12:11:47 Done.
jansson 2013/04/10 12:11:47 Done.
+ $(videoTag.id + '-stream-size').innerHTML = '(stream size: ' +
+ videoTag.videoWidth + 'x' +
+ videoTag.videoHeight + ' )';
kjellander_chromium 2013/03/25 13:33:58 Skip the white space at the end of the string, bef
jansson 2013/04/05 10:29:42 Done.
+ $(videoTag.id + '-size').innerHTML = videoTag.width + 'x' + videoTag.height;
}
/**
« no previous file with comments | « no previous file | chrome/test/data/webrtc/jsep01_call.js » ('j') | chrome/test/data/webrtc/jsep01_call.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698