Handle zero number of spatial layers at calculation of VP9 SVC padding.
Bug: chromium:923330 Change-Id: I66e3b17e5a22b7de9d9b83d5dda486ec5b4364fc Reviewed-on: https://webrtc-review.googlesource.com/c/119600 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26388}
This commit is contained in:
parent
f8e7ccb967
commit
a67a9d9256
@ -227,6 +227,9 @@ uint32_t SvcRateAllocator::GetMaxBitrateBps(const VideoCodec& codec) {
|
||||
|
||||
uint32_t SvcRateAllocator::GetPaddingBitrateBps(const VideoCodec& codec) {
|
||||
const size_t num_spatial_layers = GetNumActiveSpatialLayers(codec);
|
||||
if (num_spatial_layers == 0) {
|
||||
return 0; // All layers are deactivated.
|
||||
}
|
||||
|
||||
if (codec.mode == VideoCodecMode::kRealtimeVideo) {
|
||||
float scale_factor = 0.0;
|
||||
|
||||
@ -188,6 +188,15 @@ TEST(SvcRateAllocatorTest, DeativateLayers) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(SvcRateAllocatorTest, NoPaddingIfAllLayersAreDeactivated) {
|
||||
VideoCodec codec = Configure(1280, 720, 3, 1, false);
|
||||
EXPECT_EQ(codec.VP9()->numberOfSpatialLayers, 3U);
|
||||
// Deactivation of base layer deactivates all layers.
|
||||
codec.spatialLayers[0].active = false;
|
||||
uint32_t padding_bps = SvcRateAllocator::GetPaddingBitrateBps(codec);
|
||||
EXPECT_EQ(padding_bps, 0U);
|
||||
}
|
||||
|
||||
class SvcRateAllocatorTestParametrizedContentType
|
||||
: public testing::Test,
|
||||
public testing::WithParamInterface<bool> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user