Adds target rate to audio send stream stats.
Bug: webrtc:9510
Change-Id: I8bd74fc115e3006f477b289edc58fa1f9d7b6bc6
Reviewed-on: https://webrtc-review.googlesource.com/c/107652
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25370}
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index c8af43e..3c9daff 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -367,6 +367,7 @@
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
webrtc::AudioSendStream::Stats stats;
stats.local_ssrc = config_.rtp.ssrc;
+ stats.target_bitrate_bps = channel_proxy_->GetBitrate();
webrtc::CallSendStatistics call_stats = channel_proxy_->GetRTCPStatistics();
stats.bytes_sent = call_stats.bytesSent;
diff --git a/audio/audio_send_stream_unittest.cc b/audio/audio_send_stream_unittest.cc
index 30d2c54..c5e4060 100644
--- a/audio/audio_send_stream_unittest.cc
+++ b/audio/audio_send_stream_unittest.cc
@@ -278,6 +278,7 @@
.WillRepeatedly(Return(report_blocks));
EXPECT_CALL(*channel_proxy_, GetANAStatistics())
.WillRepeatedly(Return(ANAStats()));
+ EXPECT_CALL(*channel_proxy_, GetBitrate()).WillRepeatedly(Return(0));
audio_processing_stats_.echo_return_loss = kEchoReturnLoss;
audio_processing_stats_.echo_return_loss_enhancement =
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index bdabe8f..83350c4 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -572,6 +572,11 @@
}
});
retransmission_rate_limiter_->SetMaxRate(bitrate_bps);
+ configured_bitrate_bps_ = bitrate_bps;
+}
+
+int ChannelSend::GetBitRate() const {
+ return configured_bitrate_bps_;
}
void ChannelSend::OnTwccBasedUplinkPacketLossRate(float packet_loss_rate) {
diff --git a/audio/channel_send.h b/audio/channel_send.h
index 306d6a8..7c3f1cd 100644
--- a/audio/channel_send.h
+++ b/audio/channel_send.h
@@ -139,6 +139,7 @@
// Codecs
void SetBitRate(int bitrate_bps, int64_t probing_interval_ms);
+ int GetBitRate() const;
bool EnableAudioNetworkAdaptor(const std::string& config_string);
void DisableAudioNetworkAdaptor();
@@ -302,6 +303,7 @@
FrameEncryptorInterface* frame_encryptor_ = nullptr;
// E2EE Frame Encryption Options
webrtc::CryptoOptions crypto_options_;
+ int configured_bitrate_bps_ = 0;
};
} // namespace voe
diff --git a/audio/channel_send_proxy.cc b/audio/channel_send_proxy.cc
index 661e1e4..097ee9e 100644
--- a/audio/channel_send_proxy.cc
+++ b/audio/channel_send_proxy.cc
@@ -147,6 +147,10 @@
channel_->SetBitRate(bitrate_bps, probing_interval_ms);
}
+int ChannelSendProxy::GetBitrate() const {
+ return channel_->GetBitRate();
+}
+
void ChannelSendProxy::SetInputMute(bool muted) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
channel_->SetInputMute(muted);
diff --git a/audio/channel_send_proxy.h b/audio/channel_send_proxy.h
index 1b8b4a0..55cf3e2 100644
--- a/audio/channel_send_proxy.h
+++ b/audio/channel_send_proxy.h
@@ -70,6 +70,7 @@
int payload_frequency);
virtual bool SendTelephoneEventOutband(int event, int duration_ms);
virtual void SetBitrate(int bitrate_bps, int64_t probing_interval_ms);
+ virtual int GetBitrate() const;
virtual void SetInputMute(bool muted);
virtual void ProcessAndEncodeAudio(std::unique_ptr<AudioFrame> audio_frame);
diff --git a/audio/mock_voe_channel_proxy.h b/audio/mock_voe_channel_proxy.h
index 910858f..50b202e 100644
--- a/audio/mock_voe_channel_proxy.h
+++ b/audio/mock_voe_channel_proxy.h
@@ -99,6 +99,7 @@
void(std::unique_ptr<AudioFrame>* audio_frame));
MOCK_METHOD1(SetTransportOverhead, void(int transport_overhead_per_packet));
MOCK_CONST_METHOD0(GetRtpRtcp, RtpRtcp*());
+ MOCK_CONST_METHOD0(GetBitrate, int());
MOCK_METHOD1(OnTwccBasedUplinkPacketLossRate, void(float packet_loss_rate));
MOCK_METHOD1(OnRecoverableUplinkPacketLossRate,
void(float recoverable_packet_loss_rate));
diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h
index 61d2f5c..fb431e0 100644
--- a/call/audio_send_stream.h
+++ b/call/audio_send_stream.h
@@ -58,6 +58,8 @@
ANAStats ana_statistics;
AudioProcessingStats apm_statistics;
+
+ int64_t target_bitrate_bps = 0;
};
struct Config {
diff --git a/test/scenario/audio_stream.cc b/test/scenario/audio_stream.cc
index 8871728..132998b 100644
--- a/test/scenario/audio_stream.cc
+++ b/test/scenario/audio_stream.cc
@@ -149,6 +149,16 @@
send_stream_->Start();
}
+ColumnPrinter SendAudioStream::StatsPrinter() {
+ return ColumnPrinter::Lambda(
+ "audio_target_rate",
+ [this](rtc::SimpleStringBuilder& sb) {
+ AudioSendStream::Stats stats = send_stream_->GetStats();
+ sb.AppendFormat("%.0lf", stats.target_bitrate_bps / 8.0);
+ },
+ 64);
+}
+
ReceiveAudioStream::ReceiveAudioStream(
CallClient* receiver,
AudioStreamConfig config,
diff --git a/test/scenario/audio_stream.h b/test/scenario/audio_stream.h
index 06a91db..601a375 100644
--- a/test/scenario/audio_stream.h
+++ b/test/scenario/audio_stream.h
@@ -29,6 +29,7 @@
RTC_DISALLOW_COPY_AND_ASSIGN(SendAudioStream);
~SendAudioStream();
void Start();
+ ColumnPrinter StatsPrinter();
private:
friend class Scenario;