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

Unified Diff: content/browser/resources/media/manager.js

Issue 637953008: Improve video capture columns in chrome://media-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Human readable capture API type Created 6 years, 2 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 | « content/browser/resources/media/main.js ('k') | content/browser/resources/media/media_internals.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/resources/media/manager.js
diff --git a/content/browser/resources/media/manager.js b/content/browser/resources/media/manager.js
index c2fd9762573a8ea8a16b0d51042b0c76d339b863..5508c66cd795987209aea9beded2bb12e3e24aa6 100644
--- a/content/browser/resources/media/manager.js
+++ b/content/browser/resources/media/manager.js
@@ -111,9 +111,45 @@ var Manager = (function() {
value);
},
+ parseVideoCaptureFormat_: function(format) {
+ /**
+ * Example:
+ *
+ * format:
+ * "resolution: 1280x720, fps: 30.000000, pixel format: I420"
+ *
+ * formatDict:
+ * {'resolution':'1280x720', 'fps': '30.00'}
+ */
+ var parts = format.split(', ');
+ var formatDict = {};
+ for (var i in parts) {
+ var kv = parts[i].split(': ');
+ formatDict[kv[0]] = kv[1];
+ }
+
+ // Round down the FPS to 2 decimals.
+ formatDict['fps'] = parseFloat(formatDict['fps']).toFixed(2);
+
+ // The camera does not actually output I420 so this info is misleading.
+ delete formatDict['pixel format'];
+
+ return formatDict;
+ },
+
updateVideoCaptureCapabilities: function(videoCaptureCapabilities) {
+ // Parse the video formats to be structured for the table.
+ for (var i in videoCaptureCapabilities) {
+ for (var j in videoCaptureCapabilities[i]['formats']) {
+ videoCaptureCapabilities[i]['formats'][j] =
+ this.parseVideoCaptureFormat_(
+ videoCaptureCapabilities[i]['formats'][j]);
+ }
+ }
+
// The keys of each device to be shown in order of appearance.
- var videoCaptureDeviceKeys = ['id','name','formats','captureApi'];
+ var videoCaptureDeviceKeys = ['name','formats','captureApi','id'];
+
this.clientRenderer_.redrawVideoCaptureCapabilities(
videoCaptureCapabilities, videoCaptureDeviceKeys);
}
« no previous file with comments | « content/browser/resources/media/main.js ('k') | content/browser/resources/media/media_internals.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698