From e94c7da1df402ab0193fe5bf010646c7eb08b629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Ivarsson=E2=80=8E?= Date: Thu, 5 Sep 2024 15:13:32 +0000 Subject: [PATCH] Revert "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 7fff587a096c6ef40f5601f47ef50b221b3a4abf. Reason for revert: breaks downstream test 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: Ia87ef3b3066e1373654e1f0d96726217e7ed4117 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361761 Reviewed-by: Mirko Bonadei Auto-Submit: Jakob Ivarsson‎ Commit-Queue: Mirko Bonadei Bot-Commit: rubber-stamper@appspot.gserviceaccount.com Cr-Commit-Position: refs/heads/main@{#42965} --- 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();