| 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 "base/base64.h" | 5 #include "base/base64.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // Frame generator that rewrites the whole screen every 60th frame. Should only | 341 // Frame generator that rewrites the whole screen every 60th frame. Should only |
| 342 // be used with the VERBATIM codec as the allocated frame may contain arbitrary | 342 // be used with the VERBATIM codec as the allocated frame may contain arbitrary |
| 343 // data. | 343 // data. |
| 344 class IntermittentChangeFrameGenerator | 344 class IntermittentChangeFrameGenerator |
| 345 : public base::RefCountedThreadSafe<IntermittentChangeFrameGenerator> { | 345 : public base::RefCountedThreadSafe<IntermittentChangeFrameGenerator> { |
| 346 public: | 346 public: |
| 347 IntermittentChangeFrameGenerator() | 347 IntermittentChangeFrameGenerator() |
| 348 : frame_index_(0) {} | 348 : frame_index_(0) {} |
| 349 | 349 |
| 350 scoped_ptr<webrtc::DesktopFrame> GenerateFrame( | 350 scoped_ptr<webrtc::DesktopFrame> GenerateFrame( |
| 351 webrtc::ScreenCapturer::Callback* callback) { | 351 webrtc::DesktopCapturer::Callback* callback) { |
| 352 const int kWidth = 800; | 352 const int kWidth = 800; |
| 353 const int kHeight = 600; | 353 const int kHeight = 600; |
| 354 | 354 |
| 355 bool fresh_frame = false; | 355 bool fresh_frame = false; |
| 356 if (frame_index_ % 60 == 0 || !current_frame_) { | 356 if (frame_index_ % 60 == 0 || !current_frame_) { |
| 357 current_frame_.reset(webrtc::SharedDesktopFrame::Wrap( | 357 current_frame_.reset(webrtc::SharedDesktopFrame::Wrap( |
| 358 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(kWidth, kHeight)))); | 358 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(kWidth, kHeight)))); |
| 359 fresh_frame = true; | 359 fresh_frame = true; |
| 360 } | 360 } |
| 361 ++frame_index_; | 361 ++frame_index_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 base::TimeDelta latency; | 393 base::TimeDelta latency; |
| 394 ReceiveFrame(&latency); | 394 ReceiveFrame(&latency); |
| 395 LOG(INFO) << "Latency: " << latency.InMillisecondsF() | 395 LOG(INFO) << "Latency: " << latency.InMillisecondsF() |
| 396 << "ms Encode: " << last_video_packet_->encode_time_ms() | 396 << "ms Encode: " << last_video_packet_->encode_time_ms() |
| 397 << "ms Capture: " << last_video_packet_->capture_time_ms() | 397 << "ms Capture: " << last_video_packet_->capture_time_ms() |
| 398 << "ms"; | 398 << "ms"; |
| 399 } | 399 } |
| 400 } | 400 } |
| 401 | 401 |
| 402 } // namespace remoting | 402 } // namespace remoting |
| OLD | NEW |