Revert "Reland "Move FakeCodec to separate target and behave like real encoder.""

This reverts commit f2a8287cc5bbe982cc008d0550df83533623b780,
original reviewed on: https://webrtc-review.googlesource.com/95182

Reason for revert: Breaks ramp-up tests

TBR=mbonadei@webrtc.org,ilnik@webrtc.org,sprang@webrtc.org,srte@webrtc.org,perkj@webrtc.org,titovartem@webrtc.org

Bug: none
Change-Id: I11ddf8619c33cf93825088fd293bcdf11e8cedab
Reviewed-on: https://webrtc-review.googlesource.com/96083
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24438}
This commit is contained in:
Ilya Nikolaevskiy
2018-08-27 08:48:50 +00:00
committed by Commit Bot
parent c3af97d68c
commit 8d92e8d323
16 changed files with 120 additions and 541 deletions

View File

@ -12,8 +12,6 @@
#include <stdint.h>
#include <algorithm>
namespace webrtc {
DefaultVideoBitrateAllocator::DefaultVideoBitrateAllocator(
@ -29,23 +27,14 @@ VideoBitrateAllocation DefaultVideoBitrateAllocator::GetAllocation(
if (total_bitrate_bps == 0 || !codec_.active)
return allocation;
uint32_t allocated_bitrate_bps = total_bitrate_bps;
allocated_bitrate_bps =
std::max(allocated_bitrate_bps, codec_.minBitrate * 1000);
if (codec_.maxBitrate > 0) {
allocated_bitrate_bps =
std::min(allocated_bitrate_bps, codec_.maxBitrate * 1000);
if (total_bitrate_bps < codec_.minBitrate * 1000) {
allocation.SetBitrate(0, 0, codec_.minBitrate * 1000);
} else if (codec_.maxBitrate > 0 &&
total_bitrate_bps > codec_.maxBitrate * 1000) {
allocation.SetBitrate(0, 0, codec_.maxBitrate * 1000);
} else {
allocation.SetBitrate(0, 0, total_bitrate_bps);
}
size_t num_simulcast_streams =
std::max<size_t>(1, codec_.numberOfSimulcastStreams);
// The bitrate is split between all the streams in proportion of powers of 2
// e.g. 1:2, 1:2:4, etc.
for (size_t i = 0; i < num_simulcast_streams; i++) {
allocation.SetBitrate(
i, 0,
allocated_bitrate_bps * (1 << i) / ((1 << num_simulcast_streams) - 1));
}
return allocation;
}