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/jitter_buffer.h" | 10 #include "webrtc/modules/video_coding/jitter_buffer.h" |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 frame = incomplete_frames_.PopFrame(timestamp); | 594 frame = incomplete_frames_.PopFrame(timestamp); |
595 if (frame) | 595 if (frame) |
596 continuous = last_decoded_state_.ContinuousFrame(frame); | 596 continuous = last_decoded_state_.ContinuousFrame(frame); |
597 else | 597 else |
598 return NULL; | 598 return NULL; |
599 } | 599 } |
600 TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", timestamp, "Extract"); | 600 TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", timestamp, "Extract"); |
601 // Frame pulled out from jitter buffer, update the jitter estimate. | 601 // Frame pulled out from jitter buffer, update the jitter estimate. |
602 const bool retransmitted = (frame->GetNackCount() > 0); | 602 const bool retransmitted = (frame->GetNackCount() > 0); |
603 if (retransmitted) { | 603 if (retransmitted) { |
604 jitter_estimate_.FrameNacked(); | 604 if (WaitForRetransmissions()) |
| 605 jitter_estimate_.FrameNacked(); |
605 } else if (frame->Length() > 0) { | 606 } else if (frame->Length() > 0) { |
606 // Ignore retransmitted and empty frames. | 607 // Ignore retransmitted and empty frames. |
607 if (waiting_for_completion_.latest_packet_time >= 0) { | 608 if (waiting_for_completion_.latest_packet_time >= 0) { |
608 UpdateJitterEstimate(waiting_for_completion_, true); | 609 UpdateJitterEstimate(waiting_for_completion_, true); |
609 } | 610 } |
610 if (frame->GetState() == kStateComplete) { | 611 if (frame->GetState() == kStateComplete) { |
611 UpdateJitterEstimate(*frame, false); | 612 UpdateJitterEstimate(*frame, false); |
612 } else { | 613 } else { |
613 // Wait for this one to get complete. | 614 // Wait for this one to get complete. |
614 waiting_for_completion_.frame_size = frame->Length(); | 615 waiting_for_completion_.frame_size = frame->Length(); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 } | 952 } |
952 return jitter_estimate_.GetJitterEstimate(rtt_mult); | 953 return jitter_estimate_.GetJitterEstimate(rtt_mult); |
953 } | 954 } |
954 | 955 |
955 void VCMJitterBuffer::UpdateRtt(int64_t rtt_ms) { | 956 void VCMJitterBuffer::UpdateRtt(int64_t rtt_ms) { |
956 CriticalSectionScoped cs(crit_sect_); | 957 CriticalSectionScoped cs(crit_sect_); |
957 rtt_ms_ = rtt_ms; | 958 rtt_ms_ = rtt_ms; |
958 jitter_estimate_.UpdateRtt(rtt_ms); | 959 jitter_estimate_.UpdateRtt(rtt_ms); |
959 if (nack_module_) | 960 if (nack_module_) |
960 nack_module_->UpdateRtt(rtt_ms); | 961 nack_module_->UpdateRtt(rtt_ms); |
| 962 if (!WaitForRetransmissions()) |
| 963 jitter_estimate_.ResetNackCount(); |
961 } | 964 } |
962 | 965 |
963 void VCMJitterBuffer::SetNackMode(VCMNackMode mode, | 966 void VCMJitterBuffer::SetNackMode(VCMNackMode mode, |
964 int64_t low_rtt_nack_threshold_ms, | 967 int64_t low_rtt_nack_threshold_ms, |
965 int64_t high_rtt_nack_threshold_ms) { | 968 int64_t high_rtt_nack_threshold_ms) { |
966 CriticalSectionScoped cs(crit_sect_); | 969 CriticalSectionScoped cs(crit_sect_); |
967 nack_mode_ = mode; | 970 nack_mode_ = mode; |
968 if (mode == kNoNack) { | 971 if (mode == kNoNack) { |
969 missing_sequence_numbers_.clear(); | 972 missing_sequence_numbers_.clear(); |
970 } | 973 } |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 if (nack_module_) | 1381 if (nack_module_) |
1379 return nack_module_->TimeUntilNextProcess(); | 1382 return nack_module_->TimeUntilNextProcess(); |
1380 return std::numeric_limits<int64_t>::max(); | 1383 return std::numeric_limits<int64_t>::max(); |
1381 } | 1384 } |
1382 | 1385 |
1383 void VCMJitterBuffer::Process() { | 1386 void VCMJitterBuffer::Process() { |
1384 if (nack_module_) | 1387 if (nack_module_) |
1385 nack_module_->Process(); | 1388 nack_module_->Process(); |
1386 } | 1389 } |
1387 } // namespace webrtc | 1390 } // namespace webrtc |
OLD | NEW |