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/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 // protocol::CursorShapeStub interface. | 69 // protocol::CursorShapeStub interface. |
70 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override{}; | 70 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override{}; |
71 }; | 71 }; |
72 | 72 |
73 class ProtocolPerfTest | 73 class ProtocolPerfTest |
74 : public testing::Test, | 74 : public testing::Test, |
75 public testing::WithParamInterface<NetworkPerformanceParams>, | 75 public testing::WithParamInterface<NetworkPerformanceParams>, |
76 public ClientUserInterface, | 76 public ClientUserInterface, |
77 public VideoRenderer, | 77 public VideoRenderer, |
| 78 public protocol::VideoStub, |
78 public HostStatusObserver { | 79 public HostStatusObserver { |
79 public: | 80 public: |
80 ProtocolPerfTest() | 81 ProtocolPerfTest() |
81 : host_thread_("host"), | 82 : host_thread_("host"), |
82 capture_thread_("capture"), | 83 capture_thread_("capture"), |
83 encode_thread_("encode") { | 84 encode_thread_("encode") { |
84 VideoFramePump::EnableTimestampsForTests(); | 85 VideoFramePump::EnableTimestampsForTests(); |
85 host_thread_.StartWithOptions( | 86 host_thread_.StartWithOptions( |
86 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 87 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
87 capture_thread_.Start(); | 88 capture_thread_.Start(); |
(...skipping 24 matching lines...) Expand all Loading... |
112 const protocol::PairingResponse& pairing_response) override {} | 113 const protocol::PairingResponse& pairing_response) override {} |
113 void DeliverHostMessage(const protocol::ExtensionMessage& message) override {} | 114 void DeliverHostMessage(const protocol::ExtensionMessage& message) override {} |
114 protocol::ClipboardStub* GetClipboardStub() override { return nullptr; } | 115 protocol::ClipboardStub* GetClipboardStub() override { return nullptr; } |
115 protocol::CursorShapeStub* GetCursorShapeStub() override { | 116 protocol::CursorShapeStub* GetCursorShapeStub() override { |
116 return &cursor_shape_stub_; | 117 return &cursor_shape_stub_; |
117 } | 118 } |
118 | 119 |
119 // VideoRenderer interface. | 120 // VideoRenderer interface. |
120 void OnSessionConfig(const protocol::SessionConfig& config) override {} | 121 void OnSessionConfig(const protocol::SessionConfig& config) override {} |
121 ChromotingStats* GetStats() override { return nullptr; } | 122 ChromotingStats* GetStats() override { return nullptr; } |
| 123 protocol::VideoStub* GetVideoStub() override { return this; } |
| 124 |
| 125 // protocol::VideoStub interface. |
122 void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, | 126 void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, |
123 const base::Closure& done) override { | 127 const base::Closure& done) override { |
124 if (video_packet->data().empty()) { | 128 if (video_packet->data().empty()) { |
125 // Ignore keep-alive packets | 129 // Ignore keep-alive packets |
126 done.Run(); | 130 done.Run(); |
127 return; | 131 return; |
128 } | 132 } |
129 | 133 |
130 last_video_packet_ = video_packet.Pass(); | 134 last_video_packet_ = video_packet.Pass(); |
131 | 135 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 << "ms Encode: " << last_video_packet_->encode_time_ms() | 488 << "ms Encode: " << last_video_packet_->encode_time_ms() |
485 << "ms Capture: " << last_video_packet_->capture_time_ms() | 489 << "ms Capture: " << last_video_packet_->capture_time_ms() |
486 << "ms"; | 490 << "ms"; |
487 sum += latency; | 491 sum += latency; |
488 } | 492 } |
489 | 493 |
490 LOG(INFO) << "Average: " << (sum / kFrames).InMillisecondsF(); | 494 LOG(INFO) << "Average: " << (sum / kFrames).InMillisecondsF(); |
491 } | 495 } |
492 | 496 |
493 } // namespace remoting | 497 } // namespace remoting |
OLD | NEW |