| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/test/simple_test_tick_clock.h" | 5 #include "base/test/simple_test_tick_clock.h" |
| 6 #include "remoting/codec/video_encoder_vpx.h" | 6 #include "remoting/codec/video_encoder_vpx.h" |
| 7 #include "remoting/proto/video.pb.h" | 7 #include "remoting/proto/video.pb.h" |
| 8 #include "remoting/test/cyclic_frame_generator.h" | 8 #include "remoting/test/cyclic_frame_generator.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 base::TimeDelta total_latency_empty_frames; | 70 base::TimeDelta total_latency_empty_frames; |
| 71 int empty_frame_count = 0; | 71 int empty_frame_count = 0; |
| 72 | 72 |
| 73 int total_bytes = 0; | 73 int total_bytes = 0; |
| 74 | 74 |
| 75 for (int i = 0; i < kTotalFrames; ++i) { | 75 for (int i = 0; i < kTotalFrames; ++i) { |
| 76 std::unique_ptr<webrtc::DesktopFrame> frame = | 76 std::unique_ptr<webrtc::DesktopFrame> frame = |
| 77 frame_generator_->GenerateFrame(nullptr); | 77 frame_generator_->GenerateFrame(nullptr); |
| 78 base::TimeTicks started = base::TimeTicks::Now(); | 78 base::TimeTicks started = base::TimeTicks::Now(); |
| 79 | 79 |
| 80 std::unique_ptr<VideoPacket> packet = encoder_->Encode(*frame, 0); | 80 std::unique_ptr<VideoPacket> packet = encoder_->Encode(*frame); |
| 81 | 81 |
| 82 base::TimeTicks ended = base::TimeTicks::Now(); | 82 base::TimeTicks ended = base::TimeTicks::Now(); |
| 83 base::TimeDelta latency = ended - started; | 83 base::TimeDelta latency = ended - started; |
| 84 | 84 |
| 85 total_latency += latency; | 85 total_latency += latency; |
| 86 if (packet) | 86 if (packet) |
| 87 total_bytes += packet->data().size(); | 87 total_bytes += packet->data().size(); |
| 88 | 88 |
| 89 switch (frame_generator_->last_frame_type()) { | 89 switch (frame_generator_->last_frame_type()) { |
| 90 case CyclicFrameGenerator::ChangeType::NO_CHANGES: | 90 case CyclicFrameGenerator::ChangeType::NO_CHANGES: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 // Update the whole screen on every frame. | 134 // Update the whole screen on every frame. |
| 135 frame_generator_->set_frame_cycle_period( | 135 frame_generator_->set_frame_cycle_period( |
| 136 base::TimeDelta::FromMilliseconds(kIntervalBetweenFramesMs)); | 136 base::TimeDelta::FromMilliseconds(kIntervalBetweenFramesMs)); |
| 137 | 137 |
| 138 for (int i = 0; i < kTotalFrames; ++i) { | 138 for (int i = 0; i < kTotalFrames; ++i) { |
| 139 std::unique_ptr<webrtc::DesktopFrame> frame = | 139 std::unique_ptr<webrtc::DesktopFrame> frame = |
| 140 frame_generator_->GenerateFrame(nullptr); | 140 frame_generator_->GenerateFrame(nullptr); |
| 141 base::TimeTicks started = base::TimeTicks::Now(); | 141 base::TimeTicks started = base::TimeTicks::Now(); |
| 142 | 142 |
| 143 std::unique_ptr<VideoPacket> packet = encoder_->Encode(*frame, 0); | 143 std::unique_ptr<VideoPacket> packet = encoder_->Encode(*frame); |
| 144 | 144 |
| 145 base::TimeTicks ended = base::TimeTicks::Now(); | 145 base::TimeTicks ended = base::TimeTicks::Now(); |
| 146 base::TimeDelta latency = ended - started; | 146 base::TimeDelta latency = ended - started; |
| 147 | 147 |
| 148 total_latency += latency; | 148 total_latency += latency; |
| 149 | 149 |
| 150 clock_.Advance(base::TimeDelta::FromMilliseconds(kIntervalBetweenFramesMs)); | 150 clock_.Advance(base::TimeDelta::FromMilliseconds(kIntervalBetweenFramesMs)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 VLOG(0) << "Max framerate: " | 153 VLOG(0) << "Max framerate: " |
| 154 << (kTotalFrames * base::TimeDelta::FromSeconds(1) / total_latency); | 154 << (kTotalFrames * base::TimeDelta::FromSeconds(1) / total_latency); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace test | 157 } // namespace test |
| 158 } // namespace remoting | 158 } // namespace remoting |
| OLD | NEW |