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

Unified Diff: webrtc/modules/audio_coding/neteq/nack.cc

Issue 1410073006: ACM: Move NACK functionality inside NetEq (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add function descriptions Created 5 years, 2 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/audio_coding/neteq/nack.cc
diff --git a/webrtc/modules/audio_coding/main/acm2/nack.cc b/webrtc/modules/audio_coding/neteq/nack.cc
similarity index 87%
rename from webrtc/modules/audio_coding/main/acm2/nack.cc
rename to webrtc/modules/audio_coding/neteq/nack.cc
index 525b1ea8c6898c7a825542872edf33c100707987..9e178be84e7b42d74648f77d945abeffc5a4c539 100644
--- a/webrtc/modules/audio_coding/main/acm2/nack.cc
+++ b/webrtc/modules/audio_coding/neteq/nack.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/modules/audio_coding/main/acm2/nack.h"
+#include "webrtc/modules/audio_coding/neteq/nack.h"
#include <assert.h> // For assert.
@@ -18,9 +18,6 @@
#include "webrtc/system_wrappers/interface/logging.h"
namespace webrtc {
-
-namespace acm2 {
-
namespace {
const int kDefaultSampleRateKhz = 48;
@@ -89,10 +86,10 @@ void Nack::UpdateLastReceivedPacket(uint16_t sequence_number,
void Nack::UpdateSamplesPerPacket(uint16_t sequence_number_current_received_rtp,
uint32_t timestamp_current_received_rtp) {
- uint32_t timestamp_increase = timestamp_current_received_rtp -
- timestamp_last_received_rtp_;
- uint16_t sequence_num_increase = sequence_number_current_received_rtp -
- sequence_num_last_received_rtp_;
+ uint32_t timestamp_increase =
+ timestamp_current_received_rtp - timestamp_last_received_rtp_;
+ uint16_t sequence_num_increase =
+ sequence_number_current_received_rtp - sequence_num_last_received_rtp_;
samples_per_packet_ = timestamp_increase / sequence_num_increase;
}
@@ -108,9 +105,9 @@ void Nack::UpdateList(uint16_t sequence_number_current_received_rtp) {
void Nack::ChangeFromLateToMissing(
uint16_t sequence_number_current_received_rtp) {
- NackList::const_iterator lower_bound = nack_list_.lower_bound(
- static_cast<uint16_t>(sequence_number_current_received_rtp -
- nack_threshold_packets_));
+ NackList::const_iterator lower_bound =
+ nack_list_.lower_bound(static_cast<uint16_t>(
+ sequence_number_current_received_rtp - nack_threshold_packets_));
for (NackList::iterator it = nack_list_.begin(); it != lower_bound; ++it)
it->second.is_missing = true;
@@ -122,16 +119,17 @@ uint32_t Nack::EstimateTimestamp(uint16_t sequence_num) {
}
void Nack::AddToList(uint16_t sequence_number_current_received_rtp) {
- assert(!any_rtp_decoded_ || IsNewerSequenceNumber(
- sequence_number_current_received_rtp, sequence_num_last_decoded_rtp_));
+ assert(!any_rtp_decoded_ ||
+ IsNewerSequenceNumber(sequence_number_current_received_rtp,
+ sequence_num_last_decoded_rtp_));
// Packets with sequence numbers older than |upper_bound_missing| are
// considered missing, and the rest are considered late.
- uint16_t upper_bound_missing = sequence_number_current_received_rtp -
- nack_threshold_packets_;
+ uint16_t upper_bound_missing =
+ sequence_number_current_received_rtp - nack_threshold_packets_;
for (uint16_t n = sequence_num_last_received_rtp_ + 1;
- IsNewerSequenceNumber(sequence_number_current_received_rtp, n); ++n) {
+ IsNewerSequenceNumber(sequence_number_current_received_rtp, n); ++n) {
bool is_missing = IsNewerSequenceNumber(upper_bound_missing, n);
uint32_t timestamp = EstimateTimestamp(n);
NackElement nack_element(TimeToPlay(timestamp), timestamp, is_missing);
@@ -141,7 +139,7 @@ void Nack::AddToList(uint16_t sequence_number_current_received_rtp) {
void Nack::UpdateEstimatedPlayoutTimeBy10ms() {
while (!nack_list_.empty() &&
- nack_list_.begin()->second.time_to_play_ms <= 10)
+ nack_list_.begin()->second.time_to_play_ms <= 10)
minyue-webrtc 2015/10/27 14:35:08 I know that breaking at ";" can follow the "," rul
hlundin-webrtc 2015/10/28 15:03:36 This is what git cl format gives me.
minyue-webrtc 2015/10/29 10:36:10 Acknowledged.
nack_list_.erase(nack_list_.begin());
for (NackList::iterator it = nack_list_.begin(); it != nack_list_.end(); ++it)
@@ -157,12 +155,12 @@ void Nack::UpdateLastDecodedPacket(uint16_t sequence_number,
// Packets in the list with sequence numbers less than the
// sequence number of the decoded RTP should be removed from the lists.
// They will be discarded by the jitter buffer if they arrive.
- nack_list_.erase(nack_list_.begin(), nack_list_.upper_bound(
- sequence_num_last_decoded_rtp_));
+ nack_list_.erase(nack_list_.begin(),
+ nack_list_.upper_bound(sequence_num_last_decoded_rtp_));
// Update estimated time-to-play.
for (NackList::iterator it = nack_list_.begin(); it != nack_list_.end();
- ++it)
+ ++it)
it->second.time_to_play_ms = TimeToPlay(it->second.estimated_timestamp);
} else {
assert(sequence_number == sequence_num_last_decoded_rtp_);
@@ -205,7 +203,7 @@ int Nack::SetMaxNackListSize(size_t max_nack_list_size) {
void Nack::LimitNackListSize() {
uint16_t limit = sequence_num_last_received_rtp_ -
- static_cast<uint16_t>(max_nack_list_size_) - 1;
+ static_cast<uint16_t>(max_nack_list_size_) - 1;
nack_list_.erase(nack_list_.begin(), nack_list_.upper_bound(limit));
}
@@ -218,7 +216,7 @@ int64_t Nack::TimeToPlay(uint32_t timestamp) const {
std::vector<uint16_t> Nack::GetNackList(int64_t round_trip_time_ms) const {
std::vector<uint16_t> sequence_numbers;
for (NackList::const_iterator it = nack_list_.begin(); it != nack_list_.end();
- ++it) {
+ ++it) {
if (it->second.is_missing &&
it->second.time_to_play_ms > round_trip_time_ms)
sequence_numbers.push_back(it->first);
@@ -226,6 +224,4 @@ std::vector<uint16_t> Nack::GetNackList(int64_t round_trip_time_ms) const {
return sequence_numbers;
}
-} // namespace acm2
-
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698