Revert of Issue 2434073003: Extract bitrate allocation ... (patchset #4 id:60001 of https://codereview.webrtc.org/2488833004/ )
Reason for revert:
Seems to be causing flakiness in perf test:
FullStackTest.ScreenshareSlidesVP8_2TL_LossyNet
Original issue's description:
> Reland of Issue 2434073003: Extract bitrate allocation ...
>
> This is a reland of https://codereview.webrtc.org/2434073003/ including
> some fixes for failing test cases.
>
> 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
>
> Committed: https://crrev.com/647bf43dcb2fd16fccf276bd94dc4400728bb405
> Cr-Commit-Position: refs/heads/master@{#15023}
TBR=mflodman@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:6301
Review-Url: https://codereview.webrtc.org/2491393002
Cr-Commit-Position: refs/heads/master@{#15026}
diff --git a/webrtc/modules/video_coding/video_coding_impl.cc b/webrtc/modules/video_coding/video_coding_impl.cc
index 021281b..2f709b6 100644
--- a/webrtc/modules/video_coding/video_coding_impl.cc
+++ b/webrtc/modules/video_coding/video_coding_impl.cc
@@ -11,14 +11,10 @@
#include "webrtc/modules/video_coding/video_coding_impl.h"
#include <algorithm>
-#include <utility>
#include "webrtc/common_types.h"
-#include "webrtc/common_video/include/video_bitrate_allocator.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/base/criticalsection.h"
-#include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
-#include "webrtc/modules/video_coding/include/video_codec_initializer.h"
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
#include "webrtc/modules/video_coding/encoded_frame.h"
#include "webrtc/modules/video_coding/jitter_buffer.h"
@@ -108,21 +104,6 @@
int32_t RegisterSendCodec(const VideoCodec* sendCodec,
uint32_t numberOfCores,
uint32_t maxPayloadSize) override {
- if (sendCodec != nullptr && sendCodec->codecType == kVideoCodecVP8) {
- // Set up a rate allocator and temporal layers factory for this vp8
- // instance. The codec impl will have a raw pointer to the TL factory,
- // and will call it when initializing. Since this can happen
- // asynchronously keep the instance alive until destruction or until a
- // new send codec is registered.
- VideoCodec vp8_codec = *sendCodec;
- std::unique_ptr<TemporalLayersFactory> tl_factory(
- new TemporalLayersFactory());
- vp8_codec.VP8()->tl_factory = tl_factory.get();
- rate_allocator_ = VideoCodecInitializer::CreateBitrateAllocator(
- vp8_codec, std::move(tl_factory));
- return sender_.RegisterSendCodec(&vp8_codec, numberOfCores,
- maxPayloadSize);
- }
return sender_.RegisterSendCodec(sendCodec, numberOfCores, maxPayloadSize);
}
@@ -145,8 +126,7 @@
int32_t SetChannelParameters(uint32_t target_bitrate, // bits/s.
uint8_t lossRate,
int64_t rtt) override {
- return sender_.SetChannelParameters(target_bitrate, lossRate, rtt,
- rate_allocator_.get());
+ return sender_.SetChannelParameters(target_bitrate, lossRate, rtt);
}
int32_t RegisterProtectionCallback(
@@ -276,7 +256,6 @@
private:
EncodedImageCallbackWrapper post_encode_callback_;
vcm::VideoSender sender_;
- std::unique_ptr<VideoBitrateAllocator> rate_allocator_;
vcm::VideoReceiver receiver_;
};
} // namespace