Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: webrtc/modules/video_coding/main/source/jitter_buffer.cc

Issue 1211873004: Request keyframe if too many packets are missing and NACK is disabled. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 933
934 VCMFrameBuffer* VCMJitterBuffer::NextFrame() const { 934 VCMFrameBuffer* VCMJitterBuffer::NextFrame() const {
935 if (!decodable_frames_.empty()) 935 if (!decodable_frames_.empty())
936 return decodable_frames_.Front(); 936 return decodable_frames_.Front();
937 if (!incomplete_frames_.empty()) 937 if (!incomplete_frames_.empty())
938 return incomplete_frames_.Front(); 938 return incomplete_frames_.Front();
939 return NULL; 939 return NULL;
940 } 940 }
941 941
942 bool VCMJitterBuffer::UpdateNackList(uint16_t sequence_number) { 942 bool VCMJitterBuffer::UpdateNackList(uint16_t sequence_number) {
943 if (nack_mode_ == kNoNack) {
944 return true;
945 }
946 // Make sure we don't add packets which are already too old to be decoded. 943 // Make sure we don't add packets which are already too old to be decoded.
947 if (!last_decoded_state_.in_initial_state()) { 944 if (!last_decoded_state_.in_initial_state()) {
948 latest_received_sequence_number_ = LatestSequenceNumber( 945 latest_received_sequence_number_ = LatestSequenceNumber(
949 latest_received_sequence_number_, 946 latest_received_sequence_number_,
950 last_decoded_state_.sequence_num()); 947 last_decoded_state_.sequence_num());
951 } 948 }
952 if (IsNewerSequenceNumber(sequence_number, 949 if (IsNewerSequenceNumber(sequence_number,
953 latest_received_sequence_number_)) { 950 latest_received_sequence_number_)) {
951 if (nack_mode_ == kNoNack) {
952 // Packets missing but NACK disabled, request key frame.
pbos-webrtc 2015/06/26 05:01:02 Should we request a keyframe even though the seque
joachim 2015/06/26 07:46:01 I'm not sure how to check if the sequence is decod
953 return false;
954 }
954 // Push any missing sequence numbers to the NACK list. 955 // Push any missing sequence numbers to the NACK list.
955 for (uint16_t i = latest_received_sequence_number_ + 1; 956 for (uint16_t i = latest_received_sequence_number_ + 1;
956 IsNewerSequenceNumber(sequence_number, i); ++i) { 957 IsNewerSequenceNumber(sequence_number, i); ++i) {
957 missing_sequence_numbers_.insert(missing_sequence_numbers_.end(), i); 958 missing_sequence_numbers_.insert(missing_sequence_numbers_.end(), i);
958 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "AddNack", 959 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "AddNack",
959 "seqnum", i); 960 "seqnum", i);
960 } 961 }
961 if (TooLargeNackList() && !HandleTooLargeNackList()) { 962 if (TooLargeNackList() && !HandleTooLargeNackList()) {
962 LOG(LS_WARNING) << "Requesting key frame due to too large NACK list."; 963 LOG(LS_WARNING) << "Requesting key frame due to too large NACK list.";
963 return false; 964 return false;
964 } 965 }
965 if (MissingTooOldPacket(sequence_number) && 966 if (MissingTooOldPacket(sequence_number) &&
966 !HandleTooOldPackets(sequence_number)) { 967 !HandleTooOldPackets(sequence_number)) {
967 LOG(LS_WARNING) << "Requesting key frame due to missing too old packets"; 968 LOG(LS_WARNING) << "Requesting key frame due to missing too old packets";
968 return false; 969 return false;
969 } 970 }
970 } else { 971 } else if (nack_mode_ != kNoNack) {
971 missing_sequence_numbers_.erase(sequence_number); 972 missing_sequence_numbers_.erase(sequence_number);
972 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RemoveNack", 973 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RemoveNack",
973 "seqnum", sequence_number); 974 "seqnum", sequence_number);
974 } 975 }
975 return true; 976 return true;
976 } 977 }
977 978
978 bool VCMJitterBuffer::TooLargeNackList() const { 979 bool VCMJitterBuffer::TooLargeNackList() const {
979 return missing_sequence_numbers_.size() > max_nack_list_size_; 980 return missing_sequence_numbers_.size() > max_nack_list_size_;
980 } 981 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 } 1216 }
1216 // Evaluate if the RTT is higher than |high_rtt_nack_threshold_ms_|, and in 1217 // Evaluate if the RTT is higher than |high_rtt_nack_threshold_ms_|, and in
1217 // that case we don't wait for retransmissions. 1218 // that case we don't wait for retransmissions.
1218 if (high_rtt_nack_threshold_ms_ >= 0 && 1219 if (high_rtt_nack_threshold_ms_ >= 0 &&
1219 rtt_ms_ >= high_rtt_nack_threshold_ms_) { 1220 rtt_ms_ >= high_rtt_nack_threshold_ms_) {
1220 return false; 1221 return false;
1221 } 1222 }
1222 return true; 1223 return true;
1223 } 1224 }
1224 } // namespace webrtc 1225 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698