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

Unified Diff: webrtc/modules/video_coding/sequence_number_util.h

Issue 2985283002: Unwrap picture ids in the RtpFrameReferencerFinder. (Closed)
Patch Set: Feedback Created 3 years, 4 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/sequence_number_util.h
diff --git a/webrtc/modules/video_coding/sequence_number_util.h b/webrtc/modules/video_coding/sequence_number_util.h
index 008e5f1623681145f7714c4ea4cec54b09f2dfb6..05f33676d53bc583b546d3cb30e6bbc3b8b144d6 100644
--- a/webrtc/modules/video_coding/sequence_number_util.h
+++ b/webrtc/modules/video_coding/sequence_number_util.h
@@ -91,7 +91,13 @@ class SeqNumUnwrapper {
"Type unwrapped must be an unsigned integer smaller than uint64_t.");
public:
- SeqNumUnwrapper() : last_unwrapped_(0) {}
+ // We want a value that is close to 2^63 for two reasons. Firstly, we
+ // can unwrap wrapping numbers in either direction, and secondly, we avoid
+ // causing a crash on bad input. We also want the default value to be somewhat
+ // human readable, a power of 10 for example.
+ static constexpr uint64_t kDefaultStartValue = 10000000000000000000UL;
+
+ SeqNumUnwrapper() : last_unwrapped_(kDefaultStartValue) {}
explicit SeqNumUnwrapper(uint64_t start_at) : last_unwrapped_(start_at) {}
uint64_t Unwrap(T value) {

Powered by Google App Engine
This is Rietveld 408576698