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

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

Issue 2720603002: Remove |running_| state from NackModule to avoid running a tight loop. (Closed)
Patch Set: Created 3 years, 10 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
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 d74f08952617da38ad7a7d75b7f87067021816a5..1bd88f0fc188e47df512916252cfd9ef4ff0e068 100644
--- a/webrtc/modules/video_coding/nack_module.cc
+++ b/webrtc/modules/video_coding/nack_module.cc
@@ -46,7 +46,6 @@ NackModule::NackModule(Clock* clock,
nack_sender_(nack_sender),
keyframe_request_sender_(keyframe_request_sender),
reordering_histogram_(kNumReorderingBuckets, kMaxReorderedPackets),
- running_(true),
initialized_(false),
rtt_ms_(kDefaultRttMs),
newest_seq_num_(0),
@@ -58,8 +57,6 @@ NackModule::NackModule(Clock* clock,
int NackModule::OnReceivedPacket(const VCMPacket& packet) {
rtc::CritScope lock(&crit_);
- if (!running_)
- 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
@@ -132,21 +129,22 @@ void NackModule::Clear() {
keyframe_list_.clear();
}
-void NackModule::Stop() {
- rtc::CritScope lock(&crit_);
- running_ = false;
-}
-
int64_t NackModule::TimeUntilNextProcess() {
- rtc::CritScope lock(&crit_);
return std::max<int64_t>(next_process_time_ms_ - clock_->TimeInMilliseconds(),
0);
}
void NackModule::Process() {
- rtc::CritScope lock(&crit_);
- if (!running_)
- return;
+ if (nack_sender_) {
+ std::vector<uint16_t> nack_batch;
+ {
+ rtc::CritScope lock(&crit_);
+ nack_batch = GetNackBatch(kTimeOnly);
+ }
+
+ if (!nack_batch.empty())
+ nack_sender_->SendNack(nack_batch);
+ }
// Update the next_process_time_ms_ in intervals to achieve
// the targeted frequency over time. Also add multiple intervals
@@ -160,10 +158,6 @@ void NackModule::Process() {
(now_ms - next_process_time_ms_) /
kProcessIntervalMs * kProcessIntervalMs;
}
-
- std::vector<uint16_t> nack_batch = GetNackBatch(kTimeOnly);
- if (!nack_batch.empty() && nack_sender_ != nullptr)
- nack_sender_->SendNack(nack_batch);
}
bool NackModule::RemovePacketsUntilKeyFrame() {

Powered by Google App Engine
This is Rietveld 408576698