Removed _completeFrame since we never allow incomplete frames.

In the old jitter buffer the two VCMVideoProtection modes |kProtectionNone| and |kProtectionFEC| could be set on the jitter buffer for it to not wait for NACK and instead generate incomplete frames. This has not been possible for a long time.

Bug: webrtc:9378, webrtc:7408
Change-Id: I0a2d3ec34d721126c1128306d5fad88314f8d59f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190680
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32513}
diff --git a/modules/video_coding/codecs/av1/libaom_av1_encoder.cc b/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
index 6216b9b..272824a 100644
--- a/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
+++ b/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
@@ -482,7 +482,6 @@
 
     // Get encoded image data.
     EncodedImage encoded_image;
-    encoded_image._completeFrame = true;
     aom_codec_iter_t iter = nullptr;
     int data_pkt_count = 0;
     while (const aom_codec_cx_pkt_t* pkt =
diff --git a/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/modules/video_coding/codecs/h264/h264_encoder_impl.cc
index 9486394..ea784c1 100644
--- a/modules/video_coding/codecs/h264/h264_encoder_impl.cc
+++ b/modules/video_coding/codecs/h264/h264_encoder_impl.cc
@@ -275,7 +275,6 @@
         CalcBufferSize(VideoType::kI420, codec_.simulcastStream[idx].width,
                        codec_.simulcastStream[idx].height);
     encoded_images_[i].SetEncodedData(EncodedImageBuffer::Create(new_capacity));
-    encoded_images_[i]._completeFrame = true;
     encoded_images_[i]._encodedWidth = codec_.simulcastStream[idx].width;
     encoded_images_[i]._encodedHeight = codec_.simulcastStream[idx].height;
     encoded_images_[i].set_size(0);
diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc
index fece445..af48c92 100644
--- a/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc
+++ b/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc
@@ -240,21 +240,14 @@
   if (key_frame_required_) {
     if (input_image._frameType != VideoFrameType::kVideoFrameKey)
       return WEBRTC_VIDEO_CODEC_ERROR;
-    // We have a key frame - is it complete?
-    if (input_image._completeFrame) {
-      key_frame_required_ = false;
-    } else {
-      return WEBRTC_VIDEO_CODEC_ERROR;
-    }
+    key_frame_required_ = false;
   }
   // Restrict error propagation using key frame requests.
   // Reset on a key frame refresh.
-  if (input_image._frameType == VideoFrameType::kVideoFrameKey &&
-      input_image._completeFrame) {
+  if (input_image._frameType == VideoFrameType::kVideoFrameKey) {
     propagation_cnt_ = -1;
     // Start count on first loss.
-  } else if ((!input_image._completeFrame || missing_frames) &&
-             propagation_cnt_ == -1) {
+  } else if (missing_frames && propagation_cnt_ == -1) {
     propagation_cnt_ = 0;
   }
   if (propagation_cnt_ >= 0) {
diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
index e5fef54..3408176 100644
--- a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
+++ b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
@@ -488,9 +488,7 @@
     downsampling_factors_[number_of_streams - 1].num = 1;
     downsampling_factors_[number_of_streams - 1].den = 1;
   }
-  for (int i = 0; i < number_of_streams; ++i) {
-    encoded_images_[i]._completeFrame = true;
-  }
+
   // populate encoder configuration with default values
   if (libvpx_->codec_enc_config_default(vpx_codec_vp8_cx(), &vpx_configs_[0],
                                         0)) {
diff --git a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc
index 3d04bb1..f22b917 100644
--- a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc
+++ b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc
@@ -376,36 +376,6 @@
   EXPECT_EQ(kInitialTimestampRtp, decoded_frame->timestamp());
 }
 
-#if defined(WEBRTC_ANDROID)
-#define MAYBE_DecodeWithACompleteKeyFrame DISABLED_DecodeWithACompleteKeyFrame
-#else
-#define MAYBE_DecodeWithACompleteKeyFrame DecodeWithACompleteKeyFrame
-#endif
-TEST_F(TestVp8Impl, MAYBE_DecodeWithACompleteKeyFrame) {
-  VideoFrame input_frame = NextInputFrame();
-  EncodedImage encoded_frame;
-  CodecSpecificInfo codec_specific_info;
-  EncodeAndWaitForFrame(input_frame, &encoded_frame, &codec_specific_info);
-
-  // Setting complete to false -> should return an error.
-  encoded_frame._completeFrame = false;
-  EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR,
-            decoder_->Decode(encoded_frame, false, -1));
-  // Setting complete back to true. Forcing a delta frame.
-  encoded_frame._frameType = VideoFrameType::kVideoFrameDelta;
-  encoded_frame._completeFrame = true;
-  EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR,
-            decoder_->Decode(encoded_frame, false, -1));
-  // Now setting a key frame.
-  encoded_frame._frameType = VideoFrameType::kVideoFrameKey;
-  EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Decode(encoded_frame, false, -1));
-  std::unique_ptr<VideoFrame> decoded_frame;
-  absl::optional<uint8_t> decoded_qp;
-  ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
-  ASSERT_TRUE(decoded_frame);
-  EXPECT_GT(I420PSNR(&input_frame, decoded_frame.get()), 36);
-}
-
 TEST_F(TestVp8Impl, EncoderWith2TemporalLayers) {
   codec_settings_.VP8()->numberOfTemporalLayers = 2;
   EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
diff --git a/modules/video_coding/codecs/vp9/vp9_impl.cc b/modules/video_coding/codecs/vp9/vp9_impl.cc
index 4024baa..5d7d7bc 100644
--- a/modules/video_coding/codecs/vp9/vp9_impl.cc
+++ b/modules/video_coding/codecs/vp9/vp9_impl.cc
@@ -589,7 +589,6 @@
 
   is_svc_ = (num_spatial_layers_ > 1 || num_temporal_layers_ > 1);
 
-  encoded_image_._completeFrame = true;
   // Populate encoder configuration with default values.
   if (vpx_codec_enc_config_default(vpx_codec_vp9_cx(), config_, 0)) {
     return WEBRTC_VIDEO_CODEC_ERROR;
@@ -1989,12 +1988,7 @@
   if (key_frame_required_) {
     if (input_image._frameType != VideoFrameType::kVideoFrameKey)
       return WEBRTC_VIDEO_CODEC_ERROR;
-    // We have a key frame - is it complete?
-    if (input_image._completeFrame) {
-      key_frame_required_ = false;
-    } else {
-      return WEBRTC_VIDEO_CODEC_ERROR;
-    }
+    key_frame_required_ = false;
   }
   vpx_codec_iter_t iter = nullptr;
   vpx_image_t* img;
diff --git a/modules/video_coding/encoded_frame.cc b/modules/video_coding/encoded_frame.cc
index 3de62da..f7d666b 100644
--- a/modules/video_coding/encoded_frame.cc
+++ b/modules/video_coding/encoded_frame.cc
@@ -43,7 +43,6 @@
   _frameType = VideoFrameType::kVideoFrameDelta;
   _encodedWidth = 0;
   _encodedHeight = 0;
-  _completeFrame = false;
   _missingFrame = false;
   set_size(0);
   _codecSpecificInfo.codecType = kVideoCodecGeneric;
diff --git a/modules/video_coding/encoded_frame.h b/modules/video_coding/encoded_frame.h
index ddab6ce..a77d42e 100644
--- a/modules/video_coding/encoded_frame.h
+++ b/modules/video_coding/encoded_frame.h
@@ -93,10 +93,6 @@
   EncodedImage::Timing video_timing() const { return timing_; }
   EncodedImage::Timing* video_timing_mutable() { return &timing_; }
   /**
-   *   True if this frame is complete, false otherwise
-   */
-  bool Complete() const { return _completeFrame; }
-  /**
    *   True if there's a frame missing before this frame
    */
   bool MissingFrame() const { return _missingFrame; }
diff --git a/modules/video_coding/frame_buffer.cc b/modules/video_coding/frame_buffer.cc
index 09c2733..0f64ab1 100644
--- a/modules/video_coding/frame_buffer.cc
+++ b/modules/video_coding/frame_buffer.cc
@@ -70,11 +70,6 @@
       gof_info.temporal_up_switch[idx];
 }
 
-bool VCMFrameBuffer::IsSessionComplete() const {
-  TRACE_EVENT0("webrtc", "VCMFrameBuffer::IsSessionComplete");
-  return _sessionInfo.complete();
-}
-
 // Insert packet
 VCMFrameBufferEnum VCMFrameBuffer::InsertPacket(const VCMPacket& packet,
                                                 int64_t timeInMs,
@@ -265,7 +260,6 @@
   // Transfer frame information to EncodedFrame and create any codec
   // specific information.
   _frameType = _sessionInfo.FrameType();
-  _completeFrame = _sessionInfo.complete();
   _missingFrame = !continuous;
 }
 
diff --git a/modules/video_coding/frame_object.cc b/modules/video_coding/frame_object.cc
index d58aa10..25fd232 100644
--- a/modules/video_coding/frame_object.cc
+++ b/modules/video_coding/frame_object.cc
@@ -51,7 +51,6 @@
   // TODO(philipel): Remove when encoded image is replaced by EncodedFrame.
   // VCMEncodedFrame members
   CopyCodecSpecific(&rtp_video_header_);
-  _completeFrame = true;
   _payloadType = payload_type;
   SetTimestamp(rtp_timestamp);
   ntp_time_ms_ = ntp_time_ms;
diff --git a/modules/video_coding/include/video_coding_defines.h b/modules/video_coding/include/video_coding_defines.h
index ff9b7d6..641e712 100644
--- a/modules/video_coding/include/video_coding_defines.h
+++ b/modules/video_coding/include/video_coding_defines.h
@@ -41,9 +41,7 @@
 };
 
 enum VCMVideoProtection {
-  kProtectionNone,
   kProtectionNack,
-  kProtectionFEC,
   kProtectionNackFEC,
 };
 
diff --git a/modules/video_coding/jitter_buffer.cc b/modules/video_coding/jitter_buffer.cc
index 9d2d3a2..772098a 100644
--- a/modules/video_coding/jitter_buffer.cc
+++ b/modules/video_coding/jitter_buffer.cc
@@ -298,8 +298,7 @@
   last_decoded_state_.SetState(frame);
   DropPacketsFromNackList(last_decoded_state_.sequence_num());
 
-  if ((*frame).IsSessionComplete())
-    UpdateAveragePacketsPerFrame(frame->NumPackets());
+  UpdateAveragePacketsPerFrame(frame->NumPackets());
 
   return frame;
 }
diff --git a/modules/video_coding/receiver.cc b/modules/video_coding/receiver.cc
index 2db4e21..6b942fb 100644
--- a/modules/video_coding/receiver.cc
+++ b/modules/video_coding/receiver.cc
@@ -161,18 +161,6 @@
   frame->SetRenderTime(render_time_ms);
   TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", frame->Timestamp(), "SetRenderTS",
                           "render_time", frame->RenderTimeMs());
-  if (!frame->Complete()) {
-    // Update stats for incomplete frames.
-    bool retransmitted = false;
-    const int64_t last_packet_time_ms =
-        jitter_buffer_.LastPacketTime(frame, &retransmitted);
-    if (last_packet_time_ms >= 0 && !retransmitted) {
-      // We don't want to include timestamps which have suffered from
-      // retransmission here, since we compensate with extra retransmission
-      // delay within the jitter estimate.
-      timing_->IncomingTimestamp(frame_timestamp, last_packet_time_ms);
-    }
-  }
   return frame;
 }
 
diff --git a/modules/video_coding/utility/ivf_file_reader.cc b/modules/video_coding/utility/ivf_file_reader.cc
index 27af52f..e3c2499 100644
--- a/modules/video_coding/utility/ivf_file_reader.cc
+++ b/modules/video_coding/utility/ivf_file_reader.cc
@@ -171,7 +171,6 @@
   if (is_first_frame) {
     image._frameType = VideoFrameType::kVideoFrameKey;
   }
-  image._completeFrame = true;
 
   return image;
 }
diff --git a/modules/video_coding/utility/simulcast_test_fixture_impl.cc b/modules/video_coding/utility/simulcast_test_fixture_impl.cc
index e262d0f..a9af643 100644
--- a/modules/video_coding/utility/simulcast_test_fixture_impl.cc
+++ b/modules/video_coding/utility/simulcast_test_fixture_impl.cc
@@ -84,7 +84,6 @@
         encoded_key_frame_.SetEncodedData(EncodedImageBuffer::Create(
             encoded_image.data(), encoded_image.size()));
         encoded_key_frame_._frameType = VideoFrameType::kVideoFrameKey;
-        encoded_key_frame_._completeFrame = encoded_image._completeFrame;
       } else {
         encoded_frame_.SetEncodedData(EncodedImageBuffer::Create(
             encoded_image.data(), encoded_image.size()));
@@ -869,7 +868,6 @@
             encoded_frame[index].SetEncodedData(EncodedImageBuffer::Create(
                 encoded_image.data(), encoded_image.size()));
             encoded_frame[index]._frameType = encoded_image._frameType;
-            encoded_frame[index]._completeFrame = encoded_image._completeFrame;
             return EncodedImageCallback::Result(
                 EncodedImageCallback::Result::OK, 0);
           }));
diff --git a/modules/video_coding/video_receiver.cc b/modules/video_coding/video_receiver.cc
index 1f3f673..c2c8f8a 100644
--- a/modules/video_coding/video_receiver.cc
+++ b/modules/video_coding/video_receiver.cc
@@ -208,9 +208,7 @@
                               clock_->TimeInMilliseconds());
 
   if (first_frame_received_()) {
-    RTC_LOG(LS_INFO) << "Received first "
-                     << (frame->Complete() ? "complete" : "incomplete")
-                     << " decodable video frame";
+    RTC_LOG(LS_INFO) << "Received first complete decodable video frame";
   }
 
   const int32_t ret = Decode(*frame);