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

Unified Diff: webrtc/modules/video_coding/nack_module.cc

Issue 1972123002: Nack count returned on OnReceivedPacket. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/video_coding/nack_module.h ('k') | webrtc/modules/video_coding/nack_module_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/nack_module.cc
diff --git a/webrtc/modules/video_coding/nack_module.cc b/webrtc/modules/video_coding/nack_module.cc
index 1b12afe0f0df2690ed8f0a47f6ff2eb13ac961ba..36353390ecc9d17c786eb4c08a37e772b02f8a4a 100644
--- a/webrtc/modules/video_coding/nack_module.cc
+++ b/webrtc/modules/video_coding/nack_module.cc
@@ -56,10 +56,10 @@ NackModule::NackModule(Clock* clock,
RTC_DCHECK(keyframe_request_sender_);
}
-void NackModule::OnReceivedPacket(const VCMPacket& packet) {
+int NackModule::OnReceivedPacket(const VCMPacket& packet) {
rtc::CritScope lock(&crit_);
if (!running_)
- return;
+ return -1;
uint16_t seq_num = packet.seqNum;
// TODO(philipel): When the packet includes information whether it is
// retransmitted or not, use that value instead. For
@@ -73,36 +73,44 @@ void NackModule::OnReceivedPacket(const VCMPacket& packet) {
if (is_keyframe)
keyframe_list_.insert(seq_num);
initialized_ = true;
- return;
+ return 0;
}
+ // Since the |last_seq_num_| is a packet we have actually received we know
+ // that packet has never been Nacked.
if (seq_num == last_seq_num_)
- return;
+ return 0;
if (AheadOf(last_seq_num_, seq_num)) {
stefan-webrtc 2016/05/12 12:16:53 Should last_seq_num_ be called newest_seq_num_ ins
philipel 2016/05/12 12:55:16 Done.
// An out of order packet has been received.
- nack_list_.erase(seq_num);
+ auto nack_list_it = nack_list_.find(seq_num);
+ if (nack_list_it != nack_list_.end()) {
+ int nacks_sent_for_packet = nack_list_it->second.retries;
+ nack_list_.erase(nack_list_it);
+ return nacks_sent_for_packet;
+ }
if (!is_retransmitted)
UpdateReorderingStatistics(seq_num);
stefan-webrtc 2016/05/12 12:16:53 Should we not update reordering statistics if the
philipel 2016/05/12 12:55:16 If the packet isn't in the nack list then the pack
- return;
- } else {
- AddPacketsToNack(last_seq_num_ + 1, seq_num);
- last_seq_num_ = seq_num;
+ return 0;
+ }
+ AddPacketsToNack(last_seq_num_ + 1, seq_num);
+ last_seq_num_ = seq_num;
- // Keep track of new keyframes.
- if (is_keyframe)
- keyframe_list_.insert(seq_num);
+ // Keep track of new keyframes.
+ if (is_keyframe)
+ keyframe_list_.insert(seq_num);
- // And remove old ones so we don't accumulate keyframes.
- auto it = keyframe_list_.lower_bound(seq_num - kMaxPacketAge);
- if (it != keyframe_list_.begin())
- keyframe_list_.erase(keyframe_list_.begin(), it);
+ // And remove old ones so we don't accumulate keyframes.
+ auto it = keyframe_list_.lower_bound(seq_num - kMaxPacketAge);
+ if (it != keyframe_list_.begin())
+ keyframe_list_.erase(keyframe_list_.begin(), it);
- // Are there any nacks that are waiting for this seq_num.
- std::vector<uint16_t> nack_batch = GetNackBatch(kSeqNumOnly);
- if (!nack_batch.empty())
- nack_sender_->SendNack(nack_batch);
- }
+ // Are there any nacks that are waiting for this seq_num.
+ std::vector<uint16_t> nack_batch = GetNackBatch(kSeqNumOnly);
+ if (!nack_batch.empty())
+ nack_sender_->SendNack(nack_batch);
+
+ return 0;
}
void NackModule::ClearUpTo(uint16_t seq_num) {
« no previous file with comments | « webrtc/modules/video_coding/nack_module.h ('k') | webrtc/modules/video_coding/nack_module_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698