Validate references of frames inserted into FrameBuffer2.

BUG=chromium:730603

Review-Url: https://codereview.webrtc.org/2937243002
Cr-Commit-Position: refs/heads/master@{#18614}
diff --git a/webrtc/modules/video_coding/frame_buffer2.h b/webrtc/modules/video_coding/frame_buffer2.h
index 6ce3b4b..ffeb2aa 100644
--- a/webrtc/modules/video_coding/frame_buffer2.h
+++ b/webrtc/modules/video_coding/frame_buffer2.h
@@ -97,6 +97,8 @@
 
     // Which other frames that have direct unfulfilled dependencies
     // on this frame.
+    // TODO(philipel): Add simple modify/access functions to prevent adding too
+    // many |dependent_frames|.
     FrameKey dependent_frames[kMaxNumDependentFrames];
     size_t num_dependent_frames = 0;
 
@@ -120,6 +122,9 @@
 
   using FrameMap = std::map<FrameKey, FrameInfo>;
 
+  // Check that the references of |frame| are valid.
+  bool ValidReferences(const FrameObject& frame) const;
+
   // Updates the minimal and maximal playout delays
   // depending on the frame.
   void UpdatePlayoutDelays(const FrameObject& frame)