Reporting of decoding_codec_plc events

Change-Id: Id71b37244bc98bffaf25131a519127b3d2b86a8f

Bug: webrtc:10838
Change-Id: Id71b37244bc98bffaf25131a519127b3d2b86a8f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147263
Commit-Queue: Alex Narest <alexnarest@google.com>
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28700}
This commit is contained in:
Alex Narest 2019-07-29 18:07:36 +02:00 committed by Commit Bot
parent 425d6aaa4c
commit 0a88ea050c
17 changed files with 53 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

@ -237,7 +237,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

@ -2279,6 +2279,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

@ -158,6 +158,7 @@ void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) {
info.decoding_muted_output},
{StatsReport::kStatsValueNameDecodingNormal, info.decoding_normal},
{StatsReport::kStatsValueNameDecodingPLC, info.decoding_plc},
{StatsReport::kStatsValueNameDecodingCodecPLC, info.decoding_codec_plc},
{StatsReport::kStatsValueNameDecodingPLCCNG, info.decoding_plc_cng},
{StatsReport::kStatsValueNameJitterBufferMs, info.jitter_buffer_ms},
{StatsReport::kStatsValueNameJitterReceived, info.jitter_ms},

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);