Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.cc

Issue 2924993002: Move temporal-layer properties to FrameConfig. (Closed)
Patch Set: improve unittests Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.cc
diff --git a/webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.cc b/webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.cc
index 010df5b15f02155b85a95ebca36efb1d1f39ad03..ce7faf9f986943dcef44567e867686361d548c5d 100644
--- a/webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.cc
+++ b/webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.cc
@@ -49,9 +49,10 @@ TemporalLayers::FrameConfig::FrameConfig(TemporalLayers::BufferFlags last,
last_buffer_flags(last),
golden_buffer_flags(golden),
arf_buffer_flags(arf),
+ encoder_layer_id(0),
+ packetizer_temporal_idx(kNoTemporalIdx),
layer_sync(false),
- freeze_entropy(freeze_entropy),
- pattern_idx(0) {}
+ freeze_entropy(freeze_entropy) {}
namespace {
@@ -257,7 +258,6 @@ DefaultTemporalLayers::DefaultTemporalLayers(int number_of_temporal_layers,
temporal_pattern_(GetTemporalPattern(num_layers_)),
tl0_pic_idx_(initial_tl0_pic_idx),
pattern_idx_(255),
- timestamp_(0),
last_base_layer_sync_(false) {
RTC_DCHECK_EQ(temporal_pattern_.size(), temporal_layer_sync_.size());
RTC_CHECK_GE(kMaxTemporalStreams, number_of_temporal_layers);
@@ -269,12 +269,6 @@ DefaultTemporalLayers::DefaultTemporalLayers(int number_of_temporal_layers,
RTC_DCHECK_LE(temporal_ids_.size(), temporal_pattern_.size());
}
-int DefaultTemporalLayers::GetTemporalLayerId(
- const TemporalLayers::FrameConfig& tl_config) const {
- RTC_DCHECK(!tl_config.drop_frame);
- return temporal_ids_[tl_config.pattern_idx % temporal_ids_.size()];
-}
-
uint8_t DefaultTemporalLayers::Tl0PicIdx() const {
return tl0_pic_idx_;
}
@@ -335,7 +329,10 @@ TemporalLayers::FrameConfig DefaultTemporalLayers::UpdateLayerConfig(
RTC_DCHECK_LT(0, temporal_pattern_.size());
pattern_idx_ = (pattern_idx_ + 1) % temporal_pattern_.size();
TemporalLayers::FrameConfig tl_config = temporal_pattern_[pattern_idx_];
- tl_config.pattern_idx = pattern_idx_;
+ tl_config.layer_sync =
+ temporal_layer_sync_[pattern_idx_ % temporal_layer_sync_.size()];
+ tl_config.encoder_layer_id = tl_config.packetizer_temporal_idx =
+ temporal_ids_[pattern_idx_ % temporal_ids_.size()];
return tl_config;
}
@@ -351,24 +348,19 @@ void DefaultTemporalLayers::PopulateCodecSpecific(
vp8_info->layerSync = false;
vp8_info->tl0PicIdx = kNoTl0PicIdx;
} else {
+ vp8_info->temporalIdx = tl_config.packetizer_temporal_idx;
+ vp8_info->layerSync = tl_config.layer_sync;
if (frame_is_keyframe) {
vp8_info->temporalIdx = 0;
vp8_info->layerSync = true;
- } else {
- vp8_info->temporalIdx = GetTemporalLayerId(tl_config);
-
- vp8_info->layerSync = temporal_layer_sync_[tl_config.pattern_idx %
- temporal_layer_sync_.size()];
}
if (last_base_layer_sync_ && vp8_info->temporalIdx != 0) {
// Regardless of pattern the frame after a base layer sync will always
// be a layer sync.
vp8_info->layerSync = true;
}
- if (vp8_info->temporalIdx == 0 && timestamp != timestamp_) {
- timestamp_ = timestamp;
+ if (vp8_info->temporalIdx == 0)
tl0_pic_idx_++;
- }
last_base_layer_sync_ = frame_is_keyframe;
vp8_info->tl0PicIdx = tl0_pic_idx_;
}

Powered by Google App Engine
This is Rietveld 408576698