Chromium Code Reviews| 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 <numeric> | 5 #include <numeric> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 protocol::NetworkSettings network_settings( | 304 protocol::NetworkSettings network_settings( |
| 305 protocol::NetworkSettings::NAT_TRAVERSAL_OUTGOING); | 305 protocol::NetworkSettings::NAT_TRAVERSAL_OUTGOING); |
| 306 | 306 |
| 307 // Initialize client. | 307 // Initialize client. |
| 308 client_context_.reset( | 308 client_context_.reset( |
| 309 new ClientContext(base::ThreadTaskRunnerHandle::Get())); | 309 new ClientContext(base::ThreadTaskRunnerHandle::Get())); |
| 310 client_context_->Start(); | 310 client_context_->Start(); |
| 311 | 311 |
| 312 std::unique_ptr<FakePortAllocatorFactory> port_allocator_factory( | 312 std::unique_ptr<FakePortAllocatorFactory> port_allocator_factory( |
| 313 new FakePortAllocatorFactory(fake_network_dispatcher_)); | 313 new FakePortAllocatorFactory(fake_network_dispatcher_)); |
| 314 client_socket_factory_ = port_allocator_factory->socket_factory(); | |
| 314 port_allocator_factory->socket_factory()->SetBandwidth( | 315 port_allocator_factory->socket_factory()->SetBandwidth( |
| 315 GetParam().bandwidth, GetParam().max_buffers); | 316 GetParam().bandwidth, GetParam().max_buffers); |
| 316 port_allocator_factory->socket_factory()->SetLatency( | 317 port_allocator_factory->socket_factory()->SetLatency( |
| 317 GetParam().latency_average, GetParam().latency_stddev); | 318 GetParam().latency_average, GetParam().latency_stddev); |
| 318 port_allocator_factory->socket_factory()->set_out_of_order_rate( | 319 port_allocator_factory->socket_factory()->set_out_of_order_rate( |
| 319 GetParam().out_of_order_rate); | 320 GetParam().out_of_order_rate); |
| 320 scoped_refptr<protocol::TransportContext> transport_context( | 321 scoped_refptr<protocol::TransportContext> transport_context( |
| 321 new protocol::TransportContext( | 322 new protocol::TransportContext( |
| 322 host_signaling_.get(), std::move(port_allocator_factory), nullptr, | 323 host_signaling_.get(), std::move(port_allocator_factory), nullptr, |
| 323 network_settings, protocol::TransportRole::CLIENT)); | 324 network_settings, protocol::TransportRole::CLIENT)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 std::unique_ptr<protocol::CandidateSessionConfig> protocol_config_; | 362 std::unique_ptr<protocol::CandidateSessionConfig> protocol_config_; |
| 362 | 363 |
| 363 std::unique_ptr<FakeSignalStrategy> host_signaling_; | 364 std::unique_ptr<FakeSignalStrategy> host_signaling_; |
| 364 std::unique_ptr<FakeSignalStrategy> client_signaling_; | 365 std::unique_ptr<FakeSignalStrategy> client_signaling_; |
| 365 | 366 |
| 366 std::unique_ptr<ChromotingHost> host_; | 367 std::unique_ptr<ChromotingHost> host_; |
| 367 std::unique_ptr<ClientContext> client_context_; | 368 std::unique_ptr<ClientContext> client_context_; |
| 368 std::unique_ptr<SoftwareVideoRenderer> video_renderer_; | 369 std::unique_ptr<SoftwareVideoRenderer> video_renderer_; |
| 369 std::unique_ptr<ChromotingClient> client_; | 370 std::unique_ptr<ChromotingClient> client_; |
| 370 | 371 |
| 372 FakePacketSocketFactory* client_socket_factory_; | |
| 373 | |
| 371 std::unique_ptr<base::RunLoop> connecting_loop_; | 374 std::unique_ptr<base::RunLoop> connecting_loop_; |
| 372 std::unique_ptr<base::RunLoop> waiting_frames_loop_; | 375 std::unique_ptr<base::RunLoop> waiting_frames_loop_; |
| 373 | 376 |
| 374 std::unique_ptr<base::RunLoop> waiting_frame_stats_loop_; | 377 std::unique_ptr<base::RunLoop> waiting_frame_stats_loop_; |
| 375 size_t num_expected_frame_stats_; | 378 size_t num_expected_frame_stats_; |
| 376 | 379 |
| 377 bool client_connected_; | 380 bool client_connected_; |
| 378 bool host_connected_; | 381 bool host_connected_; |
| 379 | 382 |
| 380 base::Closure on_frame_task_; | 383 base::Closure on_frame_task_; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 547 | 550 |
| 548 int warm_up_frames = 0; | 551 int warm_up_frames = 0; |
| 549 | 552 |
| 550 base::TimeTicks start_time = base::TimeTicks::Now(); | 553 base::TimeTicks start_time = base::TimeTicks::Now(); |
| 551 const base::TimeDelta kWarmUpTime = base::TimeDelta::FromSeconds(2); | 554 const base::TimeDelta kWarmUpTime = base::TimeDelta::FromSeconds(2); |
| 552 while ((base::TimeTicks::Now() - start_time) < kWarmUpTime) { | 555 while ((base::TimeTicks::Now() - start_time) < kWarmUpTime) { |
| 553 ReceiveFrame(); | 556 ReceiveFrame(); |
| 554 ++warm_up_frames; | 557 ++warm_up_frames; |
| 555 } | 558 } |
| 556 | 559 |
| 560 client_socket_factory_->ResetStats(); | |
| 561 | |
| 557 // Run the test for 2 seconds. | 562 // Run the test for 2 seconds. |
| 558 const base::TimeDelta kTestTime = base::TimeDelta::FromSeconds(2); | 563 const base::TimeDelta kTestTime = base::TimeDelta::FromSeconds(2); |
| 559 | 564 |
| 560 int num_frames = 0; | 565 int num_frames = 0; |
| 561 base::TimeDelta latency_sum; | 566 base::TimeDelta latency_sum; |
| 562 start_time = base::TimeTicks::Now(); | 567 start_time = base::TimeTicks::Now(); |
| 563 while ((base::TimeTicks::Now() - start_time) < kTestTime) { | 568 while ((base::TimeTicks::Now() - start_time) < kTestTime) { |
| 564 std::unique_ptr<webrtc::DesktopFrame> frame = ReceiveFrame(); | 569 std::unique_ptr<webrtc::DesktopFrame> frame = ReceiveFrame(); |
| 565 ++num_frames; | 570 ++num_frames; |
| 566 latency_sum += frame_generator->GetFrameLatency(*frame); | 571 latency_sum += frame_generator->GetFrameLatency(*frame); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 577 return sum + stats.host_stats.frame_size; | 582 return sum + stats.host_stats.frame_size; |
| 578 }); | 583 }); |
| 579 | 584 |
| 580 VLOG(0) << "FPS: " << num_frames / total_time.InSecondsF(); | 585 VLOG(0) << "FPS: " << num_frames / total_time.InSecondsF(); |
| 581 VLOG(0) << "Average latency: " << latency_sum.InMillisecondsF() / num_frames | 586 VLOG(0) << "Average latency: " << latency_sum.InMillisecondsF() / num_frames |
| 582 << " ms"; | 587 << " ms"; |
| 583 VLOG(0) << "Total size: " << total_size << " bytes"; | 588 VLOG(0) << "Total size: " << total_size << " bytes"; |
| 584 VLOG(0) << "Bandwidth utilization: " | 589 VLOG(0) << "Bandwidth utilization: " |
| 585 << 100 * total_size / (total_time.InSecondsF() * GetParam().bandwidth) | 590 << 100 * total_size / (total_time.InSecondsF() * GetParam().bandwidth) |
| 586 << "%"; | 591 << "%"; |
| 592 VLOG(0) << "Average host->client network latency + bufferbloat: " | |
| 593 << client_socket_factory_->GetAverageDelay().InMilliseconds() | |
|
Irfan
2016/09/27 17:52:07
It appears a packet is dropped when the buffer ove
Sergey Ulanov
2016/09/27 20:21:35
This is good point. Problem is that the fake netwo
| |
| 594 << " ms"; | |
| 587 } | 595 } |
| 588 | 596 |
| 589 TEST_P(ProtocolPerfTest, ScrollPerformanceIce) { | 597 TEST_P(ProtocolPerfTest, ScrollPerformanceIce) { |
| 590 MeasureScrollPerformance(false); | 598 MeasureScrollPerformance(false); |
| 591 } | 599 } |
| 592 | 600 |
| 593 TEST_P(ProtocolPerfTest, ScrollPerformanceWebrtc) { | 601 TEST_P(ProtocolPerfTest, ScrollPerformanceWebrtc) { |
| 594 MeasureScrollPerformance(true); | 602 MeasureScrollPerformance(true); |
| 595 } | 603 } |
| 596 | 604 |
| 597 } // namespace remoting | 605 } // namespace remoting |
| OLD | NEW |