Remove TemporalLayersFactory and associated classes
As the rate allocation has been moved into entirely into SimulcastRateAllocator, and the listeners are thus no longer needed, this class doesn't fill any other purpose than to determine if ScreenshareLayers or TemporalLayers should be created for a given simulcast stream. This can however be done just from looking at the VideoCodec instance, so changing this into a static factory method. Due to dependencies from upstream projects, keep the class name and field in VideoCodec around for now. Bug: webrtc:9012 Change-Id: I028fe6b2a19e0d16b35956cc2df01dcf5bfa7979 Reviewed-on: https://webrtc-review.googlesource.com/63264 Commit-Queue: Erik Språng <sprang@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22529}
This commit is contained in:
@ -15,13 +15,65 @@
|
||||
#include <vector>
|
||||
|
||||
#include "modules/include/module_common_types.h"
|
||||
#include "modules/video_coding/codecs/vp8/default_temporal_layers.h"
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8_common_types.h"
|
||||
#include "modules/video_coding/codecs/vp8/screenshare_layers.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/ptr_util.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
uint8_t NumTemporalLayers(const VideoCodec& codec, int spatial_id) {
|
||||
uint8_t num_temporal_layers =
|
||||
std::max<uint8_t>(1, codec.VP8().numberOfTemporalLayers);
|
||||
if (codec.numberOfSimulcastStreams > 0) {
|
||||
RTC_DCHECK_LT(spatial_id, codec.numberOfSimulcastStreams);
|
||||
num_temporal_layers =
|
||||
std::max(num_temporal_layers,
|
||||
codec.simulcastStream[spatial_id].numberOfTemporalLayers);
|
||||
}
|
||||
return num_temporal_layers;
|
||||
}
|
||||
|
||||
bool IsConferenceModeScreenshare(const VideoCodec& codec) {
|
||||
if (codec.mode != kScreensharing) {
|
||||
return false;
|
||||
}
|
||||
return NumTemporalLayers(codec, 0) == 2;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<TemporalLayers> TemporalLayers::CreateTemporalLayers(
|
||||
const VideoCodec& codec,
|
||||
size_t spatial_id,
|
||||
uint8_t initial_tl0_pic_idx) {
|
||||
if (IsConferenceModeScreenshare(codec) && spatial_id == 0) {
|
||||
// Conference mode temporal layering for screen content in base stream.
|
||||
return rtc::MakeUnique<ScreenshareLayers>(2, initial_tl0_pic_idx,
|
||||
Clock::GetRealTimeClock());
|
||||
}
|
||||
|
||||
return rtc::MakeUnique<DefaultTemporalLayers>(
|
||||
NumTemporalLayers(codec, spatial_id), initial_tl0_pic_idx);
|
||||
}
|
||||
|
||||
std::unique_ptr<TemporalLayersChecker>
|
||||
TemporalLayers::CreateTemporalLayersChecker(const VideoCodec& codec,
|
||||
size_t spatial_id,
|
||||
uint8_t initial_tl0_pic_idx) {
|
||||
if (IsConferenceModeScreenshare(codec) && spatial_id == 0) {
|
||||
// Conference mode temporal layering for screen content in base stream,
|
||||
// use generic checker.
|
||||
return rtc::MakeUnique<TemporalLayersChecker>(2, initial_tl0_pic_idx);
|
||||
}
|
||||
|
||||
return rtc::MakeUnique<DefaultTemporalLayersChecker>(
|
||||
NumTemporalLayers(codec, spatial_id), initial_tl0_pic_idx);
|
||||
}
|
||||
|
||||
TemporalLayersChecker::TemporalLayersChecker(int num_temporal_layers,
|
||||
uint8_t /*initial_tl0_pic_idx*/)
|
||||
|
||||
Reference in New Issue
Block a user