Use single FrameBufferController in VP8, created by a factory.

This CL paves the way to making FrameBufferController injectable.

LibvpxVp8Encoder can manage multiple streams. Prior to this CL,
each stream had its own frame buffer controller, all of them held
in a vector by LibvpxVp8Encoder. This complicated the code and
produced some code duplication (cf. SetupTemporalLayers).

This CL:
1. Replaces CreateVp8TemporalLayers() by a factory. (Later CLs
   will make this factory injectable.)
2. Makes LibvpxVp8Encoder use a single controller. This single
   controller will, in the case of multiple streams, delegate
   its work to multiple controllers, but that fact is not visible
   to LibvpxVp8Encoder.

This CL also squashes CL #126046 (Send notifications of RTT and
PLR changes to Vp8FrameBufferController) into it.

Bug: webrtc:10382
Change-Id: Id9b55734bebb457acc276f34a7a9e52cc19c8eb9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126483
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27206}
This commit is contained in:
Elad Alon
2019-03-20 11:56:20 +01:00
committed by Commit Bot
parent 98d85fe9a4
commit cde8ab265e
26 changed files with 581 additions and 362 deletions

View File

@ -18,8 +18,8 @@
#include "api/video/builtin_video_bitrate_allocator_factory.h"
#include "api/video/i420_buffer.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video_codecs/create_vp8_temporal_layers.h"
#include "api/video_codecs/vp8_temporal_layers.h"
#include "api/video_codecs/vp8_temporal_layers_factory.h"
#include "media/base/video_adapter.h"
#include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
#include "modules/video_coding/utility/default_video_bitrate_allocator.h"
@ -678,12 +678,8 @@ class VideoStreamEncoderTest : public ::testing::Test {
if (config->codecType == kVideoCodecVP8) {
// Simulate setting up temporal layers, in order to validate the life
// cycle of these objects.
int num_streams = std::max<int>(1, config->numberOfSimulcastStreams);
for (int i = 0; i < num_streams; ++i) {
allocated_temporal_layers_.emplace_back(
CreateVp8TemporalLayers(Vp8TemporalLayersType::kFixedPattern,
config->VP8().numberOfTemporalLayers));
}
Vp8TemporalLayersFactory factory;
frame_buffer_controller_ = factory.Create(*config);
}
if (force_init_encode_failed_) {
initialized_ = EncoderState::kInitializationFailed;
@ -736,7 +732,7 @@ class VideoStreamEncoderTest : public ::testing::Test {
int last_input_height_ RTC_GUARDED_BY(local_crit_sect_) = 0;
bool quality_scaling_ RTC_GUARDED_BY(local_crit_sect_) = true;
bool is_hardware_accelerated_ RTC_GUARDED_BY(local_crit_sect_) = false;
std::vector<std::unique_ptr<Vp8TemporalLayers>> allocated_temporal_layers_
std::unique_ptr<Vp8FrameBufferController> frame_buffer_controller_
RTC_GUARDED_BY(local_crit_sect_);
bool force_init_encode_failed_ RTC_GUARDED_BY(local_crit_sect_) = false;
double rate_factor_ RTC_GUARDED_BY(local_crit_sect_) = 1.0;