Test and fix unscalable video structure.

Bug: webrtc:11999
Change-Id: I94e3a97ebadbf92ca741d750f67fbea5cbd2b66f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206984
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33237}
This commit is contained in:
Danil Chapovalov 2021-02-11 14:58:29 +01:00 committed by Commit Bot
parent dea374a467
commit 45d2234a5c
3 changed files with 27 additions and 5 deletions

View file

@ -292,7 +292,8 @@ TEST_P(ScalabilityStructureTest, ProduceNoFrameForDisabledLayers) {
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
Svc, Svc,
ScalabilityStructureTest, ScalabilityStructureTest,
Values(SvcTestParam{"L1T2", /*num_temporal_units=*/4}, Values(SvcTestParam{"NONE", /*num_temporal_units=*/3},
SvcTestParam{"L1T2", /*num_temporal_units=*/4},
SvcTestParam{"L1T3", /*num_temporal_units=*/8}, SvcTestParam{"L1T3", /*num_temporal_units=*/8},
SvcTestParam{"L2T1", /*num_temporal_units=*/3}, SvcTestParam{"L2T1", /*num_temporal_units=*/3},
SvcTestParam{"L2T1_KEY", /*num_temporal_units=*/3}, SvcTestParam{"L2T1_KEY", /*num_temporal_units=*/3},

View file

@ -32,14 +32,28 @@ FrameDependencyStructure
ScalableVideoControllerNoLayering::DependencyStructure() const { ScalableVideoControllerNoLayering::DependencyStructure() const {
FrameDependencyStructure structure; FrameDependencyStructure structure;
structure.num_decode_targets = 1; structure.num_decode_targets = 1;
FrameDependencyTemplate a_template; structure.num_chains = 1;
a_template.decode_target_indications = {DecodeTargetIndication::kSwitch}; structure.decode_target_protected_by_chain = {0};
structure.templates.push_back(a_template);
FrameDependencyTemplate key_frame;
key_frame.decode_target_indications = {DecodeTargetIndication::kSwitch};
key_frame.chain_diffs = {0};
structure.templates.push_back(key_frame);
FrameDependencyTemplate delta_frame;
delta_frame.decode_target_indications = {DecodeTargetIndication::kSwitch};
delta_frame.chain_diffs = {1};
delta_frame.frame_diffs = {1};
structure.templates.push_back(delta_frame);
return structure; return structure;
} }
std::vector<ScalableVideoController::LayerFrameConfig> std::vector<ScalableVideoController::LayerFrameConfig>
ScalableVideoControllerNoLayering::NextFrameConfig(bool restart) { ScalableVideoControllerNoLayering::NextFrameConfig(bool restart) {
if (!enabled_) {
return {};
}
std::vector<LayerFrameConfig> result(1); std::vector<LayerFrameConfig> result(1);
if (restart || start_) { if (restart || start_) {
result[0].Id(0).Keyframe().Update(0); result[0].Id(0).Keyframe().Update(0);
@ -61,7 +75,13 @@ GenericFrameInfo ScalableVideoControllerNoLayering::OnEncodeDone(
} }
} }
frame_info.decode_target_indications = {DecodeTargetIndication::kSwitch}; frame_info.decode_target_indications = {DecodeTargetIndication::kSwitch};
frame_info.part_of_chain = {true};
return frame_info; return frame_info;
} }
void ScalableVideoControllerNoLayering::OnRatesUpdated(
const VideoBitrateAllocation& bitrates) {
enabled_ = bitrates.GetBitrate(0, 0) > 0;
}
} // namespace webrtc } // namespace webrtc

View file

@ -28,10 +28,11 @@ class ScalableVideoControllerNoLayering : public ScalableVideoController {
std::vector<LayerFrameConfig> NextFrameConfig(bool restart) override; std::vector<LayerFrameConfig> NextFrameConfig(bool restart) override;
GenericFrameInfo OnEncodeDone(const LayerFrameConfig& config) override; GenericFrameInfo OnEncodeDone(const LayerFrameConfig& config) override;
void OnRatesUpdated(const VideoBitrateAllocation& bitrates) override {} void OnRatesUpdated(const VideoBitrateAllocation& bitrates) override;
private: private:
bool start_ = true; bool start_ = true;
bool enabled_ = true;
}; };
} // namespace webrtc } // namespace webrtc