Reland of "Reporting of decoding_codec_plc events""

This is a reland of 0a88ea050c.

The new stat will not be reported unless it is GT 0.

Reporting of decoding_codec_plc events

Bug: webrtc:10838
Change-Id: Ic8585b4eeae9a2643374f15bc2578d1141e59683
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148448
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Alex Narest <alexnarest@google.com>
Cr-Commit-Position: refs/heads/master@{#28797}
This commit is contained in:
Alex Narest 2019-08-07 18:15:08 +02:00 committed by Commit Bot
parent 2d2bbb16e5
commit 5b5d97c938
17 changed files with 56 additions and 13 deletions

View file

@ -52,6 +52,7 @@ class AudioFrame {
kPLC = 1,
kCNG = 2,
kPLCCNG = 3,
kCodecPLC = 5,
kUndefined = 4
};

View file

@ -489,6 +489,8 @@ const char* StatsReport::Value::display_name() const {
return "googDecodingNormal";
case kStatsValueNameDecodingPLC:
return "googDecodingPLC";
case kStatsValueNameDecodingCodecPLC:
return "googDecodingCodecPLC";
case kStatsValueNameDecodingCNG:
return "googDecodingCNG";
case kStatsValueNameDecodingPLCCNG:

View file

@ -163,6 +163,7 @@ class StatsReport {
kStatsValueNameDecodingMutedOutput,
kStatsValueNameDecodingNormal,
kStatsValueNameDecodingPLC,
kStatsValueNameDecodingCodecPLC,
kStatsValueNameDecodingPLCCNG,
kStatsValueNameDer,
kStatsValueNameDtlsCipher,

View file

@ -239,7 +239,8 @@ webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const {
stats.decoding_calls_to_silence_generator = ds.calls_to_silence_generator;
stats.decoding_calls_to_neteq = ds.calls_to_neteq;
stats.decoding_normal = ds.decoded_normal;
stats.decoding_plc = ds.decoded_plc;
stats.decoding_plc = ds.decoded_neteq_plc;
stats.decoding_codec_plc = ds.decoded_codec_plc;
stats.decoding_cng = ds.decoded_cng;
stats.decoding_plc_cng = ds.decoded_plc_cng;
stats.decoding_muted_output = ds.decoded_muted_output;

View file

@ -43,7 +43,8 @@ AudioDecodingCallStats MakeAudioDecodeStatsForTest() {
audio_decode_stats.calls_to_silence_generator = 234;
audio_decode_stats.calls_to_neteq = 567;
audio_decode_stats.decoded_normal = 890;
audio_decode_stats.decoded_plc = 123;
audio_decode_stats.decoded_neteq_plc = 123;
audio_decode_stats.decoded_codec_plc = 124;
audio_decode_stats.decoded_cng = 456;
audio_decode_stats.decoded_plc_cng = 789;
audio_decode_stats.decoded_muted_output = 987;
@ -306,7 +307,8 @@ TEST(AudioReceiveStreamTest, GetStats) {
stats.decoding_calls_to_silence_generator);
EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq);
EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal);
EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc);
EXPECT_EQ(kAudioDecodeStats.decoded_neteq_plc, stats.decoding_plc);
EXPECT_EQ(kAudioDecodeStats.decoded_codec_plc, stats.decoding_codec_plc);
EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng);
EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng);
EXPECT_EQ(kAudioDecodeStats.decoded_muted_output,

View file

@ -72,7 +72,9 @@ class AudioReceiveStream {
int32_t decoding_calls_to_silence_generator = 0;
int32_t decoding_calls_to_neteq = 0;
int32_t decoding_normal = 0;
// TODO(alexnarest): Consider decoding_neteq_plc for consistency
int32_t decoding_plc = 0;
int32_t decoding_codec_plc = 0;
int32_t decoding_cng = 0;
int32_t decoding_plc_cng = 0;
int32_t decoding_muted_output = 0;

View file

@ -522,7 +522,9 @@ struct VoiceReceiverInfo : public MediaReceiverInfo {
int decoding_calls_to_silence_generator = 0;
int decoding_calls_to_neteq = 0;
int decoding_normal = 0;
// TODO(alexnarest): Consider decoding_neteq_plc for consistency
int decoding_plc = 0;
int decoding_codec_plc = 0;
int decoding_cng = 0;
int decoding_plc_cng = 0;
int decoding_muted_output = 0;

View file

@ -2238,6 +2238,7 @@ bool WebRtcVoiceMediaChannel::GetStats(VoiceMediaInfo* info) {
rinfo.decoding_calls_to_neteq = stats.decoding_calls_to_neteq;
rinfo.decoding_normal = stats.decoding_normal;
rinfo.decoding_plc = stats.decoding_plc;
rinfo.decoding_codec_plc = stats.decoding_codec_plc;
rinfo.decoding_cng = stats.decoding_cng;
rinfo.decoding_plc_cng = stats.decoding_plc_cng;
rinfo.decoding_muted_output = stats.decoding_muted_output;

View file

@ -670,6 +670,7 @@ class WebRtcVoiceEngineTestFake : public ::testing::Test {
stats.decoding_calls_to_neteq = 345;
stats.decoding_normal = 67890;
stats.decoding_plc = 1234;
stats.decoding_codec_plc = 1236;
stats.decoding_cng = 5678;
stats.decoding_plc_cng = 9012;
stats.decoding_muted_output = 3456;
@ -719,6 +720,7 @@ class WebRtcVoiceEngineTestFake : public ::testing::Test {
EXPECT_EQ(info.decoding_calls_to_neteq, stats.decoding_calls_to_neteq);
EXPECT_EQ(info.decoding_normal, stats.decoding_normal);
EXPECT_EQ(info.decoding_plc, stats.decoding_plc);
EXPECT_EQ(info.decoding_codec_plc, stats.decoding_codec_plc);
EXPECT_EQ(info.decoding_cng, stats.decoding_cng);
EXPECT_EQ(info.decoding_plc_cng, stats.decoding_plc_cng);
EXPECT_EQ(info.decoding_muted_output, stats.decoding_muted_output);

View file

@ -266,7 +266,7 @@ TEST_F(AudioCodingModuleTestOldApi, MAYBE_InitializedToZero) {
EXPECT_EQ(0, stats.calls_to_silence_generator);
EXPECT_EQ(0, stats.decoded_normal);
EXPECT_EQ(0, stats.decoded_cng);
EXPECT_EQ(0, stats.decoded_plc);
EXPECT_EQ(0, stats.decoded_neteq_plc);
EXPECT_EQ(0, stats.decoded_plc_cng);
EXPECT_EQ(0, stats.decoded_muted_output);
}
@ -292,7 +292,7 @@ TEST_F(AudioCodingModuleTestOldApi, MAYBE_NetEqCalls) {
EXPECT_EQ(0, stats.calls_to_silence_generator);
EXPECT_EQ(kNumNormalCalls, stats.decoded_normal);
EXPECT_EQ(0, stats.decoded_cng);
EXPECT_EQ(0, stats.decoded_plc);
EXPECT_EQ(0, stats.decoded_neteq_plc);
EXPECT_EQ(0, stats.decoded_plc_cng);
EXPECT_EQ(0, stats.decoded_muted_output);
@ -308,7 +308,7 @@ TEST_F(AudioCodingModuleTestOldApi, MAYBE_NetEqCalls) {
EXPECT_EQ(0, stats.calls_to_silence_generator);
EXPECT_EQ(kNumNormalCalls, stats.decoded_normal);
EXPECT_EQ(0, stats.decoded_cng);
EXPECT_EQ(kNumPlc, stats.decoded_plc);
EXPECT_EQ(kNumPlc, stats.decoded_neteq_plc);
EXPECT_EQ(kNumPlcCng, stats.decoded_plc_cng);
EXPECT_EQ(0, stats.decoded_muted_output);
// TODO(henrik.lundin) Add a test with muted state enabled.

View file

@ -28,7 +28,11 @@ void CallStatistics::DecodedByNetEq(AudioFrame::SpeechType speech_type,
break;
}
case AudioFrame::kPLC: {
++decoding_stat_.decoded_plc;
++decoding_stat_.decoded_neteq_plc;
break;
}
case AudioFrame::kCodecPLC: {
++decoding_stat_.decoded_codec_plc;
break;
}
case AudioFrame::kCNG: {

View file

@ -25,7 +25,7 @@ TEST(CallStatisticsTest, InitializedZero) {
EXPECT_EQ(0, stats.calls_to_silence_generator);
EXPECT_EQ(0, stats.decoded_normal);
EXPECT_EQ(0, stats.decoded_cng);
EXPECT_EQ(0, stats.decoded_plc);
EXPECT_EQ(0, stats.decoded_neteq_plc);
EXPECT_EQ(0, stats.decoded_plc_cng);
EXPECT_EQ(0, stats.decoded_muted_output);
}
@ -37,15 +37,17 @@ TEST(CallStatisticsTest, AllCalls) {
call_stats.DecodedBySilenceGenerator();
call_stats.DecodedByNetEq(AudioFrame::kNormalSpeech, false);
call_stats.DecodedByNetEq(AudioFrame::kPLC, false);
call_stats.DecodedByNetEq(AudioFrame::kCodecPLC, false);
call_stats.DecodedByNetEq(AudioFrame::kPLCCNG, true); // Let this be muted.
call_stats.DecodedByNetEq(AudioFrame::kCNG, false);
stats = call_stats.GetDecodingStatistics();
EXPECT_EQ(4, stats.calls_to_neteq);
EXPECT_EQ(5, stats.calls_to_neteq);
EXPECT_EQ(1, stats.calls_to_silence_generator);
EXPECT_EQ(1, stats.decoded_normal);
EXPECT_EQ(1, stats.decoded_cng);
EXPECT_EQ(1, stats.decoded_plc);
EXPECT_EQ(1, stats.decoded_neteq_plc);
EXPECT_EQ(1, stats.decoded_codec_plc);
EXPECT_EQ(1, stats.decoded_plc_cng);
EXPECT_EQ(1, stats.decoded_muted_output);
}

View file

@ -57,7 +57,8 @@ struct AudioDecodingCallStats {
: calls_to_silence_generator(0),
calls_to_neteq(0),
decoded_normal(0),
decoded_plc(0),
decoded_neteq_plc(0),
decoded_codec_plc(0),
decoded_cng(0),
decoded_plc_cng(0),
decoded_muted_output(0) {}
@ -66,7 +67,8 @@ struct AudioDecodingCallStats {
// and NetEq was disengaged from decoding.
int calls_to_neteq; // Number of calls to NetEq.
int decoded_normal; // Number of calls where audio RTP packet decoded.
int decoded_plc; // Number of calls resulted in PLC.
int decoded_neteq_plc; // Number of calls resulted in NetEq PLC.
int decoded_codec_plc; // Number of calls resulted in codec PLC.
int decoded_cng; // Number of calls where comfort noise generated due to DTX.
int decoded_plc_cng; // Number of calls resulted where PLC faded to CNG.
int decoded_muted_output; // Number of calls returning a muted state output.

View file

@ -203,6 +203,11 @@ void SetAudioFrameActivityAndType(bool vad_enabled,
audio_frame->vad_activity_ = AudioFrame::kVadPassive;
break;
}
case NetEqImpl::OutputType::kCodecPLC: {
audio_frame->speech_type_ = AudioFrame::kCodecPLC;
audio_frame->vad_activity_ = last_vad_activity;
break;
}
default:
RTC_NOTREACHED();
}
@ -2088,6 +2093,8 @@ NetEqImpl::OutputType NetEqImpl::LastOutputType() {
return OutputType::kPLC;
} else if (vad_->running() && !vad_->active_speech()) {
return OutputType::kVadPassive;
} else if (last_mode_ == kModeCodecPlc) {
return OutputType::kCodecPLC;
} else {
return OutputType::kNormalSpeech;
}

View file

@ -64,7 +64,14 @@ struct PreemptiveExpandFactory;
class NetEqImpl : public webrtc::NetEq {
public:
enum class OutputType { kNormalSpeech, kPLC, kCNG, kPLCCNG, kVadPassive };
enum class OutputType {
kNormalSpeech,
kPLC,
kCNG,
kPLCCNG,
kVadPassive,
kCodecPLC
};
enum ErrorCodes {
kNoError = 0,

View file

@ -176,6 +176,9 @@ void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) {
report->AddInt(StatsReport::kStatsValueNameAudioOutputLevel,
info.audio_level);
}
if (info.decoding_codec_plc)
report->AddInt(StatsReport::kStatsValueNameDecodingCodecPLC,
info.decoding_codec_plc);
report->AddInt64(StatsReport::kStatsValueNameBytesReceived, info.bytes_rcvd);
if (info.capture_start_ntp_time_ms >= 0) {

View file

@ -374,6 +374,9 @@ void VerifyVoiceReceiverInfoReport(const StatsReport* report,
EXPECT_TRUE(GetValue(report, StatsReport::kStatsValueNameDecodingPLC,
&value_in_report));
EXPECT_EQ(rtc::ToString(info.decoding_plc), value_in_report);
EXPECT_TRUE(GetValue(report, StatsReport::kStatsValueNameDecodingCodecPLC,
&value_in_report));
EXPECT_EQ(rtc::ToString(info.decoding_codec_plc), value_in_report);
EXPECT_TRUE(GetValue(report, StatsReport::kStatsValueNameDecodingCNG,
&value_in_report));
EXPECT_EQ(rtc::ToString(info.decoding_cng), value_in_report);
@ -577,6 +580,7 @@ void InitVoiceReceiverInfo(cricket::VoiceReceiverInfo* voice_receiver_info) {
voice_receiver_info->accelerate_rate = 124;
voice_receiver_info->preemptive_expand_rate = 125;
voice_receiver_info->secondary_discarded_rate = 126;
voice_receiver_info->decoding_codec_plc = 127;
}
class StatsCollectorForTest : public StatsCollector {