Delete unused support for vp8 partitions.

This also makes it possible to drop the RTPFragmentationHeader from
the class VCMEncodedFrame.

BUG=None

Review-Url: https://codereview.webrtc.org/2380933003
Cr-Original-Commit-Position: refs/heads/master@{#14455}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 6f112cc136bb8da01434747b6b0d0d56f69f271d
diff --git a/modules/video_coding/codecs/vp8/vp8_impl.cc b/modules/video_coding/codecs/vp8/vp8_impl.cc
index 01b3385..439f6af 100644
--- a/modules/video_coding/codecs/vp8/vp8_impl.cc
+++ b/modules/video_coding/codecs/vp8/vp8_impl.cc
@@ -433,13 +433,7 @@
       // drop support for libvpx 9.6.0.
       break;
     case kResilientFrames:
-#ifdef INDEPENDENT_PARTITIONS
-      configurations_[0] - g_error_resilient =
-          VPX_ERROR_RESILIENT_DEFAULT | VPX_ERROR_RESILIENT_PARTITIONS;
-      break;
-#else
       return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;  // Not supported
-#endif
   }
 
   // rate control settings
@@ -1090,9 +1084,6 @@
 #if !defined(WEBRTC_ARCH_ARM) && !defined(WEBRTC_ARCH_ARM64) && \
   !defined(ANDROID)
   flags = VPX_CODEC_USE_POSTPROC;
-#ifdef INDEPENDENT_PARTITIONS
-  flags |= VPX_CODEC_USE_INPUT_PARTITION;
-#endif
 #endif
 
   if (vpx_codec_dec_init(decoder_, vpx_codec_vp8_dx(), &cfg, flags)) {
@@ -1129,12 +1120,6 @@
     return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
   }
 
-#ifdef INDEPENDENT_PARTITIONS
-  if (fragmentation == NULL) {
-    return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
-  }
-#endif
-
 #if !defined(WEBRTC_ARCH_ARM) && !defined(WEBRTC_ARCH_ARM64) && \
   !defined(ANDROID)
   vp8_postproc_cfg_t ppcfg;
@@ -1194,15 +1179,6 @@
     iter = NULL;
   }
 
-#ifdef INDEPENDENT_PARTITIONS
-  if (DecodePartitions(inputImage, fragmentation)) {
-    // Reset to avoid requesting key frames too often.
-    if (propagation_cnt_ > 0) {
-      propagation_cnt_ = 0;
-    }
-    return WEBRTC_VIDEO_CODEC_ERROR;
-  }
-#else
   uint8_t* buffer = input_image._buffer;
   if (input_image._length == 0) {
     buffer = NULL;  // Triggers full frame concealment.
@@ -1215,7 +1191,6 @@
     }
     return WEBRTC_VIDEO_CODEC_ERROR;
   }
-#endif
 
   img = vpx_codec_get_frame(decoder_, &iter);
   ret = ReturnFrame(img, input_image._timeStamp, input_image.ntp_time_ms_);
@@ -1276,25 +1251,6 @@
   return WEBRTC_VIDEO_CODEC_OK;
 }
 
-int VP8DecoderImpl::DecodePartitions(
-    const EncodedImage& input_image,
-    const RTPFragmentationHeader* fragmentation) {
-  for (int i = 0; i < fragmentation->fragmentationVectorSize; ++i) {
-    const uint8_t* partition =
-        input_image._buffer + fragmentation->fragmentationOffset[i];
-    const uint32_t partition_length = fragmentation->fragmentationLength[i];
-    if (vpx_codec_decode(decoder_, partition, partition_length, 0,
-                         VPX_DL_REALTIME)) {
-      return WEBRTC_VIDEO_CODEC_ERROR;
-    }
-  }
-  // Signal end of frame data. If there was no frame data this will trigger
-  // a full frame concealment.
-  if (vpx_codec_decode(decoder_, NULL, 0, 0, VPX_DL_REALTIME))
-    return WEBRTC_VIDEO_CODEC_ERROR;
-  return WEBRTC_VIDEO_CODEC_OK;
-}
-
 int VP8DecoderImpl::ReturnFrame(const vpx_image_t* img,
                                 uint32_t timestamp,
                                 int64_t ntp_time_ms) {
diff --git a/modules/video_coding/encoded_frame.cc b/modules/video_coding/encoded_frame.cc
index 23e681d..fb12c5b 100644
--- a/modules/video_coding/encoded_frame.cc
+++ b/modules/video_coding/encoded_frame.cc
@@ -21,7 +21,6 @@
       _payloadType(0),
       _missingFrame(false),
       _codec(kVideoCodecUnknown),
-      _fragmentation(),
       _rotation_set(false) {
   _codecSpecificInfo.codecType = kVideoCodecUnknown;
 }
@@ -32,7 +31,6 @@
       _payloadType(0),
       _missingFrame(false),
       _codec(kVideoCodecUnknown),
-      _fragmentation(),
       _rotation_set(false) {
   _codecSpecificInfo.codecType = kVideoCodecUnknown;
   _buffer = NULL;
@@ -52,7 +50,6 @@
       _missingFrame(rhs._missingFrame),
       _codecSpecificInfo(rhs._codecSpecificInfo),
       _codec(rhs._codec),
-      _fragmentation(),
       _rotation_set(rhs._rotation_set) {
   _buffer = NULL;
   _size = 0;
@@ -63,7 +60,6 @@
     memcpy(_buffer, rhs._buffer, rhs._length);
     _length = rhs._length;
   }
-  _fragmentation.CopyFrom(rhs._fragmentation);
 }
 
 VCMEncodedFrame::~VCMEncodedFrame() {
@@ -203,10 +199,6 @@
   }
 }
 
-const RTPFragmentationHeader* VCMEncodedFrame::FragmentationHeader() const {
-  return &_fragmentation;
-}
-
 void VCMEncodedFrame::VerifyAndAllocate(size_t minimumSize) {
   if (minimumSize > _size) {
     // create buffer of sufficient size
diff --git a/modules/video_coding/encoded_frame.h b/modules/video_coding/encoded_frame.h
index 953ab36..840cd20 100644
--- a/modules/video_coding/encoded_frame.h
+++ b/modules/video_coding/encoded_frame.h
@@ -96,8 +96,6 @@
   */
   const CodecSpecificInfo* CodecSpecific() const { return &_codecSpecificInfo; }
 
-  const RTPFragmentationHeader* FragmentationHeader() const;
-
  protected:
   /**
   * Verifies that current allocated buffer size is larger than or equal to the
@@ -118,7 +116,6 @@
   bool _missingFrame;
   CodecSpecificInfo _codecSpecificInfo;
   webrtc::VideoCodecType _codec;
-  RTPFragmentationHeader _fragmentation;
 
   // Video rotation is only set along with the last packet for each frame
   // (same as marker bit). This |_rotation_set| is only for debugging purpose
diff --git a/modules/video_coding/frame_buffer.cc b/modules/video_coding/frame_buffer.cc
index 1c7301f..b332a00 100644
--- a/modules/video_coding/frame_buffer.cc
+++ b/modules/video_coding/frame_buffer.cc
@@ -253,18 +253,8 @@
 }
 
 void VCMFrameBuffer::PrepareForDecode(bool continuous) {
-#ifdef INDEPENDENT_PARTITIONS
-  if (_codec == kVideoCodecVP8) {
-    _length = _sessionInfo.BuildVP8FragmentationHeader(_buffer, _length,
-                                                       &_fragmentation);
-  } else {
-    size_t bytes_removed = _sessionInfo.MakeDecodable();
-    _length -= bytes_removed;
-  }
-#else
   size_t bytes_removed = _sessionInfo.MakeDecodable();
   _length -= bytes_removed;
-#endif
   // Transfer frame information to EncodedFrame and create any codec
   // specific information.
   _frameType = _sessionInfo.FrameType();
diff --git a/modules/video_coding/generic_decoder.cc b/modules/video_coding/generic_decoder.cc
index 38bdb69..ace8266 100644
--- a/modules/video_coding/generic_decoder.cc
+++ b/modules/video_coding/generic_decoder.cc
@@ -149,8 +149,9 @@
     _callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]);
 
     _nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength;
+    const RTPFragmentationHeader dummy_header;
     int32_t ret = _decoder->Decode(frame.EncodedImage(), frame.MissingFrame(),
-                                   frame.FragmentationHeader(),
+                                   &dummy_header,
                                    frame.CodecSpecific(), frame.RenderTimeMs());
 
     _callback->OnDecoderImplementationName(_decoder->ImplementationName());
diff --git a/modules/video_coding/session_info.cc b/modules/video_coding/session_info.cc
index b11f690..8f136ee 100644
--- a/modules/video_coding/session_info.cc
+++ b/modules/video_coding/session_info.cc
@@ -326,53 +326,6 @@
   return bytes_to_delete;
 }
 
-size_t VCMSessionInfo::BuildVP8FragmentationHeader(
-    uint8_t* frame_buffer,
-    size_t frame_buffer_length,
-    RTPFragmentationHeader* fragmentation) {
-  size_t new_length = 0;
-  // Allocate space for max number of partitions
-  fragmentation->VerifyAndAllocateFragmentationHeader(kMaxVP8Partitions);
-  fragmentation->fragmentationVectorSize = 0;
-  memset(fragmentation->fragmentationLength, 0,
-         kMaxVP8Partitions * sizeof(size_t));
-  if (packets_.empty())
-    return new_length;
-  PacketIterator it = FindNextPartitionBeginning(packets_.begin());
-  while (it != packets_.end()) {
-    const int partition_id = (*it).video_header.codecHeader.VP8.partitionId;
-    PacketIterator partition_end = FindPartitionEnd(it);
-    fragmentation->fragmentationOffset[partition_id] =
-        (*it).dataPtr - frame_buffer;
-    assert(fragmentation->fragmentationOffset[partition_id] <
-           frame_buffer_length);
-    fragmentation->fragmentationLength[partition_id] =
-        (*partition_end).dataPtr + (*partition_end).sizeBytes - (*it).dataPtr;
-    assert(fragmentation->fragmentationLength[partition_id] <=
-           frame_buffer_length);
-    new_length += fragmentation->fragmentationLength[partition_id];
-    ++partition_end;
-    it = FindNextPartitionBeginning(partition_end);
-    if (partition_id + 1 > fragmentation->fragmentationVectorSize)
-      fragmentation->fragmentationVectorSize = partition_id + 1;
-  }
-  // Set all empty fragments to start where the previous fragment ends,
-  // and have zero length.
-  if (fragmentation->fragmentationLength[0] == 0)
-    fragmentation->fragmentationOffset[0] = 0;
-  for (int i = 1; i < fragmentation->fragmentationVectorSize; ++i) {
-    if (fragmentation->fragmentationLength[i] == 0)
-      fragmentation->fragmentationOffset[i] =
-          fragmentation->fragmentationOffset[i - 1] +
-          fragmentation->fragmentationLength[i - 1];
-    assert(i == 0 ||
-           fragmentation->fragmentationOffset[i] >=
-               fragmentation->fragmentationOffset[i - 1]);
-  }
-  assert(new_length <= frame_buffer_length);
-  return new_length;
-}
-
 VCMSessionInfo::PacketIterator VCMSessionInfo::FindNextPartitionBeginning(
     PacketIterator it) const {
   while (it != packets_.end()) {
diff --git a/modules/video_coding/session_info.h b/modules/video_coding/session_info.h
index e9ff251..c2de1ac 100644
--- a/modules/video_coding/session_info.h
+++ b/modules/video_coding/session_info.h
@@ -53,13 +53,6 @@
   bool complete() const;
   bool decodable() const;
 
-  // Builds fragmentation headers for VP8, each fragment being a decodable
-  // VP8 partition. Returns the total number of bytes which are decodable. Is
-  // used instead of MakeDecodable for VP8.
-  size_t BuildVP8FragmentationHeader(uint8_t* frame_buffer,
-                                     size_t frame_buffer_length,
-                                     RTPFragmentationHeader* fragmentation);
-
   // Makes the frame decodable. I.e., only contain decodable NALUs. All
   // non-decodable NALUs will be deleted and packets will be moved to in
   // memory to remove any empty space.
diff --git a/modules/video_coding/session_info_unittest.cc b/modules/video_coding/session_info_unittest.cc
index 2cdc25f..25d359a 100644
--- a/modules/video_coding/session_info_unittest.cc
+++ b/modules/video_coding/session_info_unittest.cc
@@ -61,39 +61,6 @@
   FrameData frame_data;
 };
 
-class TestVP8Partitions : public TestSessionInfo {
- protected:
-  enum { kMaxVP8Partitions = 9 };
-
-  virtual void SetUp() {
-    TestSessionInfo::SetUp();
-    vp8_header_ = &packet_header_.type.Video.codecHeader.VP8;
-    packet_header_.frameType = kVideoFrameDelta;
-    packet_header_.type.Video.codec = kRtpVideoVp8;
-    vp8_header_->InitRTPVideoHeaderVP8();
-    fragmentation_.VerifyAndAllocateFragmentationHeader(kMaxVP8Partitions);
-  }
-
-  bool VerifyPartition(int partition_id,
-                       int packets_expected,
-                       int start_value) {
-    EXPECT_EQ(packets_expected * packet_buffer_size(),
-              fragmentation_.fragmentationLength[partition_id]);
-    for (int i = 0; i < packets_expected; ++i) {
-      size_t packet_index = fragmentation_.fragmentationOffset[partition_id] +
-                            i * packet_buffer_size();
-      if (packet_index + packet_buffer_size() > frame_buffer_size())
-        return false;
-      VerifyPacket(frame_buffer_ + packet_index, start_value + i);
-    }
-    return true;
-  }
-
-  WebRtcRTPHeader packet_header_;
-  RTPVideoHeaderVP8* vp8_header_;
-  RTPFragmentationHeader fragmentation_;
-};
-
 class TestNalUnits : public TestSessionInfo {
  protected:
   virtual void SetUp() {
@@ -416,443 +383,6 @@
       -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
 }
 
-TEST_F(TestVP8Partitions, TwoPartitionsOneLoss) {
-  // Partition 0 | Partition 1
-  // [ 0 ] [ 2 ] | [ 3 ]
-  packet_header_.type.Video.isFirstPacket = true;
-  vp8_header_->beginningOfPartition = true;
-  vp8_header_->partitionId = 0;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber = 0;
-  FillPacket(0);
-  VCMPacket* packet =
-      new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 0;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 2;
-  FillPacket(2);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 1;
-  vp8_header_->beginningOfPartition = true;
-  packet_header_.header.markerBit = true;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(3);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  // One packet should be removed (end of partition 0).
-  EXPECT_EQ(2 * packet_buffer_size(),
-            session_.BuildVP8FragmentationHeader(
-                frame_buffer_, frame_buffer_size(), &fragmentation_));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(0, 1, 0));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(1, 1, 3));
-}
-
-TEST_F(TestVP8Partitions, TwoPartitionsOneLoss2) {
-  // Partition 0 | Partition 1
-  // [ 1 ] [ 2 ] | [ 3 ] [ 5 ]
-  packet_header_.type.Video.isFirstPacket = true;
-  vp8_header_->beginningOfPartition = true;
-  vp8_header_->partitionId = 0;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber = 1;
-  FillPacket(1);
-  VCMPacket* packet =
-      new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 0;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(2);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 1;
-  vp8_header_->beginningOfPartition = true;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(3);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 1;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = true;
-  packet_header_.header.sequenceNumber += 2;
-  FillPacket(5);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  // One packet should be removed (end of partition 2), 3 left.
-  EXPECT_EQ(3 * packet_buffer_size(),
-            session_.BuildVP8FragmentationHeader(
-                frame_buffer_, frame_buffer_size(), &fragmentation_));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(0, 2, 1));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(1, 1, 3));
-}
-
-TEST_F(TestVP8Partitions, TwoPartitionsNoLossWrap) {
-  // Partition 0       | Partition 1
-  // [ fffd ] [ fffe ] | [ ffff ] [ 0 ]
-  packet_header_.type.Video.isFirstPacket = true;
-  vp8_header_->beginningOfPartition = true;
-  vp8_header_->partitionId = 0;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber = 0xfffd;
-  FillPacket(0);
-  VCMPacket* packet =
-      new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 0;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(1);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 1;
-  vp8_header_->beginningOfPartition = true;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(2);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 1;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = true;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(3);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  // No packet should be removed.
-  EXPECT_EQ(4 * packet_buffer_size(),
-            session_.BuildVP8FragmentationHeader(
-                frame_buffer_, frame_buffer_size(), &fragmentation_));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(0, 2, 0));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(1, 2, 2));
-}
-
-TEST_F(TestVP8Partitions, TwoPartitionsLossWrap) {
-  // Partition 0       | Partition 1
-  // [ fffd ] [ fffe ] | [ ffff ] [ 1 ]
-  packet_header_.type.Video.isFirstPacket = true;
-  vp8_header_->beginningOfPartition = true;
-  vp8_header_->partitionId = 0;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber = 0xfffd;
-  FillPacket(0);
-  VCMPacket* packet =
-      new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 0;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(1);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 1;
-  vp8_header_->beginningOfPartition = true;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(2);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 1;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = true;
-  packet_header_.header.sequenceNumber += 2;
-  FillPacket(3);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  // One packet should be removed from the last partition
-  EXPECT_EQ(3 * packet_buffer_size(),
-            session_.BuildVP8FragmentationHeader(
-                frame_buffer_, frame_buffer_size(), &fragmentation_));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(0, 2, 0));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(1, 1, 2));
-}
-
-TEST_F(TestVP8Partitions, ThreePartitionsOneMissing) {
-  // Partition 1  |Partition 2    | Partition 3
-  // [ 1 ] [ 2 ]  |               | [ 5 ] | [ 6 ]
-  packet_header_.type.Video.isFirstPacket = true;
-  vp8_header_->beginningOfPartition = true;
-  vp8_header_->partitionId = 0;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber = 1;
-  FillPacket(1);
-  VCMPacket* packet =
-      new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 0;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(2);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 2;
-  vp8_header_->beginningOfPartition = true;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 3;
-  FillPacket(5);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 2;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = true;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(6);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  // No packet should be removed.
-  EXPECT_EQ(4 * packet_buffer_size(),
-            session_.BuildVP8FragmentationHeader(
-                frame_buffer_, frame_buffer_size(), &fragmentation_));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(0, 2, 1));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(2, 2, 5));
-}
-
-TEST_F(TestVP8Partitions, ThreePartitionsLossInSecond) {
-  // Partition 0  |Partition 1          | Partition 2
-  // [ 1 ] [ 2 ]  |        [ 4 ] [ 5 ]  | [ 6 ] [ 7 ]
-  packet_header_.type.Video.isFirstPacket = true;
-  vp8_header_->beginningOfPartition = true;
-  vp8_header_->partitionId = 0;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber = 1;
-  FillPacket(1);
-  VCMPacket* packet =
-      new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 0;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(2);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 1;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 2;
-  FillPacket(4);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 1;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(5);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 2;
-  vp8_header_->beginningOfPartition = true;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(6);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 2;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = true;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(7);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  // 2 partitions left. 2 packets removed from second partition
-  EXPECT_EQ(4 * packet_buffer_size(),
-            session_.BuildVP8FragmentationHeader(
-                frame_buffer_, frame_buffer_size(), &fragmentation_));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(0, 2, 1));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(2, 2, 6));
-}
-
-TEST_F(TestVP8Partitions, AggregationOverTwoPackets) {
-  // Partition 0   | Partition 1         | Partition 2
-  // [ 0           |           ]  [ 1 ]  | [ 2 ]
-  packet_header_.type.Video.isFirstPacket = true;
-  vp8_header_->beginningOfPartition = true;
-  vp8_header_->partitionId = 0;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber = 0;
-  FillPacket(0);
-  VCMPacket* packet =
-      new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 1;
-  vp8_header_->beginningOfPartition = false;
-  packet_header_.header.markerBit = false;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(1);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  packet_header_.type.Video.isFirstPacket = false;
-  vp8_header_->partitionId = 2;
-  vp8_header_->beginningOfPartition = true;
-  packet_header_.header.markerBit = true;
-  packet_header_.header.sequenceNumber += 1;
-  FillPacket(2);
-  packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
-  EXPECT_EQ(packet_buffer_size(),
-            static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
-                                                      kNoErrors, frame_data)));
-  delete packet;
-
-  // No packets removed.
-  EXPECT_EQ(3 * packet_buffer_size(),
-            session_.BuildVP8FragmentationHeader(
-                frame_buffer_, frame_buffer_size(), &fragmentation_));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(0, 2, 0));
-  // This partition is aggregated in partition 0
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(1, 0, 0));
-  SCOPED_TRACE("Calling VerifyPartition");
-  EXPECT_TRUE(VerifyPartition(2, 1, 2));
-}
-
 TEST_F(TestNalUnits, OnlyReceivedEmptyPacket) {
   packet_.isFirstPacket = false;
   packet_.completeNALU = kNaluComplete;