Delete unused stats for preferred_bitrate.

Bug: webrtc:8830
Change-Id: Iaa30488255f2e09e269274136d370740cd030902
Reviewed-on: https://webrtc-review.googlesource.com/78880
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23529}
This commit is contained in:
Niels Möller 2018-05-25 09:43:26 +02:00 committed by Commit Bot
parent 34c9f1252a
commit 97e04884bd
19 changed files with 13 additions and 129 deletions

View File

@ -48,7 +48,6 @@ std::string VideoSendStream::Stats::ToString(int64_t time_ms) const {
ss << "encode_usage_perc: " << encode_usage_percent << ", ";
ss << "target_bps: " << target_media_bitrate_bps << ", ";
ss << "media_bps: " << media_bitrate_bps << ", ";
ss << "preferred_media_bitrate_bps: " << preferred_media_bitrate_bps << ", ";
ss << "suspended: " << (suspended ? "true" : "false") << ", ";
ss << "bw_adapted: " << (bw_limited_resolution ? "true" : "false");
ss << '}';

View File

@ -74,9 +74,6 @@ class VideoSendStream {
int target_media_bitrate_bps = 0;
// Bitrate the encoder is actually producing.
int media_bitrate_bps = 0;
// Media bitrate this VideoSendStream is configured to prefer if there are
// no bandwidth limitations.
int preferred_media_bitrate_bps = 0;
bool suspended = false;
bool bw_limited_resolution = false;
bool cpu_limited_resolution = false;

View File

@ -22,7 +22,6 @@ class VideoBitrateAllocator {
virtual VideoBitrateAllocation GetAllocation(uint32_t total_bitrate,
uint32_t framerate) = 0;
virtual uint32_t GetPreferredBitrateBps(uint32_t framerate) = 0;
};
class VideoBitrateAllocationObserver {

View File

@ -462,7 +462,6 @@ struct VideoSenderInfo : public MediaSenderInfo {
int framerate_input = 0;
int framerate_sent = 0;
int nominal_bitrate = 0;
int preferred_bitrate = 0;
int adapt_reason = 0;
int adapt_changes = 0;
int avg_encode_ms = 0;

View File

@ -2068,7 +2068,6 @@ VideoSenderInfo WebRtcVideoChannel::WebRtcVideoSendStream::GetVideoSenderInfo(
info.qp_sum = stats.qp_sum;
info.nominal_bitrate = stats.media_bitrate_bps;
info.preferred_bitrate = stats.preferred_media_bitrate_bps;
info.content_type = stats.content_type;
info.huge_frames_sent = stats.huge_frames_sent;

View File

@ -4578,18 +4578,6 @@ TEST_F(WebRtcVideoChannelTest, GetStatsReportsUpperResolution) {
EXPECT_EQ(90, info.senders[0].send_frame_height);
}
TEST_F(WebRtcVideoChannelTest, GetStatsReportsPreferredBitrate) {
FakeVideoSendStream* stream = AddSendStream();
webrtc::VideoSendStream::Stats stats;
stats.preferred_media_bitrate_bps = 5;
stream->SetStats(stats);
cricket::VideoMediaInfo info;
ASSERT_TRUE(channel_->GetStats(&info));
ASSERT_EQ(1u, info.senders.size());
EXPECT_EQ(5, info.senders[0].preferred_bitrate);
}
TEST_F(WebRtcVideoChannelTest, GetStatsReportsCpuAdaptationStats) {
FakeVideoSendStream* stream = AddSendStream();
webrtc::VideoSendStream::Stats stats;

View File

@ -228,10 +228,6 @@ SimulcastRateAllocator::ScreenshareTemporalLayerAllocation(
return allocation;
}
uint32_t SimulcastRateAllocator::GetPreferredBitrateBps(uint32_t framerate) {
return GetAllocation(codec_.maxBitrate * 1000, framerate).get_sum_bps();
}
const VideoCodec& webrtc::SimulcastRateAllocator::GetCodec() const {
return codec_;
}

View File

@ -31,7 +31,6 @@ class SimulcastRateAllocator : public VideoBitrateAllocator {
VideoBitrateAllocation GetAllocation(uint32_t total_bitrate_bps,
uint32_t framerate) override;
uint32_t GetPreferredBitrateBps(uint32_t framerate) override;
const VideoCodec& GetCodec() const;
private:

View File

@ -158,10 +158,6 @@ VideoBitrateAllocation SvcRateAllocator::GetAllocationScreenSharing(
return bitrate_allocation;
}
uint32_t SvcRateAllocator::GetPreferredBitrateBps(uint32_t framerate) {
return GetAllocation(codec_.maxBitrate * 1000, framerate).get_sum_bps();
}
std::vector<size_t> SvcRateAllocator::SplitBitrate(
size_t num_layers,
size_t total_bitrate,

View File

@ -29,7 +29,6 @@ class SvcRateAllocator : public VideoBitrateAllocator {
VideoBitrateAllocation GetAllocation(uint32_t total_bitrate_bps,
uint32_t framerate_fps) override;
uint32_t GetPreferredBitrateBps(uint32_t framerate_fps) override;
private:
VideoBitrateAllocation GetAllocationNormalVideo(

View File

@ -38,9 +38,4 @@ VideoBitrateAllocation DefaultVideoBitrateAllocator::GetAllocation(
return allocation;
}
uint32_t DefaultVideoBitrateAllocator::GetPreferredBitrateBps(
uint32_t framerate) {
return GetAllocation(codec_.maxBitrate * 1000, framerate).get_sum_bps();
}
} // namespace webrtc

View File

@ -23,7 +23,6 @@ class DefaultVideoBitrateAllocator : public VideoBitrateAllocator {
VideoBitrateAllocation GetAllocation(uint32_t total_bitrate,
uint32_t framerate) override;
uint32_t GetPreferredBitrateBps(uint32_t framerate) override;
private:
const VideoCodec codec_;

View File

@ -464,42 +464,6 @@ TEST_F(SimulcastRateAllocatorTest, ThreeStreamsMiddleInactive) {
}
}
TEST_F(SimulcastRateAllocatorTest, GetPreferredBitrateBps) {
MockTemporalLayers mock_layers;
allocator_.reset(new SimulcastRateAllocator(codec_));
EXPECT_CALL(mock_layers, OnRatesUpdated(_, _)).Times(0);
EXPECT_EQ(codec_.maxBitrate * 1000,
allocator_->GetPreferredBitrateBps(codec_.maxFramerate));
}
TEST_F(SimulcastRateAllocatorTest, GetPreferredBitrateSimulcast) {
codec_.numberOfSimulcastStreams = 3;
codec_.maxBitrate = 999999;
codec_.simulcastStream[0].minBitrate = 10;
codec_.simulcastStream[0].targetBitrate = 100;
codec_.simulcastStream[0].active = true;
codec_.simulcastStream[0].maxBitrate = 500;
codec_.simulcastStream[1].minBitrate = 50;
codec_.simulcastStream[1].targetBitrate = 500;
codec_.simulcastStream[1].maxBitrate = 1000;
codec_.simulcastStream[1].active = true;
codec_.simulcastStream[2].minBitrate = 2000;
codec_.simulcastStream[2].targetBitrate = 3000;
codec_.simulcastStream[2].maxBitrate = 4000;
codec_.simulcastStream[2].active = true;
CreateAllocator();
uint32_t preferred_bitrate_kbps;
preferred_bitrate_kbps = codec_.simulcastStream[0].targetBitrate;
preferred_bitrate_kbps += codec_.simulcastStream[1].targetBitrate;
preferred_bitrate_kbps += codec_.simulcastStream[2].maxBitrate;
EXPECT_EQ(preferred_bitrate_kbps * 1000,
allocator_->GetPreferredBitrateBps(codec_.maxFramerate));
}
class ScreenshareRateAllocationTest : public SimulcastRateAllocatorTest {
public:
void SetupConferenceScreenshare(bool use_simulcast, bool active = true) {

View File

@ -158,9 +158,6 @@ TEST_F(StatsEndToEndTest, GetStats) {
stats.encoder_implementation_name ==
test::FakeEncoder::kImplementationName;
send_stats_filled_["EncoderPreferredBitrate"] |=
stats.preferred_media_bitrate_bps > 0;
for (std::map<uint32_t, VideoSendStream::StreamStats>::const_iterator it =
stats.substreams.begin();
it != stats.substreams.end(); ++it) {

View File

@ -626,10 +626,8 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms(
void SendStatisticsProxy::OnEncoderReconfigured(
const VideoEncoderConfig& config,
const std::vector<VideoStream>& streams,
uint32_t preferred_bitrate_bps) {
const std::vector<VideoStream>& streams) {
rtc::CritScope lock(&crit_);
stats_.preferred_media_bitrate_bps = preferred_bitrate_bps;
if (content_type_ != config.content_type) {
uma_container_->UpdateHistograms(rtp_config_, stats_);

View File

@ -80,10 +80,9 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver,
void OnInactiveSsrc(uint32_t ssrc);
// Used to indicate change in content type, which may require a change in
// how stats are collected and set the configured preferred media bitrate.
// how stats are collected.
void OnEncoderReconfigured(const VideoEncoderConfig& encoder_config,
const std::vector<VideoStream>& streams,
uint32_t preferred_bitrate_bps);
const std::vector<VideoStream>& streams);
// Used to update the encoder target rate.
void OnSetEncoderTargetRate(uint32_t bitrate_bps);

View File

@ -28,7 +28,6 @@ const uint32_t kFirstRtxSsrc = 18;
const uint32_t kSecondRtxSsrc = 43;
const uint32_t kFlexFecSsrc = 55;
const int kFpsPeriodicIntervalMs = 2000;
const int kPreferredBps = 50000;
const int kWidth = 640;
const int kHeight = 480;
const int kQpIdx0 = 21;
@ -106,8 +105,6 @@ class SendStatisticsProxyTest : public ::testing::Test {
EXPECT_EQ(one.input_frame_rate, other.input_frame_rate);
EXPECT_EQ(one.encode_frame_rate, other.encode_frame_rate);
EXPECT_EQ(one.media_bitrate_bps, other.media_bitrate_bps);
EXPECT_EQ(one.preferred_media_bitrate_bps,
other.preferred_media_bitrate_bps);
EXPECT_EQ(one.suspended, other.suspended);
EXPECT_EQ(one.substreams.size(), other.substreams.size());
@ -321,16 +318,6 @@ TEST_F(SendStatisticsProxyTest, OnEncodedFrameTimeMeasured) {
EXPECT_EQ(metrics.encode_usage_percent, stats.encode_usage_percent);
}
TEST_F(SendStatisticsProxyTest, OnEncoderReconfiguredChangePreferredBitrate) {
VideoSendStream::Stats stats = statistics_proxy_->GetStats();
EXPECT_EQ(0, stats.preferred_media_bitrate_bps);
VideoEncoderConfig config;
statistics_proxy_->OnEncoderReconfigured(config, {}, kPreferredBps);
stats = statistics_proxy_->GetStats();
EXPECT_EQ(kPreferredBps, stats.preferred_media_bitrate_bps);
}
TEST_F(SendStatisticsProxyTest, OnSendEncodedImageIncreasesFramesEncoded) {
EncodedImage encoded_image;
CodecSpecificInfo codec_info;
@ -849,7 +836,7 @@ TEST_F(SendStatisticsProxyTest, AdaptChangesReportedAfterContentSwitch) {
// Switch content type, real-time stats should be updated.
VideoEncoderConfig config;
config.content_type = VideoEncoderConfig::ContentType::kScreen;
statistics_proxy_->OnEncoderReconfigured(config, {}, kPreferredBps);
statistics_proxy_->OnEncoderReconfigured(config, {});
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.AdaptChangesPerMinute.Cpu"));
EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.AdaptChangesPerMinute.Cpu", 8));
EXPECT_EQ(0,
@ -882,12 +869,12 @@ TEST_F(SendStatisticsProxyTest, SwitchContentTypeUpdatesHistograms) {
// No switch, stats should not be updated.
VideoEncoderConfig config;
config.content_type = VideoEncoderConfig::ContentType::kRealtimeVideo;
statistics_proxy_->OnEncoderReconfigured(config, {}, kPreferredBps);
statistics_proxy_->OnEncoderReconfigured(config, {});
EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.InputWidthInPixels"));
// Switch to screenshare, real-time stats should be updated.
config.content_type = VideoEncoderConfig::ContentType::kScreen;
statistics_proxy_->OnEncoderReconfigured(config, {}, kPreferredBps);
statistics_proxy_->OnEncoderReconfigured(config, {});
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InputWidthInPixels"));
}
@ -1282,7 +1269,7 @@ TEST_F(SendStatisticsProxyTest,
VideoStream stream1;
stream1.width = kWidth;
stream1.height = kHeight;
statistics_proxy_->OnEncoderReconfigured(config, {stream1}, kPreferredBps);
statistics_proxy_->OnEncoderReconfigured(config, {stream1});
const int64_t kMaxEncodedFrameWindowMs = 800;
const int kFps = 20;
@ -1319,8 +1306,7 @@ TEST_F(SendStatisticsProxyTest,
VideoStream stream2;
stream2.width = kWidth;
stream2.height = kHeight;
statistics_proxy_->OnEncoderReconfigured(config, {stream1, stream2},
kPreferredBps);
statistics_proxy_->OnEncoderReconfigured(config, {stream1, stream2});
const int64_t kMaxEncodedFrameWindowMs = 800;
const int kFps = 20;
@ -1363,8 +1349,7 @@ TEST_F(SendStatisticsProxyTest,
VideoStream stream2;
stream2.width = kWidth;
stream2.height = kHeight;
statistics_proxy_->OnEncoderReconfigured(config, {stream1, stream2},
kPreferredBps);
statistics_proxy_->OnEncoderReconfigured(config, {stream1, stream2});
const int64_t kMaxEncodedFrameWindowMs = 800;
const int kFps = 20;
@ -1471,8 +1456,7 @@ TEST_F(SendStatisticsProxyTest, GetStatsReportsBandwidthLimitedResolution) {
VideoStream stream2;
stream2.width = kWidth;
stream2.height = kHeight;
statistics_proxy_->OnEncoderReconfigured(config, {stream1, stream2},
kPreferredBps);
statistics_proxy_->OnEncoderReconfigured(config, {stream1, stream2});
const int64_t kMaxEncodedFrameWindowMs = 800;
const int kFps = 20;
@ -1675,7 +1659,7 @@ TEST_F(SendStatisticsProxyTest, ResetsRtcpCountersOnContentChange) {
// Changing content type causes histograms to be reported.
VideoEncoderConfig config;
config.content_type = VideoEncoderConfig::ContentType::kScreen;
statistics_proxy_->OnEncoderReconfigured(config, {}, kPreferredBps);
statistics_proxy_->OnEncoderReconfigured(config, {});
EXPECT_EQ(1,
metrics::NumSamples("WebRTC.Video.NackPacketsReceivedPerMinute"));
@ -1839,7 +1823,7 @@ TEST_F(SendStatisticsProxyTest, ResetsRtpCountersOnContentChange) {
// Changing content type causes histograms to be reported.
VideoEncoderConfig config;
config.content_type = VideoEncoderConfig::ContentType::kScreen;
statistics_proxy_->OnEncoderReconfigured(config, {}, kPreferredBps);
statistics_proxy_->OnEncoderReconfigured(config, {});
// Interval: 3500 bytes * 4 / 2 sec = 7000 bytes / sec = 56 kbps
EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.BitrateSentInKbps"));

View File

@ -585,16 +585,8 @@ void VideoStreamEncoder::ReconfigureEncoder() {
video_sender_.UpdateChannelParameters(rate_allocator_.get(),
bitrate_observer_);
// Get the current actual framerate, as measured by the stats proxy. This is
// used to get the correct bitrate layer allocation.
int current_framerate = stats_proxy_->GetSendFrameRate();
if (current_framerate == 0)
current_framerate = codec.maxFramerate;
stats_proxy_->OnEncoderReconfigured(
encoder_config_, streams,
rate_allocator_.get()
? rate_allocator_->GetPreferredBitrateBps(current_framerate)
: codec.maxBitrate);
encoder_config_, streams);
pending_encoder_reconfiguration_ = false;

View File

@ -1406,21 +1406,6 @@ TEST_F(VideoStreamEncoderTest,
video_stream_encoder_->Stop();
}
TEST_F(VideoStreamEncoderTest, StatsTracksPreferredBitrate) {
video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
const int kWidth = 1280;
const int kHeight = 720;
video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
WaitForEncodedFrame(1);
VideoSendStream::Stats stats = stats_proxy_->GetStats();
EXPECT_EQ(video_encoder_config_.max_bitrate_bps,
stats.preferred_media_bitrate_bps);
video_stream_encoder_->Stop();
}
TEST_F(VideoStreamEncoderTest,
ScalingUpAndDownDoesNothingWithMaintainResolution) {
const int kWidth = 1280;