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;
const char ChromotingInstance::kApiFeatures[] =
"highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey "
"notifyClientResolution pauseVideo pauseAudio asyncPin thirdPartyAuth "
"pinlessAuth extensionMessage allowMouseLock mediaSourceRendering";
"pinlessAuth extensionMessage allowMouseLock mediaSourceRendering "
"videoControl";
const char ChromotingInstance::kRequestedCapabilities[] = "";
const char ChromotingInstance::kSupportedCapabilities[] = "desktopShape";
......@@ -350,6 +351,8 @@ void ChromotingInstance::HandleMessage(const pp::Var& message) {
HandleNotifyClientResolution(*data);
} else if (method == "pauseVideo") {
HandlePauseVideo(*data);
} else if (method == "videoControl") {
HandleVideoControl(*data);
} else if (method == "pauseAudio") {
HandlePauseAudio(*data);
} else if (method == "useAsyncPinDialog") {
......@@ -874,16 +877,30 @@ void ChromotingInstance::HandleNotifyClientResolution(
}
void ChromotingInstance::HandlePauseVideo(const base::DictionaryValue& data) {
bool pause = false;
if (!data.GetBoolean("pause", &pause)) {
if (!data.HasKey("pause")) {
LOG(ERROR) << "Invalid pauseVideo.";
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()) {
return;
}
protocol::VideoControl video_control;
video_control.set_enable(!pause);
host_connection_->host_stub()->ControlVideo(video_control);
}
......
......@@ -202,6 +202,7 @@ class ChromotingInstance :
void HandleSendClipboardItem(const base::DictionaryValue& data);
void HandleNotifyClientResolution(const base::DictionaryValue& data);
void HandlePauseVideo(const base::DictionaryValue& data);
void HandleVideoControl(const base::DictionaryValue& data);
void HandlePauseAudio(const base::DictionaryValue& data);
void HandleOnPinFetched(const base::DictionaryValue& data);
void HandleOnThirdPartyTokenFetched(const base::DictionaryValue& data);
......
......@@ -104,7 +104,8 @@ remoting.ClientPlugin.Feature = {
TRAP_KEY: 'trapKey',
PINLESS_AUTH: 'pinlessAuth',
EXTENSION_MESSAGE: 'extensionMessage',
MEDIA_SOURCE_RENDERING: 'mediaSourceRendering'
MEDIA_SOURCE_RENDERING: 'mediaSourceRendering',
VIDEO_CONTROL: 'videoControl'
};
/**
......@@ -548,11 +549,13 @@ remoting.ClientPlugin.prototype.notifyClientResolution =
*/
remoting.ClientPlugin.prototype.pauseVideo =
function(pause) {
if (!this.hasFeature(remoting.ClientPlugin.Feature.PAUSE_VIDEO)) {
return;
if (this.hasFeature(remoting.ClientPlugin.Feature.VIDEO_CONTROL)) {
this.plugin.postMessage(JSON.stringify(
{ method: 'videoControl', data: { pause: pause }}));
} else if (this.hasFeature(remoting.ClientPlugin.Feature.PAUSE_VIDEO)) {
this.plugin.postMessage(JSON.stringify(
{ method: 'pauseVideo', data: { pause: pause }}));
}
this.plugin.postMessage(JSON.stringify(
{ method: 'pauseVideo', data: { pause: pause }}));
};
/**
......@@ -569,6 +572,34 @@ remoting.ClientPlugin.prototype.pauseAudio =
{ 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.
*
......
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