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 // Record this received packet, even if it is empty. |
| 354 stats_.video_packet_rate()->Record(1); |
| 355 |
353 // If the video packet is empty then drop it. Empty packets are used to | 356 // If the video packet is empty then drop it. Empty packets are used to |
354 // maintain activity on the network. | 357 // maintain activity on the network. |
355 if (!packet->has_data() || packet->data().size() == 0) { | 358 if (!packet->has_data() || packet->data().size() == 0) { |
356 done.Run(); | 359 done.Run(); |
357 return; | 360 return; |
358 } | 361 } |
359 | 362 |
360 // Add one frame to the counter. | 363 // Add one frame to the video frame rate counter. |
361 stats_.video_frame_rate()->Record(1); | 364 stats_.video_frame_rate()->Record(1); |
362 | 365 |
363 // Record other statistics received from host. | 366 // Record other statistics received from host. |
364 stats_.video_bandwidth()->Record(packet->data().size()); | 367 stats_.video_bandwidth()->Record(packet->data().size()); |
365 if (packet->has_capture_time_ms()) | 368 if (packet->has_capture_time_ms()) |
366 stats_.video_capture_ms()->Record(packet->capture_time_ms()); | 369 stats_.video_capture_ms()->Record(packet->capture_time_ms()); |
367 if (packet->has_encode_time_ms()) | 370 if (packet->has_encode_time_ms()) |
368 stats_.video_encode_ms()->Record(packet->encode_time_ms()); | 371 stats_.video_encode_ms()->Record(packet->encode_time_ms()); |
369 if (packet->has_latest_event_timestamp() && | 372 if (packet->has_latest_event_timestamp() && |
370 packet->latest_event_timestamp() > latest_event_timestamp_) { | 373 packet->latest_event_timestamp() > latest_event_timestamp_) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 DCHECK(CalledOnValidThread()); | 424 DCHECK(CalledOnValidThread()); |
422 | 425 |
423 // Record the latency between the packet being received and presented. | 426 // Record the latency between the packet being received and presented. |
424 stats_.video_decode_ms()->Record( | 427 stats_.video_decode_ms()->Record( |
425 (base::Time::Now() - decode_start).InMilliseconds()); | 428 (base::Time::Now() - decode_start).InMilliseconds()); |
426 | 429 |
427 done.Run(); | 430 done.Run(); |
428 } | 431 } |
429 | 432 |
430 } // namespace remoting | 433 } // namespace remoting |
OLD | NEW |