OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "remoting/client/opengl/gl_desktop.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "remoting/client/opengl/gl_canvas.h" | |
9 #include "remoting/client/opengl/gl_render_layer.h" | |
10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | |
11 | |
12 namespace { | |
13 | |
14 const int kTextureId = 0; | |
15 } | |
16 | |
17 namespace remoting { | |
18 | |
19 GlDesktop::GlDesktop() {} | |
20 | |
21 GlDesktop::~GlDesktop() {} | |
22 | |
23 void GlDesktop::SetCanvas(GlCanvas* canvas) { | |
24 if (!canvas) { | |
25 layer_.reset(); | |
26 return; | |
27 } | |
28 layer_.reset(new GlRenderLayer(kTextureId, canvas)); | |
29 if (last_frame_) { | |
30 layer_->SetTexture(last_frame_->data(), last_frame_->size().width(), | |
31 last_frame_->size().height()); | |
32 } | |
33 } | |
34 | |
35 void GlDesktop::SetVideoFrame(std::unique_ptr<webrtc::DesktopFrame> frame) { | |
36 if (layer_) { | |
37 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.
| |
38 frame->size().height()); | |
39 } | |
40 last_frame_ = std::move(frame); | |
41 } | |
42 | |
43 void GlDesktop::Draw() { | |
44 if (layer_) { | |
45 layer_->Draw(); | |
46 } | |
47 } | |
48 | |
49 } // namespace remoting | |
OLD | NEW |