Revert "Refactor handling of configuration overrides from Vp8FrameBufferController"

This reverts commit 4d6795f828bc4f2b050405b0ff73d4020b2a2963.

Reason for revert: chromium:961253

Original change's description:
> Refactor handling of configuration overrides from Vp8FrameBufferController
>
> Make Vp8FrameBufferController::UpdateConfiguration return a set
> of desired overrides. These overrides are cumulative with
> previously returned override sets.
>
> Bug: webrtc:10382
> Change-Id: I1aa9544ae0cf6c57115e80963b3bbcdc3101db5e
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/134649
> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Commit-Queue: Elad Alon <eladalon@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#27835}

TBR=brandtr@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org


Bug: chromium:961253
Change-Id: I06f0eafd4f38c441ddbdfeebae8055b02465eb9b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135940
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27900}
This commit is contained in:
Elad Alon
2019-05-09 22:31:08 +02:00
committed by Commit Bot
parent 14a996617b
commit 3d622d6e5c
13 changed files with 203 additions and 293 deletions

View File

@ -11,7 +11,6 @@
#ifndef API_VIDEO_CODECS_VP8_FRAME_BUFFER_CONTROLLER_H_
#define API_VIDEO_CODECS_VP8_FRAME_BUFFER_CONTROLLER_H_
#include <array>
#include <memory>
#include <vector>
@ -47,48 +46,34 @@ namespace webrtc {
struct CodecSpecificInfo;
// Each member represents an override of the VPX configuration if the optional
// value is set.
// TODO(eladalon): This configuration is temporal-layers specific; refactor.
struct Vp8EncoderConfig {
struct TemporalLayerConfig {
bool operator!=(const TemporalLayerConfig& other) const {
return ts_number_layers != other.ts_number_layers ||
ts_target_bitrate != other.ts_target_bitrate ||
ts_rate_decimator != other.ts_rate_decimator ||
ts_periodicity != other.ts_periodicity ||
ts_layer_id != other.ts_layer_id;
}
static constexpr size_t kMaxPeriodicity = 16;
static constexpr size_t kMaxLayers = 5;
static constexpr size_t kMaxPeriodicity = 16;
static constexpr size_t kMaxLayers = 5;
// Number of active temporal layers. Set to 0 if not used.
uint32_t ts_number_layers;
// Arrays of length |ts_number_layers|, indicating (cumulative) target bitrate
// and rate decimator (e.g. 4 if every 4th frame is in the given layer) for
// each active temporal layer, starting with temporal id 0.
uint32_t ts_target_bitrate[kMaxLayers];
uint32_t ts_rate_decimator[kMaxLayers];
// Number of active temporal layers. Set to 0 if not used.
uint32_t ts_number_layers;
// Arrays of length |ts_number_layers|, indicating (cumulative) target
// bitrate and rate decimator (e.g. 4 if every 4th frame is in the given
// layer) for each active temporal layer, starting with temporal id 0.
std::array<uint32_t, kMaxLayers> ts_target_bitrate;
std::array<uint32_t, kMaxLayers> ts_rate_decimator;
// The periodicity of the temporal pattern. Set to 0 if not used.
uint32_t ts_periodicity;
// Array of length |ts_periodicity| indicating the sequence of temporal id's
// to assign to incoming frames.
std::array<uint32_t, kMaxPeriodicity> ts_layer_id;
};
absl::optional<TemporalLayerConfig> temporal_layer_config;
// The periodicity of the temporal pattern. Set to 0 if not used.
uint32_t ts_periodicity;
// Array of length |ts_periodicity| indicating the sequence of temporal id's
// to assign to incoming frames.
uint32_t ts_layer_id[kMaxPeriodicity];
// Target bitrate, in bps.
absl::optional<uint32_t> rc_target_bitrate;
uint32_t rc_target_bitrate;
// Clamp QP to max. Use 0 to disable clamping.
absl::optional<uint32_t> rc_max_quantizer;
// Clamp QP to min/max. Use 0 to disable clamping.
uint32_t rc_min_quantizer;
uint32_t rc_max_quantizer;
// Error resilience mode.
absl::optional<uint32_t> g_error_resilient;
// If has_value(), override error resilience to value().
absl::optional<uint32_t> error_resilient;
};
// This interface defines a way of delegating the logic of buffer management.
@ -98,10 +83,6 @@ class Vp8FrameBufferController {
public:
virtual ~Vp8FrameBufferController() = default;
// Set limits on QP.
// The limits are suggestion-only; the controller is allowed to exceed them.
virtual void SetQpLimits(size_t stream_index, int min_qp, int max_qp) = 0;
// Number of streamed controlled by |this|.
virtual size_t StreamCount() const = 0;
@ -122,13 +103,12 @@ class Vp8FrameBufferController {
const std::vector<uint32_t>& bitrates_bps,
int framerate_fps) = 0;
// Called by the encoder before encoding a frame. Returns a set of overrides
// the controller wishes to enact in the encoder's configuration.
// If a value is not overridden, previous overrides are still in effect.
// (It is therefore not possible to go from a specific override to
// no-override. Once the controller takes responsibility over a value, it
// must maintain responsibility for it.)
virtual Vp8EncoderConfig UpdateConfiguration(size_t stream_index) = 0;
// Called by the encoder before encoding a frame. |cfg| contains the current
// configuration. If the encoder wishes any part of that to be changed before
// the encode step, |cfg| should be changed and then return true. If false is
// returned, the encoder will proceed without updating the configuration.
virtual bool UpdateConfiguration(size_t stream_index,
Vp8EncoderConfig* cfg) = 0;
// Returns the recommended VP8 encode flags needed.
// The timestamp may be used as both a time and a unique identifier, and so