Chromium Code Reviews| Index: remoting/client/opengl/gl_desktop.cc |
| diff --git a/remoting/client/opengl/gl_desktop.cc b/remoting/client/opengl/gl_desktop.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e1587e95875ee22e20eda942e8d7ffe4401cff04 |
| --- /dev/null |
| +++ b/remoting/client/opengl/gl_desktop.cc |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "remoting/client/opengl/gl_desktop.h" |
| + |
| +#include "base/logging.h" |
| +#include "remoting/client/opengl/gl_canvas.h" |
| +#include "remoting/client/opengl/gl_render_layer.h" |
| +#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
| + |
| +namespace { |
| + |
| +const int kTextureId = 0; |
| +} |
| + |
| +namespace remoting { |
| + |
| +GlDesktop::GlDesktop() {} |
| + |
| +GlDesktop::~GlDesktop() {} |
| + |
| +void GlDesktop::SetCanvas(GlCanvas* canvas) { |
| + if (!canvas) { |
| + layer_.reset(); |
| + return; |
| + } |
| + layer_.reset(new GlRenderLayer(kTextureId, canvas)); |
| + if (last_frame_) { |
| + layer_->SetTexture(last_frame_->data(), last_frame_->size().width(), |
| + last_frame_->size().height()); |
| + } |
| +} |
| + |
| +void GlDesktop::SetVideoFrame(std::unique_ptr<webrtc::DesktopFrame> frame) { |
| + if (layer_) { |
| + layer_->SetTexture(frame->data(), frame->size().width(), |
|
Sergey Ulanov
2016/06/27 23:15:29
It's best to avoid updating the whole texture ever
Sergey Ulanov
2016/06/27 23:15:29
Here you assume that the the frame lines are packe
Yuwei
2016/06/28 01:31:20
By using SoftwareVideoRenderer and SharedDesktopFr
Yuwei
2016/06/29 17:36:22
Turns out OpenGL ES 3 is backward compatible with
Yuwei
2016/06/30 00:04:55
Just measured some render latencies when playing Y
Sergey Ulanov
2016/06/30 00:34:52
Is this when updating the whole frame? I think the
Yuwei
2016/07/07 22:07:45
Done.
|
| + frame->size().height()); |
| + } |
| + last_frame_ = std::move(frame); |
| +} |
| + |
| +void GlDesktop::Draw() { |
| + if (layer_) { |
| + layer_->Draw(); |
| + } |
| +} |
| + |
| +} // namespace remoting |