Implement H264 simulcast support and generalize SimulcastEncoderAdapter use for H264 & VP8.

* Move SimulcastEncoderAdapter out under modules/video_coding
* Move SimulcastRateAllocator back out to modules/video_coding/utility
* Move TemporalLayers and ScreenshareLayers to modules/video_coding/utility
* Move any VP8 specific code - such as temporal layer bitrate budgeting -
  under codec type dependent conditionals.
* Plumb the simulcast index for H264 in the codec specific and RTP format data structures.

Bug: webrtc:5840
Change-Id: Ieced8a00e38f273c1a6cfd0f5431a87d07b8f44e
Reviewed-on: https://webrtc-review.googlesource.com/64100
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23705}
This commit is contained in:
Sergio Garcia Murillo
2018-06-21 13:29:29 +02:00
committed by Commit Bot
parent 80c4cca491
commit 07efe436c9
51 changed files with 918 additions and 530 deletions

View File

@ -318,8 +318,10 @@ static bool ValidateStreamParams(const StreamParams& sp) {
// Returns true if the given codec is disallowed from doing simulcast.
bool IsCodecBlacklistedForSimulcast(const std::string& codec_name) {
return CodecNamesEq(codec_name, kH264CodecName) ||
CodecNamesEq(codec_name, kVp9CodecName);
return webrtc::field_trial::IsEnabled("WebRTC-H264Simulcast")
? CodecNamesEq(codec_name, kVp9CodecName)
: CodecNamesEq(codec_name, kH264CodecName) ||
CodecNamesEq(codec_name, kVp9CodecName);
}
// The selected thresholds for QVGA and VGA corresponded to a QP around 10.
@ -2713,11 +2715,14 @@ std::vector<webrtc::VideoStream> EncoderStreamFactory::CreateEncoderStreams(
std::vector<webrtc::VideoStream> layers;
if (encoder_config.number_of_streams > 1 ||
(CodecNamesEq(codec_name_, kVp8CodecName) && is_screenshare_ &&
screenshare_config_explicitly_enabled_)) {
((CodecNamesEq(codec_name_, kVp8CodecName) ||
CodecNamesEq(codec_name_, kH264CodecName)) &&
is_screenshare_ && screenshare_config_explicitly_enabled_)) {
bool temporal_layers_supported = CodecNamesEq(codec_name_, kVp8CodecName);
layers = GetSimulcastConfig(encoder_config.number_of_streams, width, height,
0 /*not used*/, encoder_config.bitrate_priority,
max_qp_, max_framerate_, is_screenshare_);
max_qp_, max_framerate_, is_screenshare_,
temporal_layers_supported);
// Update the active simulcast layers and configured bitrates.
bool is_highest_layer_max_bitrate_configured = false;
for (size_t i = 0; i < layers.size(); ++i) {