Reland #2 of Issue 2434073003: Extract bitrate allocation ...
This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: 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 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
This commit is contained in:
@ -34,6 +34,8 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class VideoBitrateAllocator;
|
||||
|
||||
namespace vcm {
|
||||
|
||||
class VCMProcessTimer {
|
||||
@ -75,9 +77,15 @@ class VideoSender : public Module {
|
||||
int Bitrate(unsigned int* bitrate) const;
|
||||
int FrameRate(unsigned int* framerate) const;
|
||||
|
||||
int32_t SetChannelParameters(uint32_t target_bitrate, // bits/s.
|
||||
int32_t SetChannelParameters(uint32_t target_bitrate_bps,
|
||||
uint8_t lossRate,
|
||||
int64_t rtt);
|
||||
int64_t rtt,
|
||||
VideoBitrateAllocator* bitrate_allocator);
|
||||
// Updates the channel parameters, with a reallocated bitrate based on a
|
||||
// presumably updated codec configuration, but does not update the encoder
|
||||
// itself (it will be updated on the next frame).
|
||||
void UpdateChannelParemeters(VideoBitrateAllocator* bitrate_allocator);
|
||||
|
||||
// Deprecated:
|
||||
// TODO(perkj): Remove once no projects use it.
|
||||
int32_t RegisterProtectionCallback(VCMProtectionCallback* protection);
|
||||
@ -92,6 +100,10 @@ class VideoSender : public Module {
|
||||
void Process() override;
|
||||
|
||||
private:
|
||||
EncoderParameters UpdateEncoderParameters(
|
||||
const EncoderParameters& params,
|
||||
VideoBitrateAllocator* bitrate_allocator,
|
||||
uint32_t target_bitrate_bps);
|
||||
void SetEncoderParameters(EncoderParameters params, bool has_internal_source)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(encoder_crit_);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user