From 2c35da4c00810c16036131a130aeabfc14e32ad4 Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Tue, 25 Feb 2020 10:35:48 +0100 Subject: [PATCH] In Vp8 temporal layering fix generic info at non-first key frame Bug: b/149907566 Change-Id: I5df5dea1680e95f15c38240df98f4acc3b5daf8e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168954 Reviewed-by: Ilya Nikolaevskiy Commit-Queue: Danil Chapovalov Cr-Commit-Position: refs/heads/master@{#30601} --- .../video_coding/codecs/vp8/default_temporal_layers.cc | 10 +++++++--- .../codecs/vp8/default_temporal_layers_unittest.cc | 9 +++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/video_coding/codecs/vp8/default_temporal_layers.cc b/modules/video_coding/codecs/vp8/default_temporal_layers.cc index 426ee76779..8322e8d09d 100644 --- a/modules/video_coding/codecs/vp8/default_temporal_layers.cc +++ b/modules/video_coding/codecs/vp8/default_temporal_layers.cc @@ -554,10 +554,14 @@ void DefaultTemporalLayers::OnEncodeDone(size_t stream_index, // subsequent frames. if (is_keyframe) { info->template_structure = GetTemplateStructure(num_layers_); + generic_frame_info.decode_target_indications = + temporal_pattern_.front().decode_target_indications; + generic_frame_info.temporal_id = 0; + } else { + generic_frame_info.decode_target_indications = + frame.dependency_info.decode_target_indications; + generic_frame_info.temporal_id = frame_config.packetizer_temporal_idx; } - generic_frame_info.decode_target_indications = - frame.dependency_info.decode_target_indications; - generic_frame_info.temporal_id = frame_config.packetizer_temporal_idx; if (!frame.expired) { for (Vp8BufferReference buffer : kAllBuffers) { diff --git a/modules/video_coding/codecs/vp8/default_temporal_layers_unittest.cc b/modules/video_coding/codecs/vp8/default_temporal_layers_unittest.cc index 54f091da5b..64ad40ab76 100644 --- a/modules/video_coding/codecs/vp8/default_temporal_layers_unittest.cc +++ b/modules/video_coding/codecs/vp8/default_temporal_layers_unittest.cc @@ -20,6 +20,7 @@ #include "modules/video_coding/include/video_codec_interface.h" #include "modules/video_coding/utility/simulcast_rate_allocator.h" #include "test/field_trial.h" +#include "test/gmock.h" #include "test/gtest.h" #include "vpx/vp8cx.h" @@ -28,6 +29,9 @@ namespace webrtc { namespace test { namespace { + +using ::testing::Each; + enum { kTemporalUpdateLast = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF, @@ -674,6 +678,11 @@ TEST_F(TemporalLayersTest, KeyFrame) { << "Key frame should be marked layer sync."; EXPECT_EQ(0, info.codecSpecific.VP8.temporalIdx) << "Key frame should always be packetized as layer 0"; + EXPECT_EQ(0, info.generic_frame_info->temporal_id) + << "Key frame should always be packetized as layer 0"; + EXPECT_THAT(info.generic_frame_info->decode_target_indications, + Each(DecodeTargetIndication::kSwitch)) + << "Key frame is universal switch"; EXPECT_TRUE(checker.CheckTemporalConfig(true, tl_config)); } }