OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "webrtc/modules/video_coding/main/source/jitter_buffer.h" | 10 #include "webrtc/modules/video_coding/main/source/jitter_buffer.h" |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 // We are keeping track of the first and latest seq numbers, and | 636 // We are keeping track of the first and latest seq numbers, and |
637 // the number of wraps to be able to calculate how many packets we expect. | 637 // the number of wraps to be able to calculate how many packets we expect. |
638 if (first_packet_since_reset_) { | 638 if (first_packet_since_reset_) { |
639 // Now it's time to start estimating jitter | 639 // Now it's time to start estimating jitter |
640 // reset the delay estimate. | 640 // reset the delay estimate. |
641 inter_frame_delay_.Reset(now_ms); | 641 inter_frame_delay_.Reset(now_ms); |
642 } | 642 } |
643 | 643 |
644 // Empty packets may bias the jitter estimate (lacking size component), | 644 // Empty packets may bias the jitter estimate (lacking size component), |
645 // therefore don't let empty packet trigger the following updates: | 645 // therefore don't let empty packet trigger the following updates: |
646 if (packet.frameType != kFrameEmpty) { | 646 if (packet.frameType != kEmptyFrame) { |
647 if (waiting_for_completion_.timestamp == packet.timestamp) { | 647 if (waiting_for_completion_.timestamp == packet.timestamp) { |
648 // This can get bad if we have a lot of duplicate packets, | 648 // This can get bad if we have a lot of duplicate packets, |
649 // we will then count some packet multiple times. | 649 // we will then count some packet multiple times. |
650 waiting_for_completion_.frame_size += packet.sizeBytes; | 650 waiting_for_completion_.frame_size += packet.sizeBytes; |
651 waiting_for_completion_.latest_packet_time = now_ms; | 651 waiting_for_completion_.latest_packet_time = now_ms; |
652 } else if (waiting_for_completion_.latest_packet_time >= 0 && | 652 } else if (waiting_for_completion_.latest_packet_time >= 0 && |
653 waiting_for_completion_.latest_packet_time + 2000 <= now_ms) { | 653 waiting_for_completion_.latest_packet_time + 2000 <= now_ms) { |
654 // A packet should never be more than two seconds late | 654 // A packet should never be more than two seconds late |
655 UpdateJitterEstimate(waiting_for_completion_, true); | 655 UpdateJitterEstimate(waiting_for_completion_, true); |
656 waiting_for_completion_.latest_packet_time = -1; | 656 waiting_for_completion_.latest_packet_time = -1; |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 } | 1253 } |
1254 // Evaluate if the RTT is higher than |high_rtt_nack_threshold_ms_|, and in | 1254 // Evaluate if the RTT is higher than |high_rtt_nack_threshold_ms_|, and in |
1255 // that case we don't wait for retransmissions. | 1255 // that case we don't wait for retransmissions. |
1256 if (high_rtt_nack_threshold_ms_ >= 0 && | 1256 if (high_rtt_nack_threshold_ms_ >= 0 && |
1257 rtt_ms_ >= high_rtt_nack_threshold_ms_) { | 1257 rtt_ms_ >= high_rtt_nack_threshold_ms_) { |
1258 return false; | 1258 return false; |
1259 } | 1259 } |
1260 return true; | 1260 return true; |
1261 } | 1261 } |
1262 } // namespace webrtc | 1262 } // namespace webrtc |
OLD | NEW |