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

Unified Diff: content/test/data/media/getusermedia.html

Issue 246433006: Change MediaStreamVideoSource to output different resolutions to different tracks depending on the … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: content/test/data/media/getusermedia.html
diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html
index 1ee7b0d7b20612fe8d63c561468ed320fd6e27d5..0855cf256e1b3dc86a19f133f82c50c8c5f03fd1 100644
--- a/content/test/data/media/getusermedia.html
+++ b/content/test/data/media/getusermedia.html
@@ -189,6 +189,37 @@
};
}
+ function twoGetUserMedia(constraints1, constraints2) {
mcasas 2014/05/07 14:10:43 s/twoGetUserMedia/getUserMediaTwice/ ? (Also l.19
perkj_chrome 2014/05/08 11:29:47 The method call above is called twoGetUserMediaAnd
mcasas 2014/05/09 07:46:24 Not a big deal if both methods sound alike.
+ console.log('Calling Two GetUserMedia');
+ var result="";
+ navigator.webkitGetUserMedia(
+ constraints1,
+ function(stream) {
+ displayDetectAndAnalyzeVideoInElement(
+ stream,
+ function(aspectRatio) {
+ result = aspectRatio;
+ requestSecondGetUserMedia();
+ },
+ 'local-view');
+ },
+ failedCallback);
+ var requestSecondGetUserMedia = function() {
+ navigator.webkitGetUserMedia(
+ constraints2,
+ function(stream) {
+ displayDetectAndAnalyzeVideoInElement(
+ stream,
+ function(aspectRatio) {
+ result = result + '-' + aspectRatio;
+ sendValueToTest(result);
+ },
+ 'local-view-2');
+ },
+ failedCallback);
+ }
+ }
+
function failedCallback(error) {
failTest('GetUserMedia call failed with code ' + error.code);
}
@@ -209,8 +240,17 @@
}
function displayDetectAndAnalyzeVideo(stream) {
- plugStreamIntoVideoElement(stream, 'local-view');
- analyzeVideo();
+ displayDetectAndAnalyzeVideoInElement(stream,
+ function(aspectRatio) {
+ sendValueToTest(aspectRatio);
+ },
+ 'local-view');
+ }
+
+ function displayDetectAndAnalyzeVideoInElement(
+ stream, callback, videoElement) {
+ plugStreamIntoVideoElement(stream, videoElement);
+ detectAspectRatio(callback, videoElement);
}
function createAndRenderClone(stream) {
@@ -241,12 +281,6 @@
setTimeout(stopVideoTrack, waitTimeInSeconds * 1000);
}
- function analyzeVideo() {
- detectAspectRatio(function(aspectRatio) {
- sendValueToTest(aspectRatio);
- });
- }
-
// This test make sure multiple video renderers can be created for the same
// local video track and make sure a renderer can still render if other
// renderers are paused. See http://crbug/352619.
@@ -304,9 +338,9 @@
// pixels are not the same along the X and Y axis.
// The result of the analysis is sent back to the test as a string on the
// format "w=xxx:h=yyy".
- function detectAspectRatio(callback) {
- var videoElement = $('local-view');
- var canvas = $('local-view-canvas');
+ function detectAspectRatio(callback, videoElementName) {
+ var videoElement = $(videoElementName);
+ var canvas = $(videoElementName + '-canvas');
var maxLightGreenPixelsX = 0;
var maxLightGreenPixelsY = 0;

Powered by Google App Engine
This is Rietveld 408576698