Adding speech_expand_rate to NetEQ Network Statistics.
There have been requests for separating rate of expanded speech samples from noise samples. BUG= R=henrik.lundin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/37309004 Cr-Commit-Position: refs/heads/master@{#8404} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8404 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
3864363e2c
commit
7d721eea14
@ -33,7 +33,9 @@ struct NetEqNetworkStatistics {
|
||||
uint16_t packet_loss_rate; // Loss rate (network + late) in Q14.
|
||||
uint16_t packet_discard_rate; // Late loss rate in Q14.
|
||||
uint16_t expand_rate; // Fraction (of original stream) of synthesized
|
||||
// speech inserted through expansion (in Q14).
|
||||
// audio inserted through expansion (in Q14).
|
||||
uint16_t speech_expand_rate; // Fraction (of original stream) of synthesized
|
||||
// speech inserted through expansion (in Q14).
|
||||
uint16_t preemptive_rate; // Fraction of data inserted through pre-emptive
|
||||
// expansion (in Q14).
|
||||
uint16_t accelerate_rate; // Fraction of data removed through acceleration
|
||||
|
@ -90,6 +90,7 @@ struct NetEqNetworkStatsCheck {
|
||||
logic packet_loss_rate;
|
||||
logic packet_discard_rate;
|
||||
logic expand_rate;
|
||||
logic speech_expand_rate;
|
||||
logic preemptive_rate;
|
||||
logic accelerate_rate;
|
||||
logic secondary_decoded_rate;
|
||||
@ -153,6 +154,7 @@ struct NetEqNetworkStatsCheck {
|
||||
CHECK_NETEQ_NETWORK_STATS(packet_loss_rate);
|
||||
CHECK_NETEQ_NETWORK_STATS(packet_discard_rate);
|
||||
CHECK_NETEQ_NETWORK_STATS(expand_rate);
|
||||
CHECK_NETEQ_NETWORK_STATS(speech_expand_rate);
|
||||
CHECK_NETEQ_NETWORK_STATS(preemptive_rate);
|
||||
CHECK_NETEQ_NETWORK_STATS(accelerate_rate);
|
||||
CHECK_NETEQ_NETWORK_STATS(secondary_decoded_rate);
|
||||
@ -198,30 +200,55 @@ struct NetEqNetworkStatsCheck {
|
||||
EQUAL, // packet_loss_rate
|
||||
EQUAL, // packet_discard_rate
|
||||
EQUAL, // expand_rate
|
||||
EQUAL, // voice_expand_rate
|
||||
IGNORE, // preemptive_rate
|
||||
EQUAL, // accelerate_rate
|
||||
EQUAL, // decoded_fec_rate
|
||||
IGNORE, // clockdrift_ppm
|
||||
EQUAL, // added_zero_samples
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
RunTest(50, expects);
|
||||
|
||||
// Next we introduce packet losses.
|
||||
SetPacketLossRate(0.1);
|
||||
expects.stats_ref.packet_loss_rate = 1337;
|
||||
expects.stats_ref.expand_rate = 1065;
|
||||
expects.stats_ref.expand_rate = expects.stats_ref.speech_expand_rate = 1065;
|
||||
RunTest(50, expects);
|
||||
|
||||
// Next we enable Opus FEC.
|
||||
external_decoder_->set_fec_enabled(true);
|
||||
// If FEC fills in the lost packets, no packet loss will be counted.
|
||||
expects.stats_ref.packet_loss_rate = 0;
|
||||
expects.stats_ref.expand_rate = 0;
|
||||
expects.stats_ref.expand_rate = expects.stats_ref.speech_expand_rate = 0;
|
||||
expects.stats_ref.secondary_decoded_rate = 2006;
|
||||
RunTest(50, expects);
|
||||
}
|
||||
|
||||
void NoiseExpansionTest() {
|
||||
NetEqNetworkStatsCheck expects = {
|
||||
IGNORE, // current_buffer_size_ms
|
||||
IGNORE, // preferred_buffer_size_ms
|
||||
IGNORE, // jitter_peaks_found
|
||||
EQUAL, // packet_loss_rate
|
||||
EQUAL, // packet_discard_rate
|
||||
EQUAL, // expand_rate
|
||||
EQUAL, // speech_expand_rate
|
||||
IGNORE, // preemptive_rate
|
||||
EQUAL, // accelerate_rate
|
||||
EQUAL, // decoded_fec_rate
|
||||
IGNORE, // clockdrift_ppm
|
||||
EQUAL, // added_zero_samples
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
RunTest(50, expects);
|
||||
|
||||
SetPacketLossRate(1);
|
||||
expects.stats_ref.expand_rate = 16384;
|
||||
expects.stats_ref.speech_expand_rate = 5324;
|
||||
RunTest(10, expects); // Lost 10 * 20ms in a row.
|
||||
}
|
||||
|
||||
private:
|
||||
MockAudioDecoderOpus* external_decoder_;
|
||||
const int samples_per_ms_;
|
||||
@ -250,6 +277,14 @@ TEST(NetEqNetworkStatsTest, StereoOpusDecodeFec) {
|
||||
EXPECT_CALL(decoder, Die()).Times(1);
|
||||
}
|
||||
|
||||
TEST(NetEqNetworkStatsTest, NoiseExpansionTest) {
|
||||
MockAudioDecoderOpus decoder(1);
|
||||
EXPECT_CALL(decoder, Init());
|
||||
NetEqNetworkStatsTest test(kDecoderOpus, &decoder);
|
||||
test.NoiseExpansionTest();
|
||||
EXPECT_CALL(decoder, Die()).Times(1);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
||||
|
@ -147,7 +147,7 @@ void RefFiles::ReadFromFileAndCompare(
|
||||
uint16_t packet_loss_rate; // Loss rate (network + late) in Q14.
|
||||
uint16_t packet_discard_rate; // Late loss rate in Q14.
|
||||
uint16_t expand_rate; // Fraction (of original stream) of synthesized
|
||||
// speech inserted through expansion (in Q14).
|
||||
// audio inserted through expansion (in Q14).
|
||||
uint16_t preemptive_rate; // Fraction of data inserted through pre-emptive
|
||||
// expansion (in Q14).
|
||||
uint16_t accelerate_rate; // Fraction of data removed through acceleration
|
||||
@ -168,11 +168,13 @@ void RefFiles::ReadFromFileAndCompare(
|
||||
ASSERT_EQ(stats.jitter_peaks_found, ref_stats.jitter_peaks_found);
|
||||
ASSERT_EQ(stats.packet_loss_rate, ref_stats.packet_loss_rate);
|
||||
ASSERT_EQ(stats.packet_discard_rate, ref_stats.packet_discard_rate);
|
||||
ASSERT_EQ(stats.expand_rate, ref_stats.expand_rate);
|
||||
ASSERT_EQ(stats.preemptive_rate, ref_stats.preemptive_rate);
|
||||
ASSERT_EQ(stats.accelerate_rate, ref_stats.accelerate_rate);
|
||||
ASSERT_EQ(stats.clockdrift_ppm, ref_stats.clockdrift_ppm);
|
||||
ASSERT_EQ(stats.added_zero_samples, ref_stats.added_zero_samples);
|
||||
ASSERT_EQ(stats.secondary_decoded_rate, 0);
|
||||
ASSERT_LE(stats.speech_expand_rate, ref_stats.expand_rate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ StatisticsCalculator::StatisticsCalculator()
|
||||
: preemptive_samples_(0),
|
||||
accelerate_samples_(0),
|
||||
added_zero_samples_(0),
|
||||
expanded_voice_samples_(0),
|
||||
expanded_speech_samples_(0),
|
||||
expanded_noise_samples_(0),
|
||||
discarded_packets_(0),
|
||||
lost_timestamps_(0),
|
||||
@ -37,7 +37,7 @@ void StatisticsCalculator::Reset() {
|
||||
preemptive_samples_ = 0;
|
||||
accelerate_samples_ = 0;
|
||||
added_zero_samples_ = 0;
|
||||
expanded_voice_samples_ = 0;
|
||||
expanded_speech_samples_ = 0;
|
||||
expanded_noise_samples_ = 0;
|
||||
secondary_decoded_samples_ = 0;
|
||||
}
|
||||
@ -55,7 +55,7 @@ void StatisticsCalculator::ResetWaitingTimeStatistics() {
|
||||
}
|
||||
|
||||
void StatisticsCalculator::ExpandedVoiceSamples(int num_samples) {
|
||||
expanded_voice_samples_ += num_samples;
|
||||
expanded_speech_samples_ += num_samples;
|
||||
}
|
||||
|
||||
void StatisticsCalculator::ExpandedNoiseSamples(int num_samples) {
|
||||
@ -143,9 +143,13 @@ void StatisticsCalculator::GetNetworkStatistics(
|
||||
CalculateQ14Ratio(preemptive_samples_, timestamps_since_last_report_);
|
||||
|
||||
stats->expand_rate =
|
||||
CalculateQ14Ratio(expanded_voice_samples_ + expanded_noise_samples_,
|
||||
CalculateQ14Ratio(expanded_speech_samples_ + expanded_noise_samples_,
|
||||
timestamps_since_last_report_);
|
||||
|
||||
stats->speech_expand_rate =
|
||||
CalculateQ14Ratio(expanded_speech_samples_,
|
||||
timestamps_since_last_report_);
|
||||
|
||||
stats->secondary_decoded_rate =
|
||||
CalculateQ14Ratio(secondary_decoded_samples_,
|
||||
timestamps_since_last_report_);
|
||||
|
@ -96,7 +96,7 @@ class StatisticsCalculator {
|
||||
uint32_t preemptive_samples_;
|
||||
uint32_t accelerate_samples_;
|
||||
int added_zero_samples_;
|
||||
uint32_t expanded_voice_samples_;
|
||||
uint32_t expanded_speech_samples_;
|
||||
uint32_t expanded_noise_samples_;
|
||||
int discarded_packets_;
|
||||
uint32_t lost_timestamps_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user