getstats: fix inbound-rtp audio level range

converting to the [0..1] range as done in other
places.

BUG=chromium:1142626

Change-Id: I190b23f54a29505b526a4fdfb733b841b823ff29
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190441
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32502}
This commit is contained in:
Philipp Hancke
2020-10-27 09:50:36 +01:00
committed by Commit Bot
parent 9cd199dfe1
commit aa83cc7fda
2 changed files with 8 additions and 5 deletions

View File

@ -305,7 +305,10 @@ void SetInboundRTPStreamStatsFromVoiceReceiverInfo(
voice_receiver_info.inserted_samples_for_deceleration;
inbound_audio->removed_samples_for_acceleration =
voice_receiver_info.removed_samples_for_acceleration;
inbound_audio->audio_level = voice_receiver_info.audio_level;
if (voice_receiver_info.audio_level >= 0) {
inbound_audio->audio_level =
DoubleAudioLevelFromIntAudioLevel(voice_receiver_info.audio_level);
}
inbound_audio->total_audio_energy = voice_receiver_info.total_output_energy;
inbound_audio->total_samples_duration =
voice_receiver_info.total_output_duration;

View File

@ -1551,7 +1551,7 @@ TEST_F(RTCStatsCollectorTest,
cricket::VoiceReceiverInfo voice_receiver_info;
voice_receiver_info.local_stats.push_back(cricket::SsrcReceiverInfo());
voice_receiver_info.local_stats[0].ssrc = 3;
voice_receiver_info.audio_level = 16383;
voice_receiver_info.audio_level = 16383; // [0,32767]
voice_receiver_info.total_output_energy = 0.125;
voice_receiver_info.total_samples_received = 4567;
voice_receiver_info.total_output_duration = 0.25;
@ -1596,7 +1596,7 @@ TEST_F(RTCStatsCollectorTest,
expected_remote_audio_track.remote_source = true;
expected_remote_audio_track.ended = false;
expected_remote_audio_track.detached = false;
expected_remote_audio_track.audio_level = 16383.0 / 32767.0;
expected_remote_audio_track.audio_level = 16383.0 / 32767.0; // [0,1]
expected_remote_audio_track.total_audio_energy = 0.125;
expected_remote_audio_track.total_samples_received = 4567;
expected_remote_audio_track.total_samples_duration = 0.25;
@ -1791,7 +1791,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) {
voice_media_info.receivers[0].concealment_events = 6;
voice_media_info.receivers[0].inserted_samples_for_deceleration = 7;
voice_media_info.receivers[0].removed_samples_for_acceleration = 8;
voice_media_info.receivers[0].audio_level = 9.0;
voice_media_info.receivers[0].audio_level = 14442; // [0,32767]
voice_media_info.receivers[0].total_output_energy = 10.0;
voice_media_info.receivers[0].total_output_duration = 11.0;
@ -1841,7 +1841,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) {
expected_audio.concealment_events = 6;
expected_audio.inserted_samples_for_deceleration = 7;
expected_audio.removed_samples_for_acceleration = 8;
expected_audio.audio_level = 9.0;
expected_audio.audio_level = 14442.0 / 32767.0; // [0,1]
expected_audio.total_audio_energy = 10.0;
expected_audio.total_samples_duration = 11.0;