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

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

Issue 2924993002: Move temporal-layer properties to FrameConfig. (Closed)
Patch Set: remove timestamp check, input frame doesn't repeat Created 3 years, 6 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 a30679a36cf51711c9f9bbc55b0066ffb82939d8..415cd2821417a464d8f171fa8ca069d3c9da56d4 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;
}
@@ -122,7 +115,8 @@ TemporalLayers::FrameConfig ScreenshareLayers::UpdateLayerConfig(
layers_[1].UpdateDebt(ts_diff / 90);
last_timestamp_ = timestamp;
- TemporalLayerState layer_state = TemporalLayerState::kDrop;
+ TemporalLayerState layer_state =
+ TemporalLayerState::kDrop;
brandtr 2017/06/12 15:15:53 revert?
pbos-webrtc 2017/06/15 21:59:09 Done.
if (active_layer_ == -1 ||
layers_[active_layer_].state != TemporalLayer::State::kDropped) {
@@ -146,6 +140,7 @@ TemporalLayers::FrameConfig ScreenshareLayers::UpdateLayerConfig(
}
}
+ bool layer_sync = false;
switch (active_layer_) {
case 0:
layer_state = TemporalLayerState::kTl0;
@@ -153,6 +148,7 @@ TemporalLayers::FrameConfig ScreenshareLayers::UpdateLayerConfig(
break;
case 1:
if (TimeToSync(unwrapped_timestamp)) {
+ layer_sync = true;
last_sync_timestamp_ = unwrapped_timestamp;
layer_state = TemporalLayerState::kTl1Sync;
} else {
@@ -183,16 +179,18 @@ TemporalLayers::FrameConfig ScreenshareLayers::UpdateLayerConfig(
// 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_sync;
return tl_config;
}
@@ -269,36 +267,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