Reland of Deprecate VCMPacketizationCallback::SendData and use EncodedImageCallback instead. (patchset #1 id:1 of https://codereview.webrtc.org/1903193002/ )

Reason for revert:
A fix is being prepared downstream so this can now go in.

Original issue's description:
> Revert of Deprecate VCMPacketizationCallback::SendData and use EncodedImageCallback instead. (patchset #5 id:80001 of https://codereview.webrtc.org/1897233002/ )
>
> Reason for revert:
> API changes broke downstream.
>
> Original issue's description:
> > Deprecate VCMPacketizationCallback::SendData and use EncodedImageCallback instead.
> > EncodedImageCallback is used by all encoder implementations and seems to be what we should try to use in the transport.
> > EncodedImageCallback can of course be cleaned up in the future.
> >
> > This moves creation of RTPVideoHeader from the GenericEncoder to the PayLoadRouter.
> >
> > BUG=webrtc::5687
> >
> > Committed: https://crrev.com/f5d55aaecdc39e9cc66eb6e87614f04afe28f6eb
> > Cr-Commit-Position: refs/heads/master@{#12436}
>
> TBR=stefan@webrtc.org,pbos@webrtc.org,perkj@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5687
>
> Committed: https://crrev.com/a261e6136655af33f283eda8e60a6dd93dd746a4
> Cr-Commit-Position: refs/heads/master@{#12441}

TBR=stefan@webrtc.org,pbos@webrtc.org,perkj@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5687

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

Cr-Commit-Position: refs/heads/master@{#12442}
diff --git a/webrtc/modules/video_coding/generic_encoder.cc b/webrtc/modules/video_coding/generic_encoder.cc
index 9a3d2ff..321deb0 100644
--- a/webrtc/modules/video_coding/generic_encoder.cc
+++ b/webrtc/modules/video_coding/generic_encoder.cc
@@ -21,76 +21,6 @@
 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
 
 namespace webrtc {
-namespace {
-// Map information from info into rtp. If no relevant information is found
-// in info, rtp is set to NULL.
-void CopyCodecSpecific(const CodecSpecificInfo* info, RTPVideoHeader* rtp) {
-  RTC_DCHECK(info);
-  switch (info->codecType) {
-    case kVideoCodecVP8: {
-      rtp->codec = kRtpVideoVp8;
-      rtp->codecHeader.VP8.InitRTPVideoHeaderVP8();
-      rtp->codecHeader.VP8.pictureId = info->codecSpecific.VP8.pictureId;
-      rtp->codecHeader.VP8.nonReference = info->codecSpecific.VP8.nonReference;
-      rtp->codecHeader.VP8.temporalIdx = info->codecSpecific.VP8.temporalIdx;
-      rtp->codecHeader.VP8.layerSync = info->codecSpecific.VP8.layerSync;
-      rtp->codecHeader.VP8.tl0PicIdx = info->codecSpecific.VP8.tl0PicIdx;
-      rtp->codecHeader.VP8.keyIdx = info->codecSpecific.VP8.keyIdx;
-      rtp->simulcastIdx = info->codecSpecific.VP8.simulcastIdx;
-      return;
-    }
-    case kVideoCodecVP9: {
-      rtp->codec = kRtpVideoVp9;
-      rtp->codecHeader.VP9.InitRTPVideoHeaderVP9();
-      rtp->codecHeader.VP9.inter_pic_predicted =
-          info->codecSpecific.VP9.inter_pic_predicted;
-      rtp->codecHeader.VP9.flexible_mode =
-          info->codecSpecific.VP9.flexible_mode;
-      rtp->codecHeader.VP9.ss_data_available =
-          info->codecSpecific.VP9.ss_data_available;
-      rtp->codecHeader.VP9.picture_id = info->codecSpecific.VP9.picture_id;
-      rtp->codecHeader.VP9.tl0_pic_idx = info->codecSpecific.VP9.tl0_pic_idx;
-      rtp->codecHeader.VP9.temporal_idx = info->codecSpecific.VP9.temporal_idx;
-      rtp->codecHeader.VP9.spatial_idx = info->codecSpecific.VP9.spatial_idx;
-      rtp->codecHeader.VP9.temporal_up_switch =
-          info->codecSpecific.VP9.temporal_up_switch;
-      rtp->codecHeader.VP9.inter_layer_predicted =
-          info->codecSpecific.VP9.inter_layer_predicted;
-      rtp->codecHeader.VP9.gof_idx = info->codecSpecific.VP9.gof_idx;
-      rtp->codecHeader.VP9.num_spatial_layers =
-          info->codecSpecific.VP9.num_spatial_layers;
-
-      if (info->codecSpecific.VP9.ss_data_available) {
-        rtp->codecHeader.VP9.spatial_layer_resolution_present =
-            info->codecSpecific.VP9.spatial_layer_resolution_present;
-        if (info->codecSpecific.VP9.spatial_layer_resolution_present) {
-          for (size_t i = 0; i < info->codecSpecific.VP9.num_spatial_layers;
-               ++i) {
-            rtp->codecHeader.VP9.width[i] = info->codecSpecific.VP9.width[i];
-            rtp->codecHeader.VP9.height[i] = info->codecSpecific.VP9.height[i];
-          }
-        }
-        rtp->codecHeader.VP9.gof.CopyGofInfoVP9(info->codecSpecific.VP9.gof);
-      }
-
-      rtp->codecHeader.VP9.num_ref_pics = info->codecSpecific.VP9.num_ref_pics;
-      for (int i = 0; i < info->codecSpecific.VP9.num_ref_pics; ++i)
-        rtp->codecHeader.VP9.pid_diff[i] = info->codecSpecific.VP9.p_diff[i];
-      return;
-    }
-    case kVideoCodecH264:
-      rtp->codec = kRtpVideoH264;
-      return;
-    case kVideoCodecGeneric:
-      rtp->codec = kRtpVideoGeneric;
-      rtp->simulcastIdx = info->codecSpecific.generic.simulcast_idx;
-      return;
-    default:
-      return;
-  }
-}
-}  // namespace
-
 VCMGenericEncoder::VCMGenericEncoder(
     VideoEncoder* encoder,
     VideoEncoderRateObserver* rate_observer,
@@ -216,7 +146,6 @@
     EncodedImageCallback* post_encode_callback)
     : send_callback_(),
       media_opt_(nullptr),
-      payload_type_(0),
       internal_source_(false),
       post_encode_callback_(post_encode_callback) {}
 
@@ -234,19 +163,8 @@
     const RTPFragmentationHeader* fragmentation_header) {
   TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded",
                        "timestamp", encoded_image._timeStamp);
-  post_encode_callback_->Encoded(encoded_image, nullptr, nullptr);
-
-  if (send_callback_ == nullptr)
-    return VCM_UNINITIALIZED;
-
-  RTPVideoHeader rtp_video_header;
-  memset(&rtp_video_header, 0, sizeof(RTPVideoHeader));
-  if (codec_specific)
-    CopyCodecSpecific(codec_specific, &rtp_video_header);
-  rtp_video_header.rotation = encoded_image.rotation_;
-
-  int32_t ret_val = send_callback_->SendData(
-      payload_type_, encoded_image, fragmentation_header, &rtp_video_header);
+  int ret_val = post_encode_callback_->Encoded(encoded_image, codec_specific,
+                                               fragmentation_header);
   if (ret_val < 0)
     return ret_val;