Count disabled due to low bw streams or layers as bw limited quality in GetStats

Bug: webrtc:11015
Change-Id: I65cd890706f765366d89ded8c21fa7507797fc23
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155964
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29421}
This commit is contained in:
Ilya Nikolaevskiy
2019-10-09 18:06:58 +02:00
committed by Commit Bot
parent 955f8fd047
commit 5963c7cf0a
9 changed files with 198 additions and 26 deletions

View File

@ -211,7 +211,8 @@ VideoBitrateAllocation SvcRateAllocator::Allocate(
}
const size_t first_active_layer = GetFirstActiveLayer(codec_);
size_t num_spatial_layers = GetNumActiveSpatialLayers(codec_);
const size_t num_active_layers = GetNumActiveSpatialLayers(codec_);
size_t num_spatial_layers = num_active_layers;
if (num_spatial_layers == 0) {
return VideoBitrateAllocation(); // All layers are deactivated.
@ -244,13 +245,16 @@ VideoBitrateAllocation SvcRateAllocator::Allocate(
}
last_active_layer_count_ = num_spatial_layers;
VideoBitrateAllocation allocation;
if (codec_.mode == VideoCodecMode::kRealtimeVideo) {
return GetAllocationNormalVideo(total_bitrate, first_active_layer,
num_spatial_layers);
allocation = GetAllocationNormalVideo(total_bitrate, first_active_layer,
num_spatial_layers);
} else {
return GetAllocationScreenSharing(total_bitrate, first_active_layer,
num_spatial_layers);
allocation = GetAllocationScreenSharing(total_bitrate, first_active_layer,
num_spatial_layers);
}
allocation.set_bw_limited(num_spatial_layers < num_active_layers);
return allocation;
}
VideoBitrateAllocation SvcRateAllocator::GetAllocationNormalVideo(

View File

@ -224,6 +224,24 @@ TEST(SvcRateAllocatorTest, DeactivateLowerLayers) {
}
}
TEST(SvcRateAllocatorTest, SignalsBwLimited) {
VideoCodec codec = Configure(1280, 720, 3, 1, false);
SvcRateAllocator allocator = SvcRateAllocator(codec);
// Rough estimate calculated by hand.
uint32_t min_to_enable_all = 900000;
EXPECT_TRUE(
allocator
.Allocate(VideoBitrateAllocationParameters(min_to_enable_all / 2, 30))
.is_bw_limited());
EXPECT_FALSE(
allocator
.Allocate(VideoBitrateAllocationParameters(min_to_enable_all, 30))
.is_bw_limited());
}
TEST(SvcRateAllocatorTest, NoPaddingIfAllLayersAreDeactivated) {
VideoCodec codec = Configure(1280, 720, 3, 1, false);
EXPECT_EQ(codec.VP9()->numberOfSpatialLayers, 3U);