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

Unified Diff: webrtc/modules/audio_coding/main/acm2/acm_receiver.cc

Issue 1296633002: NetEq/ACM: Refactor how packet waiting times are calculated (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebasing Created 5 years, 4 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/main/acm2/acm_receiver.cc
diff --git a/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc b/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
index 1cefeb662661091a782be499dc8e02699616d7ab..2040ae1c4ed11f71853d4d4e0b3d24a7dbf7c6e4 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
+++ b/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
@@ -15,6 +15,7 @@
#include <algorithm> // sort
#include <vector>
+#include "webrtc/base/checks.h"
#include "webrtc/base/format_macros.h"
#include "webrtc/base/logging.h"
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
@@ -652,31 +653,10 @@ void AcmReceiver::GetNetworkStatistics(NetworkStatistics* acm_stat) {
acm_stat->currentSecondaryDecodedRate = neteq_stat.secondary_decoded_rate;
acm_stat->clockDriftPPM = neteq_stat.clockdrift_ppm;
acm_stat->addedSamples = neteq_stat.added_zero_samples;
-
- std::vector<int> waiting_times;
- neteq_->WaitingTimes(&waiting_times);
- size_t size = waiting_times.size();
- if (size == 0) {
- acm_stat->meanWaitingTimeMs = -1;
- acm_stat->medianWaitingTimeMs = -1;
- acm_stat->minWaitingTimeMs = -1;
- acm_stat->maxWaitingTimeMs = -1;
- } else {
- std::sort(waiting_times.begin(), waiting_times.end());
- if ((size & 0x1) == 0) {
- acm_stat->medianWaitingTimeMs = (waiting_times[size / 2 - 1] +
- waiting_times[size / 2]) / 2;
- } else {
- acm_stat->medianWaitingTimeMs = waiting_times[size / 2];
- }
- acm_stat->minWaitingTimeMs = waiting_times.front();
- acm_stat->maxWaitingTimeMs = waiting_times.back();
- double sum = 0;
- for (size_t i = 0; i < size; ++i) {
- sum += waiting_times[i];
- }
- acm_stat->meanWaitingTimeMs = static_cast<int>(sum / size);
- }
+ acm_stat->meanWaitingTimeMs = neteq_stat.mean_waiting_time_ms;
+ acm_stat->medianWaitingTimeMs = neteq_stat.median_waiting_time_ms;
+ acm_stat->minWaitingTimeMs = neteq_stat.min_waiting_time_ms;
+ acm_stat->maxWaitingTimeMs = neteq_stat.max_waiting_time_ms;
}
int AcmReceiver::DecoderByPayloadType(uint8_t payload_type,

Powered by Google App Engine
This is Rietveld 408576698