Deprecate VideoDecoder::Reset() and remove calls.

Removes calls to decoder reset and instead drops delta frames and
requests keyframes until one arrives.

BUG=webrtc:5475
R=stefan@webrtc.org
TBR=mflodman@webrtc.org

Review URL: https://codereview.webrtc.org/1647163002 .

Cr-Commit-Position: refs/heads/master@{#11460}
diff --git a/webrtc/modules/video_coding/video_receiver.cc b/webrtc/modules/video_coding/video_receiver.cc
index 02c0da8..02d51a7 100644
--- a/webrtc/modules/video_coding/video_receiver.cc
+++ b/webrtc/modules/video_coding/video_receiver.cc
@@ -43,9 +43,10 @@
 #endif
       _frameFromFile(),
       _scheduleKeyRequest(false),
+      drop_frames_until_keyframe_(false),
       max_nack_list_size_(0),
-      pre_decode_image_callback_(NULL),
       _codecDataBase(nullptr, nullptr),
+      pre_decode_image_callback_(NULL),
       _receiveStatsTimer(1000, clock_),
       _retransmissionTimer(10, clock_),
       _keyRequestTimer(500, clock_) {
@@ -282,6 +283,19 @@
   if (!frame)
     return VCM_FRAME_NOT_READY;
 
+  {
+    CriticalSectionScoped cs(process_crit_sect_.get());
+    if (drop_frames_until_keyframe_) {
+      // Still getting delta frames, schedule another keyframe request as if
+      // decode failed.
+      if (frame->FrameType() != kVideoFrameKey) {
+        _scheduleKeyRequest = true;
+        _receiver.ReleaseFrame(frame);
+        return VCM_FRAME_NOT_READY;
+      }
+      drop_frames_until_keyframe_ = false;
+    }
+  }
   CriticalSectionScoped cs(_receiveCritSect);
 
   // If this frame was too late, we should adjust the delay accordingly
@@ -380,25 +394,6 @@
   return ret;
 }
 
-// Reset the decoder state
-int32_t VideoReceiver::ResetDecoder() {
-  bool reset_key_request = false;
-  {
-    CriticalSectionScoped cs(_receiveCritSect);
-    if (_decoder != NULL) {
-      _receiver.Reset();
-      _timing.Reset();
-      reset_key_request = true;
-      _decoder->Reset();
-    }
-  }
-  if (reset_key_request) {
-    CriticalSectionScoped cs(process_crit_sect_.get());
-    _scheduleKeyRequest = false;
-  }
-  return VCM_OK;
-}
-
 // Register possible receive codecs, can be called multiple times
 int32_t VideoReceiver::RegisterReceiveCodec(const VideoCodec* receiveCodec,
                                             int32_t numberOfCores,
@@ -449,8 +444,11 @@
   // TODO(holmer): Investigate if this somehow should use the key frame
   // request scheduling to throttle the requests.
   if (ret == VCM_FLUSH_INDICATOR) {
+    {
+      CriticalSectionScoped process_cs(process_crit_sect_.get());
+      drop_frames_until_keyframe_ = true;
+    }
     RequestKeyFrame();
-    ResetDecoder();
   } else if (ret < 0) {
     return ret;
   }