Index: webrtc/modules/video_coding/codecs/vp8/realtime_temporal_layers.cc |
diff --git a/webrtc/modules/video_coding/codecs/vp8/realtime_temporal_layers.cc b/webrtc/modules/video_coding/codecs/vp8/realtime_temporal_layers.cc |
index a3e65e4ce0d8c159f6ec68ea7bbf407338d4bfc5..7807d45d7aaf70403343d692e9cad9773bde1ede 100644 |
--- a/webrtc/modules/video_coding/codecs/vp8/realtime_temporal_layers.cc |
+++ b/webrtc/modules/video_coding/codecs/vp8/realtime_temporal_layers.cc |
@@ -179,11 +179,11 @@ class RealTimeTemporalLayers : public TemporalLayers { |
uint32_t layer_bitrate = bitrates[i]; |
RTC_DCHECK_LE(sum, bitrates[i]); |
bitrates[i] -= sum; |
- sum += layer_bitrate; |
+ sum = layer_bitrate; |
- if (sum == static_cast<uint32_t>(bitrate_kbps)) { |
+ if (sum >= static_cast<uint32_t>(bitrate_kbps)) { |
// Sum adds up; any subsequent layers will be 0. |
- bitrates.resize(i); |
+ bitrates.resize(i + 1); |
break; |
} |
} |