Configure generic temporal layer in VP8 screenshare

This ensures that the payload descriptor and potential generic
descriptors uses the same temporal layer.

Bug: b/200518293
Change-Id: I17e980b47fe6c814cb393fc459064576447aa27a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/236520
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Emil Lundmark <lndmrk@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35275}
This commit is contained in:
Emil Lundmark
2021-10-27 13:39:41 +02:00
committed by WebRTC LUCI CQ
parent 2bf6d45f14
commit d891c4940a
2 changed files with 10 additions and 3 deletions

View File

@ -320,6 +320,7 @@ void ScreenshareLayers::OnEncodeDone(size_t stream_index,
if (number_of_temporal_layers_ == 1) {
vp8_info.temporalIdx = kNoTemporalIdx;
vp8_info.layerSync = false;
generic_frame_info.temporal_id = 0;
generic_frame_info.decode_target_indications = {kSwitch};
generic_frame_info.encoder_buffers.emplace_back(
0, /*referenced=*/!is_keyframe, /*updated=*/true);
@ -329,6 +330,7 @@ void ScreenshareLayers::OnEncodeDone(size_t stream_index,
vp8_info.temporalIdx =
dependency_info->frame_config.packetizer_temporal_idx;
vp8_info.layerSync = dependency_info->frame_config.layer_sync;
generic_frame_info.temporal_id = vp8_info.temporalIdx;
generic_frame_info.decode_target_indications =
dependency_info->decode_target_indications;
} else {
@ -344,6 +346,7 @@ void ScreenshareLayers::OnEncodeDone(size_t stream_index,
active_layer_ = 1;
info->template_structure =
GetTemplateStructure(number_of_temporal_layers_);
generic_frame_info.temporal_id = vp8_info.temporalIdx;
generic_frame_info.decode_target_indications = {kSwitch, kSwitch};
} else if (active_layer_ >= 0 && layers_[active_layer_].state ==
TemporalLayer::State::kKeyFrame) {

View File

@ -218,18 +218,20 @@ TEST_F(ScreenshareLayerTest, 1Layer) {
// belong to the base layer.
const int kSingleLayerFlags = 0;
auto info = std::make_unique<CodecSpecificInfo>();
int flags = EncodeFrame(false, info.get());
int flags = EncodeFrame(/*base_sync=*/false, info.get());
timestamp_ += kTimestampDelta5Fps;
EXPECT_EQ(static_cast<uint8_t>(kNoTemporalIdx),
info->codecSpecific.VP8.temporalIdx);
EXPECT_FALSE(info->codecSpecific.VP8.layerSync);
EXPECT_EQ(info->generic_frame_info->temporal_id, 0);
info = std::make_unique<CodecSpecificInfo>();
flags = EncodeFrame(false, info.get());
flags = EncodeFrame(/*base_sync=*/false, info.get());
EXPECT_EQ(kSingleLayerFlags, flags);
EXPECT_EQ(static_cast<uint8_t>(kNoTemporalIdx),
info->codecSpecific.VP8.temporalIdx);
EXPECT_FALSE(info->codecSpecific.VP8.layerSync);
EXPECT_EQ(info->generic_frame_info->temporal_id, 0);
}
TEST_F(ScreenshareLayerTest, 2LayersPeriodicSync) {
@ -337,7 +339,9 @@ TEST_F(ScreenshareLayerTest, 2LayersToggling) {
int tl1_frames = 0;
for (int i = 0; i < 50; ++i) {
CodecSpecificInfo info;
EncodeFrame(false, &info);
EncodeFrame(/*base_sync=*/false, &info);
EXPECT_EQ(info.codecSpecific.VP8.temporalIdx,
info.generic_frame_info->temporal_id);
timestamp_ += kTimestampDelta5Fps;
switch (info.codecSpecific.VP8.temporalIdx) {
case 0: