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}
This commit is contained in:
Sebastian Jansson 2018-10-25 16:22:02 +02:00 committed by Commit Bot
parent 57ba7e1276
commit 359d60a594
10 changed files with 28 additions and 0 deletions

View File

@ -367,6 +367,7 @@ webrtc::AudioSendStream::Stats AudioSendStream::GetStats(
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;

View File

@ -278,6 +278,7 @@ struct ConfigHelper {
.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 =

View File

@ -572,6 +572,11 @@ void ChannelSend::SetBitRate(int bitrate_bps, int64_t probing_interval_ms) {
}
});
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) {

View File

@ -139,6 +139,7 @@ class ChannelSend
// 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 @@ class ChannelSend
FrameEncryptorInterface* frame_encryptor_ = nullptr;
// E2EE Frame Encryption Options
webrtc::CryptoOptions crypto_options_;
int configured_bitrate_bps_ = 0;
};
} // namespace voe

View File

@ -147,6 +147,10 @@ void ChannelSendProxy::SetBitrate(int bitrate_bps,
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);

View File

@ -70,6 +70,7 @@ class ChannelSendProxy {
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);

View File

@ -99,6 +99,7 @@ class MockChannelSendProxy : public voe::ChannelSendProxy {
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));

View File

@ -58,6 +58,8 @@ class AudioSendStream {
ANAStats ana_statistics;
AudioProcessingStats apm_statistics;
int64_t target_bitrate_bps = 0;
};
struct Config {

View File

@ -149,6 +149,16 @@ void SendAudioStream::Start() {
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,

View File

@ -29,6 +29,7 @@ class SendAudioStream {
RTC_DISALLOW_COPY_AND_ASSIGN(SendAudioStream);
~SendAudioStream();
void Start();
ColumnPrinter StatsPrinter();
private:
friend class Scenario;