Extract bitrate allocation of spatial/temporal layers out of codec impl.
This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 Review-Url: https://codereview.webrtc.org/2434073003 Cr-Commit-Position: refs/heads/master@{#14998}
This commit is contained in:
@ -9,9 +9,7 @@
|
||||
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_
|
||||
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "vpx/vpx_encoder.h"
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/timeutils.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
|
||||
@ -41,10 +39,15 @@ class ScreenshareLayers : public TemporalLayers {
|
||||
// and/or update the reference buffers.
|
||||
int EncodeFlags(uint32_t timestamp) override;
|
||||
|
||||
bool ConfigureBitrates(int bitrate_kbps,
|
||||
int max_bitrate_kbps,
|
||||
int framerate,
|
||||
vpx_codec_enc_cfg_t* cfg) override;
|
||||
// Update state based on new bitrate target and incoming framerate.
|
||||
// Returns the bitrate allocation for the active temporal layers.
|
||||
std::vector<uint32_t> OnRatesUpdated(int bitrate_kbps,
|
||||
int max_bitrate_kbps,
|
||||
int framerate) override;
|
||||
|
||||
// Update the encoder configuration with target bitrates or other parameters.
|
||||
// Returns true iff the configuration was actually modified.
|
||||
bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) override;
|
||||
|
||||
void PopulateCodecSpecific(bool base_layer_sync,
|
||||
CodecSpecificInfoVP8* vp8_info,
|
||||
@ -54,11 +57,6 @@ class ScreenshareLayers : public TemporalLayers {
|
||||
|
||||
int CurrentLayerId() const override;
|
||||
|
||||
// Allows the layers adapter to update the encoder configuration prior to a
|
||||
// frame being encoded. Return true if the configuration should be updated
|
||||
// and false if now change is needed.
|
||||
bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) override;
|
||||
|
||||
private:
|
||||
bool TimeToSync(int64_t timestamp) const;
|
||||
|
||||
@ -75,7 +73,8 @@ class ScreenshareLayers : public TemporalLayers {
|
||||
int min_qp_;
|
||||
int max_qp_;
|
||||
uint32_t max_debt_bytes_;
|
||||
int frame_rate_;
|
||||
int framerate_;
|
||||
bool bitrate_updated_;
|
||||
|
||||
static const int kMaxNumTemporalLayers = 2;
|
||||
struct TemporalLayer {
|
||||
|
||||
Reference in New Issue
Block a user