Skip to content

Commit

Permalink
Enable MediaSource rendering in chromoting client with Chrome 37.
Browse files Browse the repository at this point in the history
Bug 338529 has been fixed in Chrome 37, so MediaSource renderer
should work properly now on all platforms.

BUG=321825
R=jamiewalch@chromium.org

Review URL: https://codereview.chromium.org/344483002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277891 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sergeyu@chromium.org committed Jun 17, 2014
1 parent a65cce4 commit 61664cb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 31 deletions.
7 changes: 5 additions & 2 deletions remoting/webapp/client_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,11 @@ remoting.ClientSession.prototype.onPluginInitialized_ = function(initialized) {
this.applyRemapKeys_(true);
}

// Enable MediaSource-based rendering if available.
if (remoting.settings.USE_MEDIA_SOURCE_RENDERING &&

// Enable MediaSource-based rendering on Chrome 37 and above.
var chromeVersionMajor =
parseInt((remoting.getChromeVersion() || '0').split('.')[0], 10);
if (chromeVersionMajor >= 37 &&
this.plugin_.hasFeature(
remoting.ClientPlugin.Feature.MEDIA_SOURCE_RENDERING)) {
this.video_ = /** @type {HTMLMediaElement} */(
Expand Down
3 changes: 0 additions & 3 deletions remoting/webapp/plugin_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,5 @@ remoting.Settings.prototype.XMPP_SERVER_USE_TLS =
remoting.Settings.prototype.THIRD_PARTY_AUTH_REDIRECT_URI =
'THIRD_PARTY_AUTH_REDIRECT_URL';

// Whether to use MediaSource API for video rendering.
remoting.Settings.prototype.USE_MEDIA_SOURCE_RENDERING = false;

// 'native', 'nacl' or 'pnacl'.
remoting.Settings.prototype.CLIENT_PLUGIN_TYPE = 'CLIENT_PLUGIN_TYPE';
12 changes: 12 additions & 0 deletions remoting/webapp/remoting.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,18 @@ remoting.getExtensionInfo = function() {
}
};

/**
* Returns Chrome version.
* @return {string?}
*/
remoting.getChromeVersion = function() {
var match = new RegExp('Chrome/([0-9.]*)').exec(navigator.userAgent);
if (match && (match.length >= 2)) {
return match[1];
}
return null;
};

/**
* If an IT2Me client or host is active then prompt the user before closing.
* If a Me2Me client is active then don't bother, since closing the window is
Expand Down
27 changes: 1 addition & 26 deletions remoting/webapp/server_log_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,37 +421,12 @@ remoting.ServerLogEntry.extractHostDataFrom = function(s) {
* Adds a field specifying the browser version to this log entry.
*/
remoting.ServerLogEntry.prototype.addChromeVersionField = function() {
var version = remoting.ServerLogEntry.getChromeVersion();
var version = remoting.getChromeVersion();
if (version != null) {
this.set(remoting.ServerLogEntry.KEY_BROWSER_VERSION_, version);
}
};

/**
* Extracts the Chrome version from the userAgent string.
*
* @private
* @return {string | null}
*/
remoting.ServerLogEntry.getChromeVersion = function() {
return remoting.ServerLogEntry.extractChromeVersionFrom(navigator.userAgent);
};

/**
* Extracts the Chrome version from the given userAgent string.
*
* @private
* @param {string} s
* @return {string | null}
*/
remoting.ServerLogEntry.extractChromeVersionFrom = function(s) {
var match = new RegExp('Chrome/([0-9.]*)').exec(s);
if (match && (match.length >= 2)) {
return match[1];
}
return null;
};

/**
* Adds a field specifying the webapp version to this log entry.
*/
Expand Down

0 comments on commit 61664cb

Please sign in to comment.