Revert of Extract bitrate allocation of spatial/temporal layers out of codec impl. (patchset #17 id:320001 of https://codereview.webrtc.org/2434073003/ )

Reason for revert:
Breaks perf tests.

Original issue's 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/8f46c679d24a05b3f08e02c6d91ec9637f34e24f
> Cr-Commit-Position: refs/heads/master@{#14998}

TBR=stefan@webrtc.org,perkj@webrtc.org,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/2489843002
Cr-Commit-Position: refs/heads/master@{#15001}
This commit is contained in:
sprang
2016-11-09 06:14:47 -08:00
committed by Commit bot
parent 6ba58d67ce
commit 4bc98d4e1b
63 changed files with 848 additions and 1686 deletions

View File

@ -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 @@ class VideoCodingModuleImpl : public VideoCodingModule {
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 @@ class VideoCodingModuleImpl : public VideoCodingModule {
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 @@ class VideoCodingModuleImpl : public VideoCodingModule {
private:
EncodedImageCallbackWrapper post_encode_callback_;
vcm::VideoSender sender_;
std::unique_ptr<VideoBitrateAllocator> rate_allocator_;
vcm::VideoReceiver receiver_;
};
} // namespace