Delete picture id and tl0 index from CodecSpecificInfo.

This is a followup to https://webrtc-review.googlesource.com/61640,
moving the responsibility for setting these values to the
PayloadRouter.

Bug: webrtc:8830
Change-Id: I8e5a02cf7bb7417166f04d5511aab7a778799bc1
Reviewed-on: https://webrtc-review.googlesource.com/83164
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23654}
diff --git a/modules/video_coding/encoded_frame.cc b/modules/video_coding/encoded_frame.cc
index 7519ad6..cb9ff6c 100644
--- a/modules/video_coding/encoded_frame.cc
+++ b/modules/video_coding/encoded_frame.cc
@@ -95,7 +95,6 @@
       case kVideoCodecVP8: {
         if (_codecSpecificInfo.codecType != kVideoCodecVP8) {
           // This is the first packet for this frame.
-          _codecSpecificInfo.codecSpecific.VP8.pictureId = -1;
           _codecSpecificInfo.codecSpecific.VP8.temporalIdx = 0;
           _codecSpecificInfo.codecSpecific.VP8.layerSync = false;
           _codecSpecificInfo.codecSpecific.VP8.keyIdx = -1;
@@ -103,10 +102,6 @@
         }
         _codecSpecificInfo.codecSpecific.VP8.nonReference =
             header->codecHeader.VP8.nonReference;
-        if (header->codecHeader.VP8.pictureId != kNoPictureId) {
-          _codecSpecificInfo.codecSpecific.VP8.pictureId =
-              header->codecHeader.VP8.pictureId;
-        }
         if (header->codecHeader.VP8.temporalIdx != kNoTemporalIdx) {
           _codecSpecificInfo.codecSpecific.VP8.temporalIdx =
               header->codecHeader.VP8.temporalIdx;
@@ -122,12 +117,10 @@
       case kVideoCodecVP9: {
         if (_codecSpecificInfo.codecType != kVideoCodecVP9) {
           // This is the first packet for this frame.
-          _codecSpecificInfo.codecSpecific.VP9.picture_id = -1;
           _codecSpecificInfo.codecSpecific.VP9.temporal_idx = 0;
           _codecSpecificInfo.codecSpecific.VP9.spatial_idx = 0;
           _codecSpecificInfo.codecSpecific.VP9.gof_idx = 0;
           _codecSpecificInfo.codecSpecific.VP9.inter_layer_predicted = false;
-          _codecSpecificInfo.codecSpecific.VP9.tl0_pic_idx = -1;
           _codecSpecificInfo.codecType = kVideoCodecVP9;
         }
         _codecSpecificInfo.codecSpecific.VP9.inter_pic_predicted =
@@ -142,14 +135,6 @@
         }
         _codecSpecificInfo.codecSpecific.VP9.ss_data_available =
             header->codecHeader.VP9.ss_data_available;
-        if (header->codecHeader.VP9.picture_id != kNoPictureId) {
-          _codecSpecificInfo.codecSpecific.VP9.picture_id =
-              header->codecHeader.VP9.picture_id;
-        }
-        if (header->codecHeader.VP9.tl0_pic_idx != kNoTl0PicIdx) {
-          _codecSpecificInfo.codecSpecific.VP9.tl0_pic_idx =
-              header->codecHeader.VP9.tl0_pic_idx;
-        }
         if (header->codecHeader.VP9.temporal_idx != kNoTemporalIdx) {
           _codecSpecificInfo.codecSpecific.VP9.temporal_idx =
               header->codecHeader.VP9.temporal_idx;
diff --git a/modules/video_coding/include/video_codec_interface.h b/modules/video_coding/include/video_codec_interface.h
index 2c94093..d61a926 100644
--- a/modules/video_coding/include/video_codec_interface.h
+++ b/modules/video_coding/include/video_codec_interface.h
@@ -28,21 +28,14 @@
 // Note: if any pointers are added to this struct, it must be fitted
 // with a copy-constructor. See below.
 struct CodecSpecificInfoVP8 {
-  // TODO(nisse): Used on receive side only. Move elsewhere?
-  int16_t pictureId;  // Negative value to skip pictureId.
   bool nonReference;
   uint8_t simulcastIdx;
   uint8_t temporalIdx;
   bool layerSync;
-  // TODO(nisse): Used on receive side only. Move elsewhere?
-  int tl0PicIdx;  // Negative value to skip tl0PicIdx.
   int8_t keyIdx;  // Negative value to skip keyIdx.
 };
 
 struct CodecSpecificInfoVP9 {
-  // TODO(nisse): Used on receive side only. Move elsewhere?
-  int16_t picture_id;  // Negative value to skip pictureId.
-
   bool first_frame_in_picture;  // First frame, increment picture_id.
   bool inter_pic_predicted;  // This layer frame is dependent on previously
                              // coded frame(s).
@@ -50,8 +43,6 @@
   bool ss_data_available;
   bool non_ref_for_inter_layer_pred;
 
-  // TODO(nisse): Used on receive side only. Move elsewhere?
-  int tl0_pic_idx;  // Negative value to skip tl0PicIdx.
   uint8_t temporal_idx;
   uint8_t spatial_idx;
   bool temporal_up_switch;
diff --git a/sdk/android/src/jni/androidmediaencoder.cc b/sdk/android/src/jni/androidmediaencoder.cc
index b10fcb2..01097a9 100644
--- a/sdk/android/src/jni/androidmediaencoder.cc
+++ b/sdk/android/src/jni/androidmediaencoder.cc
@@ -31,7 +31,6 @@
 #include "rtc_base/bind.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
-#include "rtc_base/random.h"
 #include "rtc_base/sequenced_task_checker.h"
 #include "rtc_base/task_queue.h"
 #include "rtc_base/thread.h"
@@ -283,10 +282,6 @@
   int frames_received_since_last_key_;
   VideoCodecMode codec_mode_;
 
-  // RTP state.
-  uint16_t picture_id_;
-  uint8_t tl0_pic_idx_;
-
   bool sw_fallback_required_;
 
   // All other member variables should be before WeakPtrFactory. Valid only from
@@ -314,10 +309,6 @@
       egl_context_(egl_context),
       sw_fallback_required_(false) {
   encoder_queue_checker_.Detach();
-
-  Random random(rtc::TimeMicros());
-  picture_id_ = random.Rand<uint16_t>() & 0x7FFF;
-  tl0_pic_idx_ = random.Rand<uint8_t>();
 }
 
 int32_t MediaCodecVideoEncoder::InitEncode(const VideoCodec* codec_settings,
@@ -1011,22 +1002,18 @@
       memset(&info, 0, sizeof(info));
       info.codecType = codec_type;
       if (codec_type == kVideoCodecVP8) {
-        info.codecSpecific.VP8.pictureId = picture_id_;
         info.codecSpecific.VP8.nonReference = false;
         info.codecSpecific.VP8.simulcastIdx = 0;
         info.codecSpecific.VP8.temporalIdx = kNoTemporalIdx;
         info.codecSpecific.VP8.layerSync = false;
-        info.codecSpecific.VP8.tl0PicIdx = kNoTl0PicIdx;
         info.codecSpecific.VP8.keyIdx = kNoKeyIdx;
       } else if (codec_type == kVideoCodecVP9) {
         if (key_frame) {
           gof_idx_ = 0;
         }
-        info.codecSpecific.VP9.picture_id = picture_id_;
         info.codecSpecific.VP9.inter_pic_predicted = key_frame ? false : true;
         info.codecSpecific.VP9.flexible_mode = false;
         info.codecSpecific.VP9.ss_data_available = key_frame ? true : false;
-        info.codecSpecific.VP9.tl0_pic_idx = tl0_pic_idx_++;
         info.codecSpecific.VP9.temporal_idx = kNoTemporalIdx;
         info.codecSpecific.VP9.spatial_idx = kNoSpatialIdx;
         info.codecSpecific.VP9.temporal_up_switch = true;
@@ -1044,7 +1031,6 @@
           info.codecSpecific.VP9.gof.CopyGofInfoVP9(gof_);
         }
       }
-      picture_id_ = (picture_id_ + 1) & 0x7FFF;
 
       // Generate a header describing a single fragment.
       RTPFragmentationHeader header;
diff --git a/sdk/android/src/jni/videoencoderwrapper.cc b/sdk/android/src/jni/videoencoderwrapper.cc
index 3c139c5..f4f4347 100644
--- a/sdk/android/src/jni/videoencoderwrapper.cc
+++ b/sdk/android/src/jni/videoencoderwrapper.cc
@@ -19,8 +19,6 @@
 #include "modules/video_coding/utility/vp8_header_parser.h"
 #include "modules/video_coding/utility/vp9_uncompressed_header_parser.h"
 #include "rtc_base/logging.h"
-#include "rtc_base/random.h"
-#include "rtc_base/timeutils.h"
 #include "sdk/android/generated_video_jni/jni/VideoEncoderWrapper_jni.h"
 #include "sdk/android/generated_video_jni/jni/VideoEncoder_jni.h"
 #include "sdk/android/native_api/jni/class_loader.h"
@@ -38,10 +36,6 @@
 
   initialized_ = false;
   num_resets_ = 0;
-
-  Random random(rtc::TimeMicros());
-  picture_id_ = random.Rand<uint16_t>() & 0x7FFF;
-  tl0_pic_idx_ = random.Rand<uint8_t>();
 }
 VideoEncoderWrapper::~VideoEncoderWrapper() = default;
 
@@ -392,23 +386,19 @@
 
   switch (codec_settings_.codecType) {
     case kVideoCodecVP8:
-      info.codecSpecific.VP8.pictureId = picture_id_;
       info.codecSpecific.VP8.nonReference = false;
       info.codecSpecific.VP8.simulcastIdx = 0;
       info.codecSpecific.VP8.temporalIdx = kNoTemporalIdx;
       info.codecSpecific.VP8.layerSync = false;
-      info.codecSpecific.VP8.tl0PicIdx = kNoTl0PicIdx;
       info.codecSpecific.VP8.keyIdx = kNoKeyIdx;
       break;
     case kVideoCodecVP9:
       if (key_frame) {
         gof_idx_ = 0;
       }
-      info.codecSpecific.VP9.picture_id = picture_id_;
       info.codecSpecific.VP9.inter_pic_predicted = key_frame ? false : true;
       info.codecSpecific.VP9.flexible_mode = false;
       info.codecSpecific.VP9.ss_data_available = key_frame ? true : false;
-      info.codecSpecific.VP9.tl0_pic_idx = tl0_pic_idx_++;
       info.codecSpecific.VP9.temporal_idx = kNoTemporalIdx;
       info.codecSpecific.VP9.spatial_idx = kNoSpatialIdx;
       info.codecSpecific.VP9.temporal_up_switch = true;
@@ -430,8 +420,6 @@
       break;
   }
 
-  picture_id_ = (picture_id_ + 1) & 0x7FFF;
-
   return info;
 }
 
diff --git a/sdk/android/src/jni/videoencoderwrapper.h b/sdk/android/src/jni/videoencoderwrapper.h
index 71f3d7b..e350cad 100644
--- a/sdk/android/src/jni/videoencoderwrapper.h
+++ b/sdk/android/src/jni/videoencoderwrapper.h
@@ -106,10 +106,6 @@
   VideoCodec codec_settings_;
   H264BitstreamParser h264_bitstream_parser_;
 
-  // RTP state.
-  uint16_t picture_id_;
-  uint8_t tl0_pic_idx_;
-
   // VP9 variables to populate codec specific structure.
   GofInfoVP9 gof_;  // Contains each frame's temporal information for
                     // non-flexible VP9 mode.