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

Unified Diff: remoting/client/plugin/chromoting_instance.cc

Issue 1236663002: Allow shaped-desktop hosts to send shape only when it changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Pepper 2D renderer build Created 5 years, 5 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 | « remoting/client/plugin/chromoting_instance.h ('k') | remoting/client/plugin/pepper_video_renderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/plugin/chromoting_instance.cc
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index 73210471bce3001c9e17e91e7f33c16ec55c9b59..9e8c291fe6f3dbc5fb8312bfcb497b1dd15a97d9 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -438,26 +438,29 @@ void ChromotingInstance::OnVideoSize(const webrtc::DesktopSize& size,
PostLegacyJsonMessage("onDesktopSize", data.Pass());
}
-void ChromotingInstance::OnVideoShape(const webrtc::DesktopRegion& shape) {
- if (desktop_shape_ && shape.Equals(*desktop_shape_))
+void ChromotingInstance::OnVideoShape(const webrtc::DesktopRegion* shape) {
+ if ((shape && desktop_shape_ && shape->Equals(*desktop_shape_)) ||
+ (!shape && !desktop_shape_)) {
return;
+ }
- desktop_shape_.reset(new webrtc::DesktopRegion(shape));
-
- scoped_ptr<base::ListValue> rects_value(new base::ListValue());
- for (webrtc::DesktopRegion::Iterator i(shape); !i.IsAtEnd(); i.Advance()) {
- const webrtc::DesktopRect& rect = i.rect();
- scoped_ptr<base::ListValue> rect_value(new base::ListValue());
- rect_value->AppendInteger(rect.left());
- rect_value->AppendInteger(rect.top());
- rect_value->AppendInteger(rect.width());
- rect_value->AppendInteger(rect.height());
- rects_value->Append(rect_value.release());
+ scoped_ptr<base::DictionaryValue> shape_message(new base::DictionaryValue());
+ if (shape) {
+ desktop_shape_ = make_scoped_ptr(new webrtc::DesktopRegion(*shape));
+ scoped_ptr<base::ListValue> rects_value(new base::ListValue());
+ for (webrtc::DesktopRegion::Iterator i(*shape); !i.IsAtEnd(); i.Advance()) {
+ const webrtc::DesktopRect& rect = i.rect();
+ scoped_ptr<base::ListValue> rect_value(new base::ListValue());
+ rect_value->AppendInteger(rect.left());
+ rect_value->AppendInteger(rect.top());
+ rect_value->AppendInteger(rect.width());
+ rect_value->AppendInteger(rect.height());
+ rects_value->Append(rect_value.release());
+ }
+ shape_message->Set("rects", rects_value.release());
}
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
- data->Set("rects", rects_value.release());
- PostLegacyJsonMessage("onDesktopShape", data.Pass());
+ PostLegacyJsonMessage("onDesktopShape", shape_message.Pass());
}
void ChromotingInstance::OnVideoFrameDirtyRegion(
« no previous file with comments | « remoting/client/plugin/chromoting_instance.h ('k') | remoting/client/plugin/pepper_video_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698