Fix issues with incorrect wrap checks when having big buffers and high bitrate.

Introduces shared functions for timestamp and sequence number wrap checks.

BUG=1607
TESTS=trybots

Review URL: https://webrtc-codereview.appspot.com/1291005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3833 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/video_coding/main/source/decoding_state.cc b/webrtc/modules/video_coding/main/source/decoding_state.cc
index 74dd005..8147897 100644
--- a/webrtc/modules/video_coding/main/source/decoding_state.cc
+++ b/webrtc/modules/video_coding/main/source/decoding_state.cc
@@ -51,16 +51,14 @@
   assert(frame != NULL);
   if (in_initial_state_)
     return false;
-  return (LatestTimestamp(time_stamp_, frame->TimeStamp(), NULL)
-          == time_stamp_);
+  return !IsNewerTimestamp(frame->TimeStamp(), time_stamp_);
 }
 
 bool VCMDecodingState::IsOldPacket(const VCMPacket* packet) const {
   assert(packet != NULL);
   if (in_initial_state_)
     return false;
-  return (LatestTimestamp(time_stamp_, packet->timestamp, NULL)
-           == time_stamp_);
+  return !IsNewerTimestamp(packet->timestamp, time_stamp_);
 }
 
 void VCMDecodingState::SetState(const VCMFrameBuffer* frame) {
@@ -106,7 +104,7 @@
   if (packet->timestamp == time_stamp_) {
     // Late packet belonging to the last decoded frame - make sure we update the
     // last decoded sequence number.
-    sequence_num_ = LatestSequenceNumber(packet->seqNum, sequence_num_, NULL);
+    sequence_num_ = LatestSequenceNumber(packet->seqNum, sequence_num_);
   }
 }