| 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/software_video_renderer.h" | 5 #include "remoting/client/software_video_renderer.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 } | 343 } |
| 344 | 344 |
| 345 protocol::VideoStub* SoftwareVideoRenderer::GetVideoStub() { | 345 protocol::VideoStub* SoftwareVideoRenderer::GetVideoStub() { |
| 346 return this; | 346 return this; |
| 347 } | 347 } |
| 348 | 348 |
| 349 void SoftwareVideoRenderer::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, | 349 void SoftwareVideoRenderer::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, |
| 350 const base::Closure& done) { | 350 const base::Closure& done) { |
| 351 DCHECK(CalledOnValidThread()); | 351 DCHECK(CalledOnValidThread()); |
| 352 | 352 |
| 353 stats_.video_packet_rate()->Record(1); |
| 353 // If the video packet is empty then drop it. Empty packets are used to | 354 // If the video packet is empty then drop it. Empty packets are used to |
| 354 // maintain activity on the network. | 355 // maintain activity on the network. |
| 355 if (!packet->has_data() || packet->data().size() == 0) { | 356 if (!packet->has_data() || packet->data().size() == 0) { |
| 356 done.Run(); | 357 done.Run(); |
| 357 return; | 358 return; |
| 358 } | 359 } |
| 359 | 360 |
| 360 // Add one frame to the counter. | 361 // Add one frame to the video frame rate counters. |
| 361 stats_.video_frame_rate()->Record(1); | 362 stats_.video_bandwidth()->Record(1); |
| 362 | 363 |
| 363 // Record other statistics received from host. | 364 // Record other statistics received from host. |
| 364 stats_.video_bandwidth()->Record(packet->data().size()); | 365 stats_.video_frame_rate()->Record(packet->data().size()); |
| 365 if (packet->has_capture_time_ms()) | 366 if (packet->has_capture_time_ms()) |
| 366 stats_.video_capture_ms()->Record(packet->capture_time_ms()); | 367 stats_.video_capture_ms()->Record(packet->capture_time_ms()); |
| 367 if (packet->has_encode_time_ms()) | 368 if (packet->has_encode_time_ms()) |
| 368 stats_.video_encode_ms()->Record(packet->encode_time_ms()); | 369 stats_.video_encode_ms()->Record(packet->encode_time_ms()); |
| 369 if (packet->has_latest_event_timestamp() && | 370 if (packet->has_latest_event_timestamp() && |
| 370 packet->latest_event_timestamp() > latest_event_timestamp_) { | 371 packet->latest_event_timestamp() > latest_event_timestamp_) { |
| 371 latest_event_timestamp_ = packet->latest_event_timestamp(); | 372 latest_event_timestamp_ = packet->latest_event_timestamp(); |
| 372 base::TimeDelta round_trip_latency = | 373 base::TimeDelta round_trip_latency = |
| 373 base::Time::Now() - | 374 base::Time::Now() - |
| 374 base::Time::FromInternalValue(packet->latest_event_timestamp()); | 375 base::Time::FromInternalValue(packet->latest_event_timestamp()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 DCHECK(CalledOnValidThread()); | 422 DCHECK(CalledOnValidThread()); |
| 422 | 423 |
| 423 // Record the latency between the packet being received and presented. | 424 // Record the latency between the packet being received and presented. |
| 424 stats_.video_decode_ms()->Record( | 425 stats_.video_decode_ms()->Record( |
| 425 (base::Time::Now() - decode_start).InMilliseconds()); | 426 (base::Time::Now() - decode_start).InMilliseconds()); |
| 426 | 427 |
| 427 done.Run(); | 428 done.Run(); |
| 428 } | 429 } |
| 429 | 430 |
| 430 } // namespace remoting | 431 } // namespace remoting |
| OLD | NEW |