Expose jitterBufferEmittedCount in addition to the existing jitterBufferDelay for getStats().

NetEq currently only passes `jitterBufferDelay` to `getStats()`. We need its paired `jitterBufferEmittedCount` denominator stat for the calculations to be accurate.

Bug: webrtc:10192
Change-Id: I655aea629026ce9101409c2e0f18c2fa57a1c3ab
Reviewed-on: https://webrtc-review.googlesource.com/c/117320
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Chen Xing <chxg@google.com>
Cr-Commit-Position: refs/heads/master@{#26276}
This commit is contained in:
Chen Xing
2019-01-15 15:46:29 +01:00
committed by Commit Bot
parent 876d1d3fed
commit 0acffb5b36
16 changed files with 32 additions and 3 deletions

View File

@ -245,6 +245,8 @@ void AcmReceiver::GetNetworkStatistics(NetworkStatistics* acm_stat) {
acm_stat->concealedSamples = neteq_lifetime_stat.concealed_samples;
acm_stat->concealmentEvents = neteq_lifetime_stat.concealment_events;
acm_stat->jitterBufferDelayMs = neteq_lifetime_stat.jitter_buffer_delay_ms;
acm_stat->jitterBufferEmittedCount =
neteq_lifetime_stat.jitter_buffer_emitted_count;
acm_stat->delayedPacketOutageSamples =
neteq_lifetime_stat.delayed_packet_outage_samples;

View File

@ -80,6 +80,7 @@ struct NetworkStatistics {
uint64_t concealedSamples;
uint64_t concealmentEvents;
uint64_t jitterBufferDelayMs;
uint64_t jitterBufferEmittedCount;
// Stats below DO NOT correspond directly to anything in the WebRTC stats
// Loss rate (network + late); fraction between 0 and 1, scaled to Q14.
uint16_t currentPacketLossRate;

View File

@ -70,6 +70,7 @@ struct NetEqLifetimeStatistics {
uint64_t concealed_samples = 0;
uint64_t concealment_events = 0;
uint64_t jitter_buffer_delay_ms = 0;
uint64_t jitter_buffer_emitted_count = 0;
// Below stat is not part of the spec.
uint64_t voice_concealed_samples = 0;
uint64_t delayed_packet_outage_samples = 0;

View File

@ -1656,6 +1656,7 @@ void NetEqDecodingTestFaxMode::TestJitterBufferDelay(bool apply_packet_loss) {
int packets_sent = 0;
int packets_received = 0;
int expected_delay = 0;
uint64_t expected_emitted_count = 0;
while (packets_received < kNumPackets) {
// Insert packet.
if (packets_sent < kNumPackets) {
@ -1679,6 +1680,7 @@ void NetEqDecodingTestFaxMode::TestJitterBufferDelay(bool apply_packet_loss) {
// number of samples that are sent for play out.
int current_delay_ms = packets_delay * kPacketLenMs;
expected_delay += current_delay_ms * kSamples;
expected_emitted_count += kSamples;
}
}
@ -1690,6 +1692,7 @@ void NetEqDecodingTestFaxMode::TestJitterBufferDelay(bool apply_packet_loss) {
// Check jitter buffer delay.
NetEqLifetimeStatistics stats = neteq_->GetLifetimeStatistics();
EXPECT_EQ(expected_delay, static_cast<int>(stats.jitter_buffer_delay_ms));
EXPECT_EQ(expected_emitted_count, stats.jitter_buffer_emitted_count);
}
TEST_F(NetEqDecodingTestFaxMode, TestJitterBufferDelayWithoutLoss) {

View File

@ -246,6 +246,7 @@ void StatisticsCalculator::IncreaseCounter(size_t num_samples, int fs_hz) {
void StatisticsCalculator::JitterBufferDelay(size_t num_samples,
uint64_t waiting_time_ms) {
lifetime_stats_.jitter_buffer_delay_ms += waiting_time_ms * num_samples;
lifetime_stats_.jitter_buffer_emitted_count += num_samples;
}
void StatisticsCalculator::SecondaryDecodedSamples(int num_samples) {