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

Unified Diff: webrtc/modules/video_coding/codecs/vp8/screenshare_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/screenshare_layers.cc
diff --git a/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc b/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc
index 397e005cbe0f12442b20caa69ceda8fb60b33f46..d81447bb5d849b6275860f0762731adf0b22f771 100644
--- a/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc
+++ b/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc
@@ -79,12 +79,6 @@ ScreenshareLayers::~ScreenshareLayers() {
UpdateHistograms();
}
-int ScreenshareLayers::GetTemporalLayerId(
- const TemporalLayers::FrameConfig& tl_config) const {
- // Codec does not use temporal layers for screenshare.
- return 0;
-}
-
uint8_t ScreenshareLayers::Tl0PicIdx() const {
return tl0_pic_idx_;
}
@@ -96,7 +90,6 @@ TemporalLayers::FrameConfig ScreenshareLayers::UpdateLayerConfig(
// TODO(pbos): Consider updating only last, and not all buffers.
TemporalLayers::FrameConfig tl_config(
kReferenceAndUpdate, kReferenceAndUpdate, kReferenceAndUpdate);
- tl_config.pattern_idx = static_cast<int>(TemporalLayerState::kTl1);
return tl_config;
}
@@ -184,21 +177,24 @@ TemporalLayers::FrameConfig ScreenshareLayers::UpdateLayerConfig(
// TL0 only references and updates 'last'.
tl_config =
TemporalLayers::FrameConfig(kReferenceAndUpdate, kNone, kNone);
+ tl_config.packetizer_temporal_idx = 0;
break;
case TemporalLayerState::kTl1:
// TL1 references both 'last' and 'golden' but only updates 'golden'.
tl_config =
TemporalLayers::FrameConfig(kReference, kReferenceAndUpdate, kNone);
+ tl_config.packetizer_temporal_idx = 1;
break;
case TemporalLayerState::kTl1Sync:
// Predict from only TL0 to allow participants to switch to the high
// bitrate stream. Updates 'golden' so that TL1 can continue to refer to
// and update 'golden' from this point on.
tl_config = TemporalLayers::FrameConfig(kReference, kUpdate, kNone);
+ tl_config.packetizer_temporal_idx = 1;
break;
}
- tl_config.pattern_idx = static_cast<int>(layer_state);
+ tl_config.layer_sync = layer_state == TemporalLayerState::kTl1Sync;
return tl_config;
}
@@ -275,36 +271,24 @@ void ScreenshareLayers::PopulateCodecSpecific(
const TemporalLayers::FrameConfig& tl_config,
CodecSpecificInfoVP8* vp8_info,
uint32_t timestamp) {
- int64_t unwrapped_timestamp = time_wrap_handler_.Unwrap(timestamp);
if (number_of_temporal_layers_ == 1) {
vp8_info->temporalIdx = kNoTemporalIdx;
vp8_info->layerSync = false;
vp8_info->tl0PicIdx = kNoTl0PicIdx;
} else {
- TemporalLayerState layer_state =
- static_cast<TemporalLayerState>(tl_config.pattern_idx);
- switch (layer_state) {
- case TemporalLayerState::kDrop:
- RTC_NOTREACHED();
- break;
- case TemporalLayerState::kTl0:
- vp8_info->temporalIdx = 0;
- break;
- case TemporalLayerState::kTl1:
- case TemporalLayerState::kTl1Sync:
- vp8_info->temporalIdx = 1;
- break;
- }
+ int64_t unwrapped_timestamp = time_wrap_handler_.Unwrap(timestamp);
+ vp8_info->temporalIdx = tl_config.packetizer_temporal_idx;
+ vp8_info->layerSync = tl_config.layer_sync;
if (frame_is_keyframe) {
vp8_info->temporalIdx = 0;
last_sync_timestamp_ = unwrapped_timestamp;
+ vp8_info->layerSync = true;
} else 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.
last_sync_timestamp_ = unwrapped_timestamp;
+ vp8_info->layerSync = true;
}
- vp8_info->layerSync = last_sync_timestamp_ != -1 &&
- last_sync_timestamp_ == unwrapped_timestamp;
if (vp8_info->temporalIdx == 0) {
tl0_pic_idx_++;
}

Powered by Google App Engine
This is Rietveld 408576698