Set min bitrate equal to kDefaultMinVideoBitrateBps
If experimental min bitrate value is not configured, set the min bitrate for the first simulcast stream equal to kDefaultMinVideoBitrateBps (=30kbps). Min bitrate depends on resolution. At absence of the experimental min bitrate override, we got high min bitrate values for high resolutions (600kbps for VP8 720p, for example) before. That led to encode pauses [1] which is an undesired behavior. [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/modules/video_coding/utility/simulcast_rate_allocator.cc;l=173;drc=f317f7106a7a15a04da7cd30c2e2ddb1b3025bc6 Bug: webrtc:351644568, b/352504711 Change-Id: Ifc93cc230fb194d2c9a739368d415f24385939fd No-Try: true Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/357420 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42649}
This commit is contained in:
parent
4dedf5efae
commit
b27ac6bc83
@ -71,6 +71,7 @@ if (rtc_include_tests) {
|
|||||||
":streams_config",
|
":streams_config",
|
||||||
"../../call/adaptation:resource_adaptation",
|
"../../call/adaptation:resource_adaptation",
|
||||||
"../../media:media_constants",
|
"../../media:media_constants",
|
||||||
|
"../../rtc_base/experiments:min_video_bitrate_experiment",
|
||||||
"../../test:explicit_key_value_config",
|
"../../test:explicit_key_value_config",
|
||||||
"../../test:test_support",
|
"../../test:test_support",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -320,23 +320,24 @@ EncoderStreamFactory::CreateSimulcastOrConferenceModeScreenshareStreams(
|
|||||||
const absl::optional<webrtc::DataRate>& experimental_min_bitrate) const {
|
const absl::optional<webrtc::DataRate>& experimental_min_bitrate) const {
|
||||||
bool is_screencast = encoder_config.content_type ==
|
bool is_screencast = encoder_config.content_type ==
|
||||||
webrtc::VideoEncoderConfig::ContentType::kScreen;
|
webrtc::VideoEncoderConfig::ContentType::kScreen;
|
||||||
|
const bool is_legacy_screencast =
|
||||||
|
webrtc::SimulcastUtility::IsConferenceModeScreenshare(encoder_config);
|
||||||
std::vector<webrtc::VideoStream> layers;
|
std::vector<webrtc::VideoStream> layers;
|
||||||
|
|
||||||
const bool temporal_layers_supported =
|
const bool temporal_layers_supported =
|
||||||
IsTemporalLayersSupported(encoder_config.codec_type);
|
IsTemporalLayersSupported(encoder_config.codec_type);
|
||||||
// Use legacy simulcast screenshare if conference mode is explicitly enabled
|
// Use legacy simulcast screenshare if conference mode is explicitly enabled
|
||||||
// or use the regular simulcast configuration path which is generic.
|
// or use the regular simulcast configuration path which is generic.
|
||||||
layers = GetSimulcastConfig(
|
layers = GetSimulcastConfig(FindRequiredActiveLayers(encoder_config),
|
||||||
FindRequiredActiveLayers(encoder_config),
|
encoder_config.number_of_streams, width, height,
|
||||||
encoder_config.number_of_streams, width, height,
|
is_legacy_screencast, temporal_layers_supported,
|
||||||
webrtc::SimulcastUtility::IsConferenceModeScreenshare(encoder_config),
|
trials, encoder_config.codec_type);
|
||||||
temporal_layers_supported, trials, encoder_config.codec_type);
|
|
||||||
// Allow an experiment to override the minimum bitrate for the lowest
|
// Allow an experiment to override the minimum bitrate for the lowest
|
||||||
// spatial layer. The experiment's configuration has the lowest priority.
|
// spatial layer. The experiment's configuration has the lowest priority.
|
||||||
if (experimental_min_bitrate) {
|
layers[0].min_bitrate_bps = experimental_min_bitrate
|
||||||
layers[0].min_bitrate_bps =
|
.value_or(webrtc::DataRate::BitsPerSec(
|
||||||
rtc::saturated_cast<int>(experimental_min_bitrate->bps());
|
webrtc::kDefaultMinVideoBitrateBps))
|
||||||
}
|
.bps<int>();
|
||||||
|
|
||||||
const bool has_scale_resolution_down_by = absl::c_any_of(
|
const bool has_scale_resolution_down_by = absl::c_any_of(
|
||||||
encoder_config.simulcast_layers, [](const webrtc::VideoStream& layer) {
|
encoder_config.simulcast_layers, [](const webrtc::VideoStream& layer) {
|
||||||
|
|||||||
@ -11,14 +11,17 @@
|
|||||||
#include "video/config/encoder_stream_factory.h"
|
#include "video/config/encoder_stream_factory.h"
|
||||||
|
|
||||||
#include "call/adaptation/video_source_restrictions.h"
|
#include "call/adaptation/video_source_restrictions.h"
|
||||||
|
#include "rtc_base/experiments/min_video_bitrate_experiment.h"
|
||||||
#include "test/explicit_key_value_config.h"
|
#include "test/explicit_key_value_config.h"
|
||||||
|
#include "test/gmock.h"
|
||||||
#include "test/gtest.h"
|
#include "test/gtest.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using ::cricket::EncoderStreamFactory;
|
using ::cricket::EncoderStreamFactory;
|
||||||
using test::ExplicitKeyValueConfig;
|
using test::ExplicitKeyValueConfig;
|
||||||
|
using ::testing::IsEmpty;
|
||||||
|
using ::testing::Not;
|
||||||
|
|
||||||
std::vector<Resolution> GetStreamResolutions(
|
std::vector<Resolution> GetStreamResolutions(
|
||||||
const std::vector<VideoStream>& streams) {
|
const std::vector<VideoStream>& streams) {
|
||||||
@ -96,4 +99,30 @@ TEST(EncoderStreamFactory, BitratePriority) {
|
|||||||
EXPECT_EQ(streams[0].bitrate_priority, kBitratePriority);
|
EXPECT_EQ(streams[0].bitrate_priority, kBitratePriority);
|
||||||
EXPECT_FALSE(streams[1].bitrate_priority);
|
EXPECT_FALSE(streams[1].bitrate_priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(EncoderStreamFactory, SetsMinBitrateToDefaultValue) {
|
||||||
|
VideoEncoder::EncoderInfo encoder_info;
|
||||||
|
auto factory = rtc::make_ref_counted<EncoderStreamFactory>(encoder_info);
|
||||||
|
VideoEncoderConfig encoder_config;
|
||||||
|
encoder_config.number_of_streams = 2;
|
||||||
|
encoder_config.simulcast_layers.resize(encoder_config.number_of_streams);
|
||||||
|
auto streams = factory->CreateEncoderStreams(ExplicitKeyValueConfig(""), 1920,
|
||||||
|
1080, encoder_config);
|
||||||
|
ASSERT_THAT(streams, Not(IsEmpty()));
|
||||||
|
EXPECT_EQ(streams[0].min_bitrate_bps, kDefaultMinVideoBitrateBps);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(EncoderStreamFactory, SetsMinBitrateToExperimentalValue) {
|
||||||
|
VideoEncoder::EncoderInfo encoder_info;
|
||||||
|
auto factory = rtc::make_ref_counted<EncoderStreamFactory>(encoder_info);
|
||||||
|
VideoEncoderConfig encoder_config;
|
||||||
|
encoder_config.number_of_streams = 2;
|
||||||
|
encoder_config.simulcast_layers.resize(encoder_config.number_of_streams);
|
||||||
|
auto streams = factory->CreateEncoderStreams(
|
||||||
|
ExplicitKeyValueConfig("WebRTC-Video-MinVideoBitrate/Enabled,br:1kbps/"),
|
||||||
|
1920, 1080, encoder_config);
|
||||||
|
ASSERT_THAT(streams, Not(IsEmpty()));
|
||||||
|
EXPECT_NE(streams[0].min_bitrate_bps, kDefaultMinVideoBitrateBps);
|
||||||
|
EXPECT_EQ(streams[0].min_bitrate_bps, 1000);
|
||||||
|
}
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user