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

Unified Diff: webrtc/modules/audio_coding/main/acm2/rent_a_codec.h

Issue 1407383010: Correctly handle the error case where the CodecId has a negative value (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Review fix Created 5 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/main/acm2/rent_a_codec.h
diff --git a/webrtc/modules/audio_coding/main/acm2/rent_a_codec.h b/webrtc/modules/audio_coding/main/acm2/rent_a_codec.h
index 24ae121a478c44f10f339d81afd035c71243029b..50d8c54ab480cfb004810ddecf0fb6ecf13e8fb0 100644
--- a/webrtc/modules/audio_coding/main/acm2/rent_a_codec.h
+++ b/webrtc/modules/audio_coding/main/acm2/rent_a_codec.h
@@ -133,8 +133,8 @@ class RentACodec {
static inline rtc::Maybe<int> CodecIndexFromId(CodecId codec_id) {
const int i = static_cast<int>(codec_id);
- return i < static_cast<int>(NumberOfCodecs()) ? rtc::Maybe<int>(i)
- : rtc::Maybe<int>();
+ return i >= 0 && i < static_cast<int>(NumberOfCodecs()) ? rtc::Maybe<int>(i)
+ : rtc::Maybe<int>();
}
static inline rtc::Maybe<CodecId> CodecIdFromIndex(int codec_index) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698