Expose delayed packet outage as a cumulative metric of samples in the new getStats API.
The stat will be exposed through origin trial described in: https://docs.google.com/document/d/1stYIZhEmDZ7NJF9gjjsM66eLFJUdc-14a3QutrFbIwI Change-Id: Ib191a11c6bd9e617abbe9dd82239b0c5b4e6b4e0 Bug: webrtc:10043 Reviewed-on: https://webrtc-review.googlesource.com/c/111922 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Ivo Creusen <ivoc@webrtc.org> Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Reviewed-by: Minyue Li <minyue@webrtc.org> Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25802}
This commit is contained in:
committed by
Commit Bot
parent
59cfd35438
commit
352ce5c419
@ -323,8 +323,7 @@ void Expand::SetParametersForNormalAfterExpand() {
|
||||
current_lag_index_ = 0;
|
||||
lag_index_direction_ = 0;
|
||||
stop_muting_ = true; // Do not mute signal any more.
|
||||
statistics_->LogDelayedPacketOutageEvent(
|
||||
rtc::dchecked_cast<int>(expand_duration_samples_) / (fs_hz_ / 1000));
|
||||
statistics_->LogDelayedPacketOutageEvent(expand_duration_samples_, fs_hz_);
|
||||
}
|
||||
|
||||
void Expand::SetParametersForMergeAfterExpand() {
|
||||
|
||||
@ -51,14 +51,16 @@ TEST(Expand, CreateUsingFactory) {
|
||||
namespace {
|
||||
class FakeStatisticsCalculator : public StatisticsCalculator {
|
||||
public:
|
||||
void LogDelayedPacketOutageEvent(int outage_duration_ms) override {
|
||||
last_outage_duration_ms_ = outage_duration_ms;
|
||||
void LogDelayedPacketOutageEvent(int num_samples, int fs_hz) override {
|
||||
last_outage_duration_samples_ = num_samples;
|
||||
}
|
||||
|
||||
int last_outage_duration_ms() const { return last_outage_duration_ms_; }
|
||||
int last_outage_duration_samples() const {
|
||||
return last_outage_duration_samples_;
|
||||
}
|
||||
|
||||
private:
|
||||
int last_outage_duration_ms_ = 0;
|
||||
int last_outage_duration_samples_ = 0;
|
||||
};
|
||||
|
||||
// This is the same size that is given to the SyncBuffer object in NetEq.
|
||||
@ -120,13 +122,12 @@ TEST_F(ExpandTest, DelayedPacketOutage) {
|
||||
EXPECT_EQ(0, expand_.Process(&output));
|
||||
EXPECT_GT(output.Size(), 0u);
|
||||
sum_output_len_samples += output.Size();
|
||||
EXPECT_EQ(0, statistics_.last_outage_duration_ms());
|
||||
EXPECT_EQ(0, statistics_.last_outage_duration_samples());
|
||||
}
|
||||
expand_.SetParametersForNormalAfterExpand();
|
||||
// Convert |sum_output_len_samples| to milliseconds.
|
||||
EXPECT_EQ(rtc::checked_cast<int>(sum_output_len_samples /
|
||||
(test_sample_rate_hz_ / 1000)),
|
||||
statistics_.last_outage_duration_ms());
|
||||
EXPECT_EQ(rtc::checked_cast<int>(sum_output_len_samples),
|
||||
statistics_.last_outage_duration_samples());
|
||||
}
|
||||
|
||||
// This test is similar to DelayedPacketOutage, but ends by calling
|
||||
@ -140,10 +141,10 @@ TEST_F(ExpandTest, LostPacketOutage) {
|
||||
EXPECT_EQ(0, expand_.Process(&output));
|
||||
EXPECT_GT(output.Size(), 0u);
|
||||
sum_output_len_samples += output.Size();
|
||||
EXPECT_EQ(0, statistics_.last_outage_duration_ms());
|
||||
EXPECT_EQ(0, statistics_.last_outage_duration_samples());
|
||||
}
|
||||
expand_.SetParametersForMergeAfterExpand();
|
||||
EXPECT_EQ(0, statistics_.last_outage_duration_ms());
|
||||
EXPECT_EQ(0, statistics_.last_outage_duration_samples());
|
||||
}
|
||||
|
||||
// This test is similar to the DelayedPacketOutage test above, but with the
|
||||
@ -161,13 +162,12 @@ TEST_F(ExpandTest, CheckOutageStatsAfterReset) {
|
||||
expand_.Reset();
|
||||
sum_output_len_samples = 0;
|
||||
}
|
||||
EXPECT_EQ(0, statistics_.last_outage_duration_ms());
|
||||
EXPECT_EQ(0, statistics_.last_outage_duration_samples());
|
||||
}
|
||||
expand_.SetParametersForNormalAfterExpand();
|
||||
// Convert |sum_output_len_samples| to milliseconds.
|
||||
EXPECT_EQ(rtc::checked_cast<int>(sum_output_len_samples /
|
||||
(test_sample_rate_hz_ / 1000)),
|
||||
statistics_.last_outage_duration_ms());
|
||||
EXPECT_EQ(rtc::checked_cast<int>(sum_output_len_samples),
|
||||
statistics_.last_outage_duration_samples());
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
@ -72,6 +72,7 @@ struct NetEqLifetimeStatistics {
|
||||
uint64_t jitter_buffer_delay_ms = 0;
|
||||
// Below stat is not part of the spec.
|
||||
uint64_t voice_concealed_samples = 0;
|
||||
uint64_t delayed_packet_outage_samples = 0;
|
||||
};
|
||||
|
||||
// Metrics that describe the operations performed in NetEq, and the internal
|
||||
|
||||
@ -257,11 +257,14 @@ void StatisticsCalculator::FlushedPacketBuffer() {
|
||||
buffer_full_counter_.RegisterSample();
|
||||
}
|
||||
|
||||
void StatisticsCalculator::LogDelayedPacketOutageEvent(int outage_duration_ms) {
|
||||
void StatisticsCalculator::LogDelayedPacketOutageEvent(int num_samples,
|
||||
int fs_hz) {
|
||||
int outage_duration_ms = num_samples / (fs_hz / 1000);
|
||||
RTC_HISTOGRAM_COUNTS("WebRTC.Audio.DelayedPacketOutageEventMs",
|
||||
outage_duration_ms, 1 /* min */, 2000 /* max */,
|
||||
100 /* bucket count */);
|
||||
delayed_packet_outage_counter_.RegisterSample();
|
||||
lifetime_stats_.delayed_packet_outage_samples += num_samples;
|
||||
}
|
||||
|
||||
void StatisticsCalculator::StoreWaitingTime(int waiting_time_ms) {
|
||||
|
||||
@ -86,10 +86,10 @@ class StatisticsCalculator {
|
||||
// Rerport that the packet buffer was flushed.
|
||||
void FlushedPacketBuffer();
|
||||
|
||||
// Logs a delayed packet outage event of |outage_duration_ms|. A delayed
|
||||
// packet outage event is defined as an expand period caused not by an actual
|
||||
// packet loss, but by a delayed packet.
|
||||
virtual void LogDelayedPacketOutageEvent(int outage_duration_ms);
|
||||
// Logs a delayed packet outage event of |num_samples| expanded at a sample
|
||||
// rate of |fs_hz|. A delayed packet outage event is defined as an expand
|
||||
// period caused not by an actual packet loss, but by a delayed packet.
|
||||
virtual void LogDelayedPacketOutageEvent(int num_samples, int fs_hz);
|
||||
|
||||
// Returns the current network statistics in |stats|. The current sample rate
|
||||
// is |fs_hz|, the total number of samples in packet buffer and sync buffer
|
||||
|
||||
Reference in New Issue
Block a user