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

Unified Diff: remoting/client/gl_desktop.cc

Issue 2156713002: [Chromoting] Implement DualBufferFrameConsumer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's Feedback Created 4 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/gl_desktop.h ('k') | remoting/client/software_video_renderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/gl_desktop.cc
diff --git a/remoting/client/gl_desktop.cc b/remoting/client/gl_desktop.cc
index 4ac5d7845df534de21bd5260c02876563fddba0a..656e3bb6ea72fa79cca957fa0ba6c1e19ab683ce 100644
--- a/remoting/client/gl_desktop.cc
+++ b/remoting/client/gl_desktop.cc
@@ -27,33 +27,31 @@ void GlDesktop::SetCanvas(GlCanvas* canvas) {
return;
}
layer_.reset(new GlRenderLayer(kTextureId, canvas));
- if (last_frame_) {
- layer_->SetTexture(last_frame_->data(), last_frame_->size().width(),
- last_frame_->size().height());
- }
+ last_desktop_size_.set(0, 0);
}
void GlDesktop::SetVideoFrame(std::unique_ptr<webrtc::DesktopFrame> frame) {
- if (layer_) {
- if (!last_frame_ || !frame->size().equals(last_frame_->size())) {
- layer_->SetTexture(frame->data(), frame->size().width(),
- frame->size().height());
- } else {
- for (webrtc::DesktopRegion::Iterator i(frame->updated_region());
- !i.IsAtEnd(); i.Advance()) {
- const uint8_t* rect_start =
- frame->GetFrameDataAtPos(i.rect().top_left());
- layer_->UpdateTexture(
- rect_start, i.rect().left(), i.rect().top(), i.rect().width(),
- i.rect().height(), frame->stride());
- }
+ if (!layer_) {
+ return;
+ }
+ if (!frame->size().equals(last_desktop_size_)) {
+ layer_->SetTexture(frame->data(), frame->size().width(),
+ frame->size().height());
+ last_desktop_size_.set(frame->size().width(), frame->size().height());
+ } else {
+ for (webrtc::DesktopRegion::Iterator i(frame->updated_region());
+ !i.IsAtEnd(); i.Advance()) {
+ const uint8_t* rect_start =
+ frame->GetFrameDataAtPos(i.rect().top_left());
+ layer_->UpdateTexture(
+ rect_start, i.rect().left(), i.rect().top(), i.rect().width(),
+ i.rect().height(), frame->stride());
}
}
- last_frame_ = std::move(frame);
}
void GlDesktop::Draw() {
- if (layer_ && last_frame_) {
+ if (layer_ && !last_desktop_size_.is_empty()) {
layer_->Draw(1.f);
}
}
« no previous file with comments | « remoting/client/gl_desktop.h ('k') | remoting/client/software_video_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698