Commit 43ab14c9 authored by wez@chromium.org's avatar wez@chromium.org

Client-side changes to support requesting lossless encode & color.

This adds setLosslessEncode() and setLosslessColor() calls to the
ClientPlugin API, which future updates to the app can use to request
lossless frames if desired.

BUG=260879,134202

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273995 0039d316-1c4b-4281-b951-d872f2087c98
parent 7790f9d5
...@@ -182,7 +182,8 @@ logging::LogMessageHandlerFunction g_logging_old_handler = NULL; ...@@ -182,7 +182,8 @@ logging::LogMessageHandlerFunction g_logging_old_handler = NULL;
const char ChromotingInstance::kApiFeatures[] = const char ChromotingInstance::kApiFeatures[] =
"highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey " "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey "
"notifyClientResolution pauseVideo pauseAudio asyncPin thirdPartyAuth " "notifyClientResolution pauseVideo pauseAudio asyncPin thirdPartyAuth "
"pinlessAuth extensionMessage allowMouseLock mediaSourceRendering"; "pinlessAuth extensionMessage allowMouseLock mediaSourceRendering "
"videoControl";
const char ChromotingInstance::kRequestedCapabilities[] = ""; const char ChromotingInstance::kRequestedCapabilities[] = "";
const char ChromotingInstance::kSupportedCapabilities[] = "desktopShape"; const char ChromotingInstance::kSupportedCapabilities[] = "desktopShape";
...@@ -350,6 +351,8 @@ void ChromotingInstance::HandleMessage(const pp::Var& message) { ...@@ -350,6 +351,8 @@ void ChromotingInstance::HandleMessage(const pp::Var& message) {
HandleNotifyClientResolution(*data); HandleNotifyClientResolution(*data);
} else if (method == "pauseVideo") { } else if (method == "pauseVideo") {
HandlePauseVideo(*data); HandlePauseVideo(*data);
} else if (method == "videoControl") {
HandleVideoControl(*data);
} else if (method == "pauseAudio") { } else if (method == "pauseAudio") {
HandlePauseAudio(*data); HandlePauseAudio(*data);
} else if (method == "useAsyncPinDialog") { } else if (method == "useAsyncPinDialog") {
...@@ -874,16 +877,30 @@ void ChromotingInstance::HandleNotifyClientResolution( ...@@ -874,16 +877,30 @@ void ChromotingInstance::HandleNotifyClientResolution(
} }
void ChromotingInstance::HandlePauseVideo(const base::DictionaryValue& data) { void ChromotingInstance::HandlePauseVideo(const base::DictionaryValue& data) {
bool pause = false; if (!data.HasKey("pause")) {
if (!data.GetBoolean("pause", &pause)) {
LOG(ERROR) << "Invalid pauseVideo."; LOG(ERROR) << "Invalid pauseVideo.";
return; return;
} }
HandleVideoControl(data);
}
void ChromotingInstance::HandleVideoControl(const base::DictionaryValue& data) {
protocol::VideoControl video_control;
bool pause_video = false;
if (data.GetBoolean("pause", &pause_video)) {
video_control.set_enable(!pause_video);
}
bool lossless_encode = false;
if (data.GetBoolean("losslessEncode", &lossless_encode)) {
video_control.set_lossless_encode(lossless_encode);
}
bool lossless_color = false;
if (data.GetBoolean("losslessColor", &lossless_color)) {
video_control.set_lossless_color(lossless_color);
}
if (!IsConnected()) { if (!IsConnected()) {
return; return;
} }
protocol::VideoControl video_control;
video_control.set_enable(!pause);
host_connection_->host_stub()->ControlVideo(video_control); host_connection_->host_stub()->ControlVideo(video_control);
} }
......
...@@ -202,6 +202,7 @@ class ChromotingInstance : ...@@ -202,6 +202,7 @@ class ChromotingInstance :
void HandleSendClipboardItem(const base::DictionaryValue& data); void HandleSendClipboardItem(const base::DictionaryValue& data);
void HandleNotifyClientResolution(const base::DictionaryValue& data); void HandleNotifyClientResolution(const base::DictionaryValue& data);
void HandlePauseVideo(const base::DictionaryValue& data); void HandlePauseVideo(const base::DictionaryValue& data);
void HandleVideoControl(const base::DictionaryValue& data);
void HandlePauseAudio(const base::DictionaryValue& data); void HandlePauseAudio(const base::DictionaryValue& data);
void HandleOnPinFetched(const base::DictionaryValue& data); void HandleOnPinFetched(const base::DictionaryValue& data);
void HandleOnThirdPartyTokenFetched(const base::DictionaryValue& data); void HandleOnThirdPartyTokenFetched(const base::DictionaryValue& data);
......
...@@ -104,7 +104,8 @@ remoting.ClientPlugin.Feature = { ...@@ -104,7 +104,8 @@ remoting.ClientPlugin.Feature = {
TRAP_KEY: 'trapKey', TRAP_KEY: 'trapKey',
PINLESS_AUTH: 'pinlessAuth', PINLESS_AUTH: 'pinlessAuth',
EXTENSION_MESSAGE: 'extensionMessage', EXTENSION_MESSAGE: 'extensionMessage',
MEDIA_SOURCE_RENDERING: 'mediaSourceRendering' MEDIA_SOURCE_RENDERING: 'mediaSourceRendering',
VIDEO_CONTROL: 'videoControl'
}; };
/** /**
...@@ -548,11 +549,13 @@ remoting.ClientPlugin.prototype.notifyClientResolution = ...@@ -548,11 +549,13 @@ remoting.ClientPlugin.prototype.notifyClientResolution =
*/ */
remoting.ClientPlugin.prototype.pauseVideo = remoting.ClientPlugin.prototype.pauseVideo =
function(pause) { function(pause) {
if (!this.hasFeature(remoting.ClientPlugin.Feature.PAUSE_VIDEO)) { if (this.hasFeature(remoting.ClientPlugin.Feature.VIDEO_CONTROL)) {
return; this.plugin.postMessage(JSON.stringify(
} { method: 'videoControl', data: { pause: pause }}));
} else if (this.hasFeature(remoting.ClientPlugin.Feature.PAUSE_VIDEO)) {
this.plugin.postMessage(JSON.stringify( this.plugin.postMessage(JSON.stringify(
{ method: 'pauseVideo', data: { pause: pause }})); { method: 'pauseVideo', data: { pause: pause }}));
}
}; };
/** /**
...@@ -569,6 +572,34 @@ remoting.ClientPlugin.prototype.pauseAudio = ...@@ -569,6 +572,34 @@ remoting.ClientPlugin.prototype.pauseAudio =
{ method: 'pauseAudio', data: { pause: pause }})); { method: 'pauseAudio', data: { pause: pause }}));
}; };
/**
* Requests that the host configure the video codec for lossless encode.
*
* @param {boolean} wantLossless True to request lossless encoding.
*/
remoting.ClientPlugin.prototype.setLosslessEncode =
function(wantLossless) {
if (!this.hasFeature(remoting.ClientPlugin.Feature.VIDEO_CONTROL)) {
return;
}
this.plugin.postMessage(JSON.stringify(
{ method: 'videoControl', data: { losslessEncode: wantLossless }}));
};
/**
* Requests that the host configure the video codec for lossless color.
*
* @param {boolean} wantLossless True to request lossless color.
*/
remoting.ClientPlugin.prototype.setLosslessColor =
function(wantLossless) {
if (!this.hasFeature(remoting.ClientPlugin.Feature.VIDEO_CONTROL)) {
return;
}
this.plugin.postMessage(JSON.stringify(
{ method: 'videoControl', data: { losslessColor: wantLossless }}));
};
/** /**
* Called when a PIN is obtained from the user. * Called when a PIN is obtained from the user.
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment