Skip to content

Commit

Permalink
Disable padding when max layer is 0/0 (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodoyun authored Mar 23, 2017
1 parent 0a75766 commit 1bd84a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 13 additions & 3 deletions erizo/src/erizo/rtp/QualityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ void QualityManager::notifyQualityUpdate() {

if (now - last_activity_check_ > kActiveLayerInterval) {
calculateMaxActiveLayer();
if (max_active_spatial_layer_ == 0 && max_active_temporal_layer_ == 0 && padding_enabled_) {
setPadding(false);
}
last_activity_check_ = now;
}

Expand Down Expand Up @@ -89,8 +92,7 @@ void QualityManager::selectLayer(bool try_higher_layers) {

// TODO(javier): should we wait for the actual spatial switch?
// should we disable padding temporarily to avoid congestion (old padding + new bitrate)?
padding_enabled_ = !isInMaxLayer();
getContext()->getPipelineShared()->getService<WebRtcConnection>()->notifyUpdateToHandlers();
setPadding(!isInMaxLayer());
ELOG_DEBUG("message: Is padding enabled, padding_enabled_: %d", padding_enabled_);
}
}
Expand Down Expand Up @@ -139,7 +141,8 @@ bool QualityManager::isInMaxLayer() {

void QualityManager::forceLayers(int spatial_layer, int temporal_layer) {
forced_layers_ = true;
padding_enabled_ = false;
setPadding(false);

spatial_layer_ = spatial_layer;
temporal_layer_ = temporal_layer;
}
Expand All @@ -159,4 +162,11 @@ void QualityManager::setTemporalLayer(int temporal_layer) {
CumulativeStat{static_cast<uint64_t>(temporal_layer_)});
}

void QualityManager::setPadding(bool enabled) {
if (padding_enabled_ != enabled) {
padding_enabled_ = enabled;
getContext()->getPipelineShared()->getService<WebRtcConnection>()->notifyUpdateToHandlers();
}
}

} // namespace erizo
1 change: 1 addition & 0 deletions erizo/src/erizo/rtp/QualityManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class QualityManager: public Service, public std::enable_shared_from_this<Qualit
uint64_t getInstantLayerBitrate(int spatial_layer, int temporal_layer);
bool isInBaseLayer();
bool isInMaxLayer();
void setPadding(bool enabled);


private:
Expand Down

0 comments on commit 1bd84a6

Please sign in to comment.