Index: webrtc/modules/audio_coding/neteq/audio_vector.h |
diff --git a/webrtc/modules/audio_coding/neteq/audio_vector.h b/webrtc/modules/audio_coding/neteq/audio_vector.h |
index 9100ff896893ebd43e53b7dbb4cfede2f10b48e5..57e01ab2e1290b64f2df40c3e7ac473690fb5cd5 100644 |
--- a/webrtc/modules/audio_coding/neteq/audio_vector.h |
+++ b/webrtc/modules/audio_coding/neteq/audio_vector.h |
@@ -127,9 +127,13 @@ class AudioVector { |
static inline size_t WrapIndex(size_t index, |
size_t begin_index, |
size_t capacity) { |
- RTC_DCHECK_GE(begin_index + index, index); // Check for overflow. |
- const size_t ix = |
- begin_index + index - (begin_index + index >= capacity ? capacity : 0); |
+ RTC_DCHECK_LT(index, capacity); |
+ RTC_DCHECK_LT(begin_index, capacity); |
+ size_t ix = begin_index + index; |
+ RTC_DCHECK_GE(ix, index); // Check for overflow. |
nisse-webrtc
2017/02/22 07:48:40
Given above DCHECKS, this could fail only if capac
kwiberg-webrtc
2017/02/22 08:25:48
Aha. The two DCHECKs on line 130 and 131 guarantee
|
+ if (ix >= capacity) { |
+ ix -= capacity; |
+ } |
RTC_DCHECK_LT(ix, capacity); |
return ix; |
} |