From 64e8e64e80b590bd7e90bd1bbcbfd628df9cb1c5 Mon Sep 17 00:00:00 2001 From: Tomas Lundqvist Date: Thu, 19 Sep 2024 13:53:17 +0000 Subject: [PATCH] Revert "Reland "Return audio stats regarless if we have a codec."" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4334cdfc5c0619a5f06125ea1f039cb123ccf21e. Reason for revert: Breaks downstream project. Original change's description: > Reland "Return audio stats regarless if we have a codec." > > This is a reland of commit 7fff587a096c6ef40f5601f47ef50b221b3a4abf > > Original change's description: > > Return audio stats regarless if we have a codec. > > > > Bug: b/331602608 > > Change-Id: I2d12a3ed83645fe1e7cbd8950fd86d5ba2d7c94d > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361743 > > Reviewed-by: Henrik Lundin > > Commit-Queue: Jakob Ivarsson‎ > > Cr-Commit-Position: refs/heads/main@{#42964} > > Bug: b/331602608 > Change-Id: I95c89e7059005bc8dd8569ef41bfe9e863b4082f > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361762 > Commit-Queue: Jakob Ivarsson‎ > Reviewed-by: Henrik Lundin > Cr-Commit-Position: refs/heads/main@{#42969} Bug: b/331602608 Change-Id: Ifbe332a8749d024f603b75b6e787551dd6762dd6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363001 Bot-Commit: rubber-stamper@appspot.gserviceaccount.com Reviewed-by: Alessio Bazzica Commit-Queue: Alessio Bazzica Cr-Commit-Position: refs/heads/main@{#43059} --- audio/audio_receive_stream.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc index 269c85103b..bf2da5dd18 100644 --- a/audio/audio_receive_stream.cc +++ b/audio/audio_receive_stream.cc @@ -257,15 +257,13 @@ webrtc::AudioReceiveStreamInterface::Stats AudioReceiveStreamImpl::GetStats( webrtc::CallReceiveStatistics call_stats = channel_receive_->GetRTCPStatistics(); + // TODO(solenberg): Don't return here if we can't get the codec - return the + // stats we *can* get. auto receive_codec = channel_receive_->GetReceiveCodec(); - if (receive_codec) { - stats.codec_name = receive_codec->second.name; - stats.codec_payload_type = receive_codec->first; - int clockrate_khz = receive_codec->second.clockrate_hz / 1000; - if (clockrate_khz > 0) { - stats.jitter_ms = call_stats.jitterSamples / clockrate_khz; - } + if (!receive_codec) { + return stats; } + stats.payload_bytes_received = call_stats.payload_bytes_received; stats.header_and_padding_bytes_received = call_stats.header_and_padding_bytes_received; @@ -274,6 +272,12 @@ webrtc::AudioReceiveStreamInterface::Stats AudioReceiveStreamImpl::GetStats( stats.nacks_sent = call_stats.nacks_sent; stats.capture_start_ntp_time_ms = call_stats.capture_start_ntp_time_ms_; stats.last_packet_received = call_stats.last_packet_received; + stats.codec_name = receive_codec->second.name; + stats.codec_payload_type = receive_codec->first; + int clockrate_khz = receive_codec->second.clockrate_hz / 1000; + if (clockrate_khz > 0) { + stats.jitter_ms = call_stats.jitterSamples / clockrate_khz; + } stats.delay_estimate_ms = channel_receive_->GetDelayEstimate(); stats.audio_level = channel_receive_->GetSpeechOutputLevelFullRange(); stats.total_output_energy = channel_receive_->GetTotalOutputEnergy();