OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/client/plugin/pepper_video_renderer_3d.h" | 5 #include "remoting/client/plugin/pepper_video_renderer_3d.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 const base::Closure& done) { | 190 const base::Closure& done) { |
191 base::ScopedClosureRunner done_runner(done); | 191 base::ScopedClosureRunner done_runner(done); |
192 | 192 |
193 perf_tracker_->RecordVideoPacketStats(*packet); | 193 perf_tracker_->RecordVideoPacketStats(*packet); |
194 | 194 |
195 // Don't need to do anything if the packet is empty. Host sends empty video | 195 // Don't need to do anything if the packet is empty. Host sends empty video |
196 // packets when the screen is not changing. | 196 // packets when the screen is not changing. |
197 if (!packet->data().size()) | 197 if (!packet->data().size()) |
198 return; | 198 return; |
199 | 199 |
200 bool resolution_changed = false; | |
201 | |
202 if (packet->format().has_screen_width() && | 200 if (packet->format().has_screen_width() && |
203 packet->format().has_screen_height()) { | 201 packet->format().has_screen_height()) { |
204 webrtc::DesktopSize frame_size(packet->format().screen_width(), | 202 frame_size_.set(packet->format().screen_width(), |
205 packet->format().screen_height()); | 203 packet->format().screen_height()); |
206 if (!frame_size_.equals(frame_size)) { | |
207 frame_size_ = frame_size; | |
208 resolution_changed = true; | |
209 } | |
210 } | 204 } |
211 | 205 |
212 if (packet->format().has_x_dpi() && packet->format().has_y_dpi()) { | |
213 webrtc::DesktopVector frame_dpi(packet->format().x_dpi(), | |
214 packet->format().y_dpi()); | |
215 if (!frame_dpi_.equals(frame_dpi)) { | |
216 frame_dpi_ = frame_dpi; | |
217 resolution_changed = true; | |
218 } | |
219 } | |
220 | |
221 if (resolution_changed) | |
222 event_handler_->OnVideoSize(frame_size_, frame_dpi_); | |
223 | |
224 // Report the dirty region, for debugging, if requested. | 206 // Report the dirty region, for debugging, if requested. |
225 if (debug_dirty_region_) { | 207 if (debug_dirty_region_) { |
226 webrtc::DesktopRegion dirty_region; | 208 webrtc::DesktopRegion dirty_region; |
227 for (int i = 0; i < packet->dirty_rects_size(); ++i) { | 209 for (int i = 0; i < packet->dirty_rects_size(); ++i) { |
228 Rect remoting_rect = packet->dirty_rects(i); | 210 Rect remoting_rect = packet->dirty_rects(i); |
229 dirty_region.AddRect(webrtc::DesktopRect::MakeXYWH( | 211 dirty_region.AddRect(webrtc::DesktopRect::MakeXYWH( |
230 remoting_rect.x(), remoting_rect.y(), | 212 remoting_rect.x(), remoting_rect.y(), |
231 remoting_rect.width(), remoting_rect.height())); | 213 remoting_rect.width(), remoting_rect.height())); |
232 } | 214 } |
233 event_handler_->OnVideoFrameDirtyRegion(dirty_region); | 215 event_handler_->OnVideoFrameDirtyRegion(dirty_region); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader); | 487 gles2_if_->AttachShader(graphics_.pp_resource(), shader_program_, shader); |
506 gles2_if_->DeleteShader(graphics_.pp_resource(), shader); | 488 gles2_if_->DeleteShader(graphics_.pp_resource(), shader); |
507 } | 489 } |
508 | 490 |
509 void PepperVideoRenderer3D::CheckGLError() { | 491 void PepperVideoRenderer3D::CheckGLError() { |
510 GLenum error = gles2_if_->GetError(graphics_.pp_resource()); | 492 GLenum error = gles2_if_->GetError(graphics_.pp_resource()); |
511 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error; | 493 CHECK_EQ(error, static_cast<GLenum>(GL_NO_ERROR)) << "GL error: " << error; |
512 } | 494 } |
513 | 495 |
514 } // namespace remoting | 496 } // namespace remoting |
OLD | NEW |