Reject re-inserting already decoded frames into FrameBuffer2.

BUG=webrtc:7518

Review-Url: https://codereview.webrtc.org/2842133002
Cr-Commit-Position: refs/heads/master@{#17925}
diff --git a/webrtc/modules/video_coding/frame_buffer2.cc b/webrtc/modules/video_coding/frame_buffer2.cc
index 280dc5a..4dcea53 100644
--- a/webrtc/modules/video_coding/frame_buffer2.cc
+++ b/webrtc/modules/video_coding/frame_buffer2.cc
@@ -237,7 +237,7 @@
   }
 
   if (last_decoded_frame_it_ != frames_.end() &&
-      key < last_decoded_frame_it_->first) {
+      key <= last_decoded_frame_it_->first) {
     if (AheadOf(frame->timestamp, last_decoded_frame_timestamp_) &&
         frame->num_references == 0) {
       // If this frame has a newer timestamp but an earlier picture id then we
diff --git a/webrtc/modules/video_coding/frame_buffer2_unittest.cc b/webrtc/modules/video_coding/frame_buffer2_unittest.cc
index 04ce559..4f1c636 100644
--- a/webrtc/modules/video_coding/frame_buffer2_unittest.cc
+++ b/webrtc/modules/video_coding/frame_buffer2_unittest.cc
@@ -516,5 +516,11 @@
   ExtractFrame();
 }
 
+TEST_F(TestFrameBuffer2, DuplicateFrames) {
+  EXPECT_EQ(22256, InsertFrame(22256, 0, 1, false));
+  ExtractFrame();
+  EXPECT_EQ(22256, InsertFrame(22256, 0, 1, false));
+}
+
 }  // namespace video_coding
 }  // namespace webrtc