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

This reverts commit 07efe436c9002e139845f62486e3ee4e29f0d85b.

Reason for revert: Breaks downstream project.

cricket::GetSimulcastConfig method signature has been updated.
I think you can get away with a default value for temporal_layers_supported (and then you can remove it after a few days when projects will be updated).


Original change's description:
> 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}

TBR=sprang@webrtc.org,stefan@webrtc.org,mflodman@webrtc.org,hta@webrtc.org,sergio.garcia.murillo@gmail.com,titovartem@webrtc.org,agouaillard@gmail.com

Change-Id: Ic9d3b1eeaf195bb5ec2063954421f5e77866d663
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:5840
Reviewed-on: https://webrtc-review.googlesource.com/84760
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23710}
This commit is contained in:
Mirko Bonadei
2018-06-21 13:41:01 +00:00
committed by Commit Bot
parent f341f3feb5
commit 6f440ed5b5
51 changed files with 530 additions and 918 deletions

View File

@ -15,7 +15,7 @@
#include "media/base/streamparams.h"
#include "media/engine/constants.h"
#include "media/engine/simulcast.h"
#include "modules/video_coding/utility/simulcast_rate_allocator.h"
#include "modules/video_coding/codecs/vp8/include/vp8_common_types.h"
#include "rtc_base/arraysize.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/field_trial.h"
@ -52,17 +52,11 @@ struct SimulcastFormat {
// These tables describe from which resolution we can use how many
// simulcast layers at what bitrates (maximum, target, and minimum).
// Important!! Keep this table from high resolution to low resolution.
// clang-format off
const SimulcastFormat kSimulcastFormats[] = {
{1920, 1080, 3, 5000, 4000, 800},
{1280, 720, 3, 2500, 2500, 600},
{960, 540, 3, 900, 900, 450},
{640, 360, 2, 700, 500, 150},
{480, 270, 2, 450, 350, 150},
{320, 180, 1, 200, 150, 30},
{0, 0, 1, 200, 150, 30}
};
// clang-format on
{1920, 1080, 3, 5000, 4000, 800}, {1280, 720, 3, 2500, 2500, 600},
{960, 540, 3, 900, 900, 450}, {640, 360, 2, 700, 500, 150},
{480, 270, 2, 450, 350, 150}, {320, 180, 1, 200, 150, 30},
{0, 0, 1, 200, 150, 30}};
const int kMaxScreenshareSimulcastLayers = 2;
@ -179,25 +173,21 @@ int GetTotalMaxBitrateBps(const std::vector<webrtc::VideoStream>& layers) {
return total_max_bitrate_bps;
}
std::vector<webrtc::VideoStream> GetSimulcastConfig(
size_t max_layers,
int width,
int height,
int /*max_bitrate_bps*/,
double bitrate_priority,
int max_qp,
int max_framerate,
bool is_screenshare,
bool temporal_layers_supported) {
std::vector<webrtc::VideoStream> GetSimulcastConfig(size_t max_layers,
int width,
int height,
int /*max_bitrate_bps*/,
double bitrate_priority,
int max_qp,
int max_framerate,
bool is_screenshare) {
if (is_screenshare) {
return GetScreenshareLayers(max_layers, width, height, bitrate_priority,
max_qp, max_framerate,
ScreenshareSimulcastFieldTrialEnabled(),
temporal_layers_supported);
ScreenshareSimulcastFieldTrialEnabled());
} else {
return GetNormalSimulcastLayers(max_layers, width, height, bitrate_priority,
max_qp, max_framerate,
temporal_layers_supported);
max_qp, max_framerate);
}
}
@ -207,8 +197,7 @@ std::vector<webrtc::VideoStream> GetNormalSimulcastLayers(
int height,
double bitrate_priority,
int max_qp,
int max_framerate,
bool temporal_layers_supported) {
int max_framerate) {
// TODO(bugs.webrtc.org/8785): Currently if the resolution isn't large enough
// (defined in kSimulcastFormats) we scale down the number of simulcast
// layers. Consider changing this so that the application can have more
@ -237,9 +226,7 @@ std::vector<webrtc::VideoStream> GetNormalSimulcastLayers(
layers[s].height = height;
// TODO(pbos): Fill actual temporal-layer bitrate thresholds.
layers[s].max_qp = max_qp;
layers[s].num_temporal_layers =
temporal_layers_supported ? DefaultNumberOfTemporalLayers(s)
: 0;
layers[s].num_temporal_layers = DefaultNumberOfTemporalLayers(s);
layers[s].max_bitrate_bps = FindSimulcastMaxBitrateBps(width, height);
layers[s].target_bitrate_bps = FindSimulcastTargetBitrateBps(width, height);
int num_temporal_layers = DefaultNumberOfTemporalLayers(s);
@ -250,8 +237,8 @@ std::vector<webrtc::VideoStream> GetNormalSimulcastLayers(
// with the default 3 simulcast streams. Otherwise we risk a higher
// threshold for receiving a feed at all.
const float rate_factor =
webrtc::kLayerRateAllocation[3][0] /
webrtc::kLayerRateAllocation[num_temporal_layers][0];
webrtc::kVp8LayerRateAlloction[3][0] /
webrtc::kVp8LayerRateAlloction[num_temporal_layers][0];
layers[s].max_bitrate_bps =
static_cast<int>(layers[s].max_bitrate_bps * rate_factor);
layers[s].target_bitrate_bps =
@ -283,8 +270,7 @@ std::vector<webrtc::VideoStream> GetScreenshareLayers(
double bitrate_priority,
int max_qp,
int max_framerate,
bool screenshare_simulcast_enabled,
bool temporal_layers_supported) {
bool screenshare_simulcast_enabled) {
auto max_screenshare_layers =
screenshare_simulcast_enabled ? kMaxScreenshareSimulcastLayers : 1;
size_t num_simulcast_layers =
@ -301,7 +287,7 @@ std::vector<webrtc::VideoStream> GetScreenshareLayers(
layers[0].min_bitrate_bps = kMinVideoBitrateBps;
layers[0].target_bitrate_bps = kScreenshareDefaultTl0BitrateKbps * 1000;
layers[0].max_bitrate_bps = kScreenshareDefaultTl1BitrateKbps * 1000;
layers[0].num_temporal_layers = temporal_layers_supported ? 2 : 0;
layers[0].num_temporal_layers = 2;
// With simulcast enabled, add another spatial layer. This one will have a
// more normal layout, with the regular 3 temporal layer pattern and no fps