Offer VideoLayersAllocation if field trial enabled

Enable using the field trial WebRTC-VideoLayersAllocationAdvertised/Enabled/

Bug: webrtc:1200
Change-Id: I7c1d94c6051aace8d22c16e0f2e2256dd7ade7fd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/189960
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32465}
This commit is contained in:
Per Kjellander
2020-10-21 13:35:07 +02:00
committed by Commit Bot
parent 024d0157ab
commit 70c8945c15
4 changed files with 48 additions and 11 deletions

View File

@ -121,6 +121,7 @@ constexpr char RtpExtension::kVideoContentTypeUri[];
constexpr char RtpExtension::kVideoTimingUri[]; constexpr char RtpExtension::kVideoTimingUri[];
constexpr char RtpExtension::kGenericFrameDescriptorUri00[]; constexpr char RtpExtension::kGenericFrameDescriptorUri00[];
constexpr char RtpExtension::kDependencyDescriptorUri[]; constexpr char RtpExtension::kDependencyDescriptorUri[];
constexpr char RtpExtension::kVideoLayersAllocationUri[];
constexpr char RtpExtension::kTransportSequenceNumberUri[]; constexpr char RtpExtension::kTransportSequenceNumberUri[];
constexpr char RtpExtension::kTransportSequenceNumberV2Uri[]; constexpr char RtpExtension::kTransportSequenceNumberV2Uri[];
constexpr char RtpExtension::kPlayoutDelayUri[]; constexpr char RtpExtension::kPlayoutDelayUri[];
@ -161,7 +162,8 @@ bool RtpExtension::IsSupportedForVideo(absl::string_view uri) {
uri == webrtc::RtpExtension::kDependencyDescriptorUri || uri == webrtc::RtpExtension::kDependencyDescriptorUri ||
uri == webrtc::RtpExtension::kColorSpaceUri || uri == webrtc::RtpExtension::kColorSpaceUri ||
uri == webrtc::RtpExtension::kRidUri || uri == webrtc::RtpExtension::kRidUri ||
uri == webrtc::RtpExtension::kRepairedRidUri; uri == webrtc::RtpExtension::kRepairedRidUri ||
uri == webrtc::RtpExtension::kVideoLayersAllocationUri;
} }
bool RtpExtension::IsEncryptionSupported(absl::string_view uri) { bool RtpExtension::IsEncryptionSupported(absl::string_view uri) {
@ -183,7 +185,8 @@ bool RtpExtension::IsEncryptionSupported(absl::string_view uri) {
uri == webrtc::RtpExtension::kVideoContentTypeUri || uri == webrtc::RtpExtension::kVideoContentTypeUri ||
uri == webrtc::RtpExtension::kMidUri || uri == webrtc::RtpExtension::kMidUri ||
uri == webrtc::RtpExtension::kRidUri || uri == webrtc::RtpExtension::kRidUri ||
uri == webrtc::RtpExtension::kRepairedRidUri; uri == webrtc::RtpExtension::kRepairedRidUri ||
uri == webrtc::RtpExtension::kVideoLayersAllocationUri;
} }
const RtpExtension* RtpExtension::FindHeaderExtensionByUri( const RtpExtension* RtpExtension::FindHeaderExtensionByUri(

View File

@ -318,6 +318,10 @@ struct RTC_EXPORT RtpExtension {
"https://aomediacodec.github.io/av1-rtp-spec/" "https://aomediacodec.github.io/av1-rtp-spec/"
"#dependency-descriptor-rtp-header-extension"; "#dependency-descriptor-rtp-header-extension";
// Experimental extension for signalling target bitrate per layer.
static constexpr char kVideoLayersAllocationUri[] =
"http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00";
// Header extension for transport sequence number, see url for details: // Header extension for transport sequence number, see url for details:
// http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions // http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions
static constexpr char kTransportSequenceNumberUri[] = static constexpr char kTransportSequenceNumberUri[] =

View File

@ -638,6 +638,13 @@ WebRtcVideoEngine::GetRtpHeaderExtensions() const {
IsEnabled(trials_, "WebRTC-DependencyDescriptorAdvertised") IsEnabled(trials_, "WebRTC-DependencyDescriptorAdvertised")
? webrtc::RtpTransceiverDirection::kSendRecv ? webrtc::RtpTransceiverDirection::kSendRecv
: webrtc::RtpTransceiverDirection::kStopped); : webrtc::RtpTransceiverDirection::kStopped);
result.emplace_back(
webrtc::RtpExtension::kVideoLayersAllocationUri, id++,
IsEnabled(trials_, "WebRTC-VideoLayersAllocationAdvertised")
? webrtc::RtpTransceiverDirection::kSendRecv
: webrtc::RtpTransceiverDirection::kStopped);
return result; return result;
} }
@ -1302,15 +1309,21 @@ bool WebRtcVideoChannel::AddSendStream(const StreamParams& sp) {
video_config_.periodic_alr_bandwidth_probing; video_config_.periodic_alr_bandwidth_probing;
config.encoder_settings.experiment_cpu_load_estimator = config.encoder_settings.experiment_cpu_load_estimator =
video_config_.experiment_cpu_load_estimator; video_config_.experiment_cpu_load_estimator;
// TODO(bugs.webrtc.org/12000): Enable allocation callback type using TargetBitrateType =
// VideoLayersAllocation if RtpVideoLayersAllocationExtension has been webrtc::VideoStreamEncoderSettings::BitrateAllocationCallbackType;
// negotiated in `send_rtp_extensions_`. if (send_rtp_extensions_ &&
config.encoder_settings.allocation_cb_type = webrtc::RtpExtension::FindHeaderExtensionByUri(
IsEnabled(call_->trials(), "WebRTC-Target-Bitrate-Rtcp") *send_rtp_extensions_,
? webrtc::VideoStreamEncoderSettings::BitrateAllocationCallbackType:: webrtc::RtpExtension::kVideoLayersAllocationUri)) {
kVideoBitrateAllocation config.encoder_settings.allocation_cb_type =
: webrtc::VideoStreamEncoderSettings::BitrateAllocationCallbackType:: TargetBitrateType::kVideoLayersAllocation;
kVideoBitrateAllocationWhenScreenSharing; } else if (IsEnabled(call_->trials(), "WebRTC-Target-Bitrate-Rtcp")) {
config.encoder_settings.allocation_cb_type =
TargetBitrateType::kVideoBitrateAllocation;
} else {
config.encoder_settings.allocation_cb_type =
TargetBitrateType::kVideoBitrateAllocationWhenScreenSharing;
}
config.encoder_settings.encoder_factory = encoder_factory_; config.encoder_settings.encoder_factory = encoder_factory_;
config.encoder_settings.bitrate_allocator_factory = config.encoder_settings.bitrate_allocator_factory =
bitrate_allocator_factory_; bitrate_allocator_factory_;

View File

@ -381,6 +381,23 @@ TEST_F(WebRtcVideoEngineTestWithDependencyDescriptor,
ExpectRtpCapabilitySupport(RtpExtension::kDependencyDescriptorUri, true); ExpectRtpCapabilitySupport(RtpExtension::kDependencyDescriptorUri, true);
} }
TEST_F(WebRtcVideoEngineTest, AdvertiseVideoLayersAllocation) {
ExpectRtpCapabilitySupport(RtpExtension::kVideoLayersAllocationUri, false);
}
class WebRtcVideoEngineTestWithVideoLayersAllocation
: public WebRtcVideoEngineTest {
public:
WebRtcVideoEngineTestWithVideoLayersAllocation()
: WebRtcVideoEngineTest(
"WebRTC-VideoLayersAllocationAdvertised/Enabled/") {}
};
TEST_F(WebRtcVideoEngineTestWithVideoLayersAllocation,
AdvertiseVideoLayersAllocation) {
ExpectRtpCapabilitySupport(RtpExtension::kVideoLayersAllocationUri, true);
}
TEST_F(WebRtcVideoEngineTest, CVOSetHeaderExtensionBeforeCapturer) { TEST_F(WebRtcVideoEngineTest, CVOSetHeaderExtensionBeforeCapturer) {
// Allocate the source first to prevent early destruction before channel's // Allocate the source first to prevent early destruction before channel's
// dtor is called. // dtor is called.