Chromium Code Reviews| 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 3573aa8f1cb55a1e8f65f7f3d9741a6d8a239926..2589cf22f7fd3ecba543717003772471a0426fdf 100644 |
| --- a/webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.cc |
| +++ b/webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.cc |
| @@ -48,6 +48,9 @@ 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(0), |
| + layer_sync(false), |
| freeze_entropy(freeze_entropy) {} |
| namespace { |
| @@ -254,7 +257,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); |
| @@ -266,12 +268,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_; |
| } |
| @@ -332,7 +328,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; |
| } |
| @@ -348,24 +347,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_) { |
|
brandtr
2017/06/12 15:15:53
How about keeping timestamp != timestamp_ as a DCH
pbos-webrtc
2017/06/15 21:59:09
I believe that timestamp == timestamp_ is OK if th
brandtr
2017/06/19 06:54:19
Hmm, my idea was to guard against repeat input fra
|
| - timestamp_ = timestamp; |
| + if (vp8_info->temporalIdx == 0) |
| tl0_pic_idx_++; |
| - } |
| last_base_layer_sync_ = frame_is_keyframe; |
| vp8_info->tl0PicIdx = tl0_pic_idx_; |
| } |