| Index: remoting/client/plugin/chromoting_instance.cc
|
| diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
|
| index c32d31ded27bcd4d333f047d9af82c1536d5442a..e8d26a281ca5e60e3c3892adce761b5691fb8ee1 100644
|
| --- a/remoting/client/plugin/chromoting_instance.cc
|
| +++ b/remoting/client/plugin/chromoting_instance.cc
|
| @@ -421,26 +421,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(
|
|
|