diff --git a/modules/video_coding/svc/scalability_structure_unittest.cc b/modules/video_coding/svc/scalability_structure_unittest.cc index d6766f0d50..3bb658352d 100644 --- a/modules/video_coding/svc/scalability_structure_unittest.cc +++ b/modules/video_coding/svc/scalability_structure_unittest.cc @@ -292,7 +292,8 @@ TEST_P(ScalabilityStructureTest, ProduceNoFrameForDisabledLayers) { INSTANTIATE_TEST_SUITE_P( Svc, 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{"L2T1", /*num_temporal_units=*/3}, SvcTestParam{"L2T1_KEY", /*num_temporal_units=*/3}, diff --git a/modules/video_coding/svc/scalable_video_controller_no_layering.cc b/modules/video_coding/svc/scalable_video_controller_no_layering.cc index 6d8e6e8fc6..3934e57804 100644 --- a/modules/video_coding/svc/scalable_video_controller_no_layering.cc +++ b/modules/video_coding/svc/scalable_video_controller_no_layering.cc @@ -32,14 +32,28 @@ FrameDependencyStructure ScalableVideoControllerNoLayering::DependencyStructure() const { FrameDependencyStructure structure; structure.num_decode_targets = 1; - FrameDependencyTemplate a_template; - a_template.decode_target_indications = {DecodeTargetIndication::kSwitch}; - structure.templates.push_back(a_template); + structure.num_chains = 1; + structure.decode_target_protected_by_chain = {0}; + + 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; } std::vector ScalableVideoControllerNoLayering::NextFrameConfig(bool restart) { + if (!enabled_) { + return {}; + } std::vector result(1); if (restart || start_) { result[0].Id(0).Keyframe().Update(0); @@ -61,7 +75,13 @@ GenericFrameInfo ScalableVideoControllerNoLayering::OnEncodeDone( } } frame_info.decode_target_indications = {DecodeTargetIndication::kSwitch}; + frame_info.part_of_chain = {true}; return frame_info; } +void ScalableVideoControllerNoLayering::OnRatesUpdated( + const VideoBitrateAllocation& bitrates) { + enabled_ = bitrates.GetBitrate(0, 0) > 0; +} + } // namespace webrtc diff --git a/modules/video_coding/svc/scalable_video_controller_no_layering.h b/modules/video_coding/svc/scalable_video_controller_no_layering.h index e253ffe841..6d66b61c8b 100644 --- a/modules/video_coding/svc/scalable_video_controller_no_layering.h +++ b/modules/video_coding/svc/scalable_video_controller_no_layering.h @@ -28,10 +28,11 @@ class ScalableVideoControllerNoLayering : public ScalableVideoController { std::vector NextFrameConfig(bool restart) override; GenericFrameInfo OnEncodeDone(const LayerFrameConfig& config) override; - void OnRatesUpdated(const VideoBitrateAllocation& bitrates) override {} + void OnRatesUpdated(const VideoBitrateAllocation& bitrates) override; private: bool start_ = true; + bool enabled_ = true; }; } // namespace webrtc