Deprecate old names for EncodedImage::RtpTimestamp accessor and setter

Replace remaining webrtc usage of the deprecated names.

Bug: webrtc:9378
Change-Id: Ie5bd2d3eaf68316e7c827fc35c7c7d8e2eadeb9f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/321584
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40824}
diff --git a/api/video/encoded_image.h b/api/video/encoded_image.h
index a96ce6b..0e40cfe 100644
--- a/api/video/encoded_image.h
+++ b/api/video/encoded_image.h
@@ -83,9 +83,11 @@
   void SetRtpTimestamp(uint32_t timestamp) { timestamp_rtp_ = timestamp; }
   uint32_t RtpTimestamp() const { return timestamp_rtp_; }
 
-  // TODO(bugs.webrtc.org/9378): Delete two functions below.
-  void SetTimestamp(uint32_t timestamp) { SetRtpTimestamp(timestamp); }
-  uint32_t Timestamp() const { return RtpTimestamp(); }
+  // TODO(bugs.webrtc.org/9378): Delete two functions below after 2023-10-12
+  [[deprecated]] void SetTimestamp(uint32_t timestamp) {
+    SetRtpTimestamp(timestamp);
+  }
+  [[deprecated]] uint32_t Timestamp() const { return RtpTimestamp(); }
 
   void SetEncodeTime(int64_t encode_start_ms, int64_t encode_finish_ms);
 
diff --git a/modules/video_coding/encoded_frame.h b/modules/video_coding/encoded_frame.h
index b8c9d14..88e5490 100644
--- a/modules/video_coding/encoded_frame.h
+++ b/modules/video_coding/encoded_frame.h
@@ -46,17 +46,17 @@
   using EncodedImage::GetEncodedData;
   using EncodedImage::NtpTimeMs;
   using EncodedImage::PacketInfos;
+  using EncodedImage::RtpTimestamp;
   using EncodedImage::set_size;
   using EncodedImage::SetColorSpace;
   using EncodedImage::SetEncodedData;
   using EncodedImage::SetPacketInfos;
+  using EncodedImage::SetRtpTimestamp;
   using EncodedImage::SetSpatialIndex;
   using EncodedImage::SetSpatialLayerFrameSize;
-  using EncodedImage::SetTimestamp;
   using EncodedImage::size;
   using EncodedImage::SpatialIndex;
   using EncodedImage::SpatialLayerFrameSize;
-  using EncodedImage::Timestamp;
 
   /**
    *   Get render time in milliseconds
diff --git a/modules/video_coding/generic_decoder_unittest.cc b/modules/video_coding/generic_decoder_unittest.cc
index e8d1dad..d0f6d53 100644
--- a/modules/video_coding/generic_decoder_unittest.cc
+++ b/modules/video_coding/generic_decoder_unittest.cc
@@ -108,7 +108,7 @@
   decoder_.SetDelayedDecoding(10);
   for (int i = 0; i < kMaxFramesInFlight + 1; ++i) {
     EncodedFrame encoded_frame;
-    encoded_frame.SetTimestamp(90000 * i);
+    encoded_frame.SetRtpTimestamp(90000 * i);
     generic_decoder_.Decode(encoded_frame, clock_->CurrentTime());
   }
 
diff --git a/sdk/android/src/jni/video_decoder_wrapper.cc b/sdk/android/src/jni/video_decoder_wrapper.cc
index 8c231c0..0c0358d 100644
--- a/sdk/android/src/jni/video_decoder_wrapper.cc
+++ b/sdk/android/src/jni/video_decoder_wrapper.cc
@@ -100,12 +100,12 @@
   EncodedImage input_image(image_param);
   // We use RTP timestamp for capture time because capture_time_ms_ is always 0.
   input_image.capture_time_ms_ =
-      input_image.Timestamp() / kNumRtpTicksPerMillisec;
+      input_image.RtpTimestamp() / kNumRtpTicksPerMillisec;
 
   FrameExtraInfo frame_extra_info;
   frame_extra_info.timestamp_ns =
       input_image.capture_time_ms_ * rtc::kNumNanosecsPerMillisec;
-  frame_extra_info.timestamp_rtp = input_image.Timestamp();
+  frame_extra_info.timestamp_rtp = input_image.RtpTimestamp();
   frame_extra_info.timestamp_ntp = input_image.ntp_time_ms_;
   frame_extra_info.qp =
       qp_parsing_enabled_ ? ParseQP(input_image) : absl::nullopt;
diff --git a/sdk/android/src/jni/video_encoder_wrapper.cc b/sdk/android/src/jni/video_encoder_wrapper.cc
index 6cd8acb..8458ba6 100644
--- a/sdk/android/src/jni/video_encoder_wrapper.cc
+++ b/sdk/android/src/jni/video_encoder_wrapper.cc
@@ -305,7 +305,7 @@
   // CopyOnWriteBuffer.
   EncodedImage frame_copy = frame;
 
-  frame_copy.SetTimestamp(frame_extra_info.timestamp_rtp);
+  frame_copy.SetRtpTimestamp(frame_extra_info.timestamp_rtp);
   frame_copy.capture_time_ms_ = capture_time_ns / rtc::kNumNanosecsPerMillisec;
 
   if (frame_copy.qp_ < 0)
diff --git a/sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm b/sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm
index 7f8ae73..c8936d3 100644
--- a/sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm
+++ b/sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm
@@ -83,7 +83,7 @@
                                  freeWhenDone:NO];
     self.encodedWidth = rtc::dchecked_cast<int32_t>(encodedImage._encodedWidth);
     self.encodedHeight = rtc::dchecked_cast<int32_t>(encodedImage._encodedHeight);
-    self.timeStamp = encodedImage.Timestamp();
+    self.timeStamp = encodedImage.RtpTimestamp();
     self.captureTimeMs = encodedImage.capture_time_ms_;
     self.ntpTimeMs = encodedImage.ntp_time_ms_;
     self.flags = encodedImage.timing_.flags;
@@ -111,7 +111,7 @@
   encodedImage.set_size(self.buffer.length);
   encodedImage._encodedWidth = rtc::dchecked_cast<uint32_t>(self.encodedWidth);
   encodedImage._encodedHeight = rtc::dchecked_cast<uint32_t>(self.encodedHeight);
-  encodedImage.SetTimestamp(self.timeStamp);
+  encodedImage.SetRtpTimestamp(self.timeStamp);
   encodedImage.capture_time_ms_ = self.captureTimeMs;
   encodedImage.ntp_time_ms_ = self.ntpTimeMs;
   encodedImage.timing_.flags = self.flags;
diff --git a/test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.cc b/test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.cc
index 7a2b316..d7ef0b0 100644
--- a/test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.cc
+++ b/test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.cc
@@ -252,7 +252,7 @@
     std::pair<uint32_t, uint16_t> timestamp_frame_id;
     while (!timestamp_to_frame_id_list_.empty()) {
       timestamp_frame_id = timestamp_to_frame_id_list_.front();
-      if (timestamp_frame_id.first == encoded_image.Timestamp()) {
+      if (timestamp_frame_id.first == encoded_image.RtpTimestamp()) {
         break;
       }
       timestamp_to_frame_id_list_.pop_front();
@@ -271,7 +271,7 @@
       // posting frame to it, but then call the callback for this frame.
       RTC_LOG(LS_ERROR) << "QualityAnalyzingVideoEncoder::OnEncodedImage: No "
                            "frame id for encoded_image.Timestamp()="
-                        << encoded_image.Timestamp();
+                        << encoded_image.RtpTimestamp();
       return EncodedImageCallback::Result(
           EncodedImageCallback::Result::Error::OK);
     }