Add support for a forced software encoder fallback.
Make it possible to switch from VP8 HW -> VP8 SW -> VP8 HW depending on bitrate and resolution. BUG=webrtc:6634 Review-Url: https://codereview.webrtc.org/2988963002 Cr-Commit-Position: refs/heads/master@{#19362}
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
|
||||
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
|
||||
#include "webrtc/rtc_base/checks.h"
|
||||
#include "webrtc/system_wrappers/include/field_trial.h"
|
||||
|
||||
#include "vpx/vpx_encoder.h"
|
||||
#include "vpx/vp8cx.h"
|
||||
@ -248,6 +249,16 @@ std::vector<TemporalLayers::FrameConfig> GetTemporalPattern(size_t num_layers) {
|
||||
TemporalLayers::kNone, TemporalLayers::kNone, TemporalLayers::kNone)};
|
||||
}
|
||||
|
||||
// Temporary fix for forced SW fallback.
|
||||
// For VP8 SW codec, |TemporalLayers| is created and reported to
|
||||
// SimulcastRateAllocator::OnTemporalLayersCreated but not for VP8 HW.
|
||||
// Causes an issue when going from forced SW -> HW as |TemporalLayers| is not
|
||||
// deregistred when deleted by SW codec (tl factory might not exist, owned by
|
||||
// SimulcastRateAllocator).
|
||||
bool ExcludeOnTemporalLayersCreated(int num_temporal_layers) {
|
||||
return webrtc::field_trial::IsEnabled("WebRTC-VP8-Forced-Fallback-Encoder") &&
|
||||
num_temporal_layers == 1;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
DefaultTemporalLayers::DefaultTemporalLayers(int number_of_temporal_layers,
|
||||
@ -372,7 +383,7 @@ TemporalLayers* TemporalLayersFactory::Create(
|
||||
uint8_t initial_tl0_pic_idx) const {
|
||||
TemporalLayers* tl =
|
||||
new DefaultTemporalLayers(temporal_layers, initial_tl0_pic_idx);
|
||||
if (listener_)
|
||||
if (listener_ && !ExcludeOnTemporalLayersCreated(temporal_layers))
|
||||
listener_->OnTemporalLayersCreated(simulcast_id, tl);
|
||||
return tl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user