Add Timestamp accessor methods to the EncodedImage class.

Bug: webrtc:9378
Change-Id: I59bf14f631f92f0f4e05f60d4af25641a23a53f9
Reviewed-on: https://webrtc-review.googlesource.com/82100
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23734}
diff --git a/api/video/encoded_frame.cc b/api/video/encoded_frame.cc
index f9152b2..26a794e 100644
--- a/api/video/encoded_frame.cc
+++ b/api/video/encoded_frame.cc
@@ -17,13 +17,5 @@
   return 0;
 }
 
-uint32_t EncodedFrame::Timestamp() const {
-  return timestamp;
-}
-
-void EncodedFrame::SetTimestamp(uint32_t rtp_timestamp) {
-  timestamp = rtp_timestamp;
-}
-
 }  // namespace video_coding
 }  // namespace webrtc
diff --git a/api/video/encoded_frame.h b/api/video/encoded_frame.h
index 1b0a26a..b8462c6 100644
--- a/api/video/encoded_frame.h
+++ b/api/video/encoded_frame.h
@@ -58,10 +58,6 @@
 
   virtual bool GetBitstream(uint8_t* destination) const = 0;
 
-  // The capture timestamp of this frame, using the 90 kHz RTP clock.
-  virtual uint32_t Timestamp() const;
-  virtual void SetTimestamp(uint32_t rtp_timestamp);
-
   // When this frame was received.
   virtual int64_t ReceivedTime() const = 0;
 
@@ -78,7 +74,6 @@
   bool is_keyframe() const { return num_references == 0; }
 
   VideoLayerFrameId id;
-  uint32_t timestamp = 0;
 
   // TODO(philipel): Add simple modify/access functions to prevent adding too
   // many |references|.
diff --git a/common_video/include/video_frame.h b/common_video/include/video_frame.h
index 41c3919..7b85cc8 100644
--- a/common_video/include/video_frame.h
+++ b/common_video/include/video_frame.h
@@ -37,6 +37,14 @@
   EncodedImage(const EncodedImage&);
   EncodedImage(uint8_t* buffer, size_t length, size_t size);
 
+  // TODO(nisse): Change style to timestamp(), set_timestamp(), for consistency
+  // with the VideoFrame class.
+  // Set frame timestamp (90kHz).
+  void SetTimestamp(uint32_t timestamp) { _timeStamp = timestamp; }
+
+  // Get frame timestamp (90kHz).
+  uint32_t Timestamp() const { return _timeStamp; }
+
   void SetEncodeTime(int64_t encode_start_ms, int64_t encode_finish_ms);
 
   uint32_t _encodedWidth = 0;
diff --git a/modules/video_coding/decoding_state.cc b/modules/video_coding/decoding_state.cc
index 23bf668..1d54063 100644
--- a/modules/video_coding/decoding_state.cc
+++ b/modules/video_coding/decoding_state.cc
@@ -58,7 +58,7 @@
   assert(frame != NULL);
   if (in_initial_state_)
     return false;
-  return !IsNewerTimestamp(frame->TimeStamp(), time_stamp_);
+  return !IsNewerTimestamp(frame->Timestamp(), time_stamp_);
 }
 
 bool VCMDecodingState::IsOldPacket(const VCMPacket* packet) const {
@@ -73,7 +73,7 @@
   if (!UsingFlexibleMode(frame))
     UpdateSyncState(frame);
   sequence_num_ = static_cast<uint16_t>(frame->GetHighSeqNum());
-  time_stamp_ = frame->TimeStamp();
+  time_stamp_ = frame->Timestamp();
   picture_id_ = frame->PictureId();
   temporal_id_ = frame->TemporalId();
   tl0_pic_id_ = frame->Tl0PicId();
@@ -143,7 +143,7 @@
     // Continuous empty packets or continuous frames can be dropped if we
     // advance the sequence number.
     sequence_num_ = frame->GetHighSeqNum();
-    time_stamp_ = frame->TimeStamp();
+    time_stamp_ = frame->Timestamp();
     return true;
   }
   return false;
diff --git a/modules/video_coding/encoded_frame.h b/modules/video_coding/encoded_frame.h
index 17c61d7..aadfcdf 100644
--- a/modules/video_coding/encoded_frame.h
+++ b/modules/video_coding/encoded_frame.h
@@ -65,10 +65,12 @@
    *   Get frame length
    */
   size_t Length() const { return _length; }
+
   /**
-   *   Get frame timestamp (90kHz)
+   *   Frame RTP timestamp (90kHz)
    */
-  uint32_t TimeStamp() const { return _timeStamp; }
+  using EncodedImage::Timestamp;
+  using EncodedImage::SetTimestamp;
   /**
    *   Get render time in milliseconds
    */
diff --git a/modules/video_coding/frame_buffer2.cc b/modules/video_coding/frame_buffer2.cc
index f13ed35..8bb241a 100644
--- a/modules/video_coding/frame_buffer2.cc
+++ b/modules/video_coding/frame_buffer2.cc
@@ -117,7 +117,8 @@
 
         next_frame_it_ = frame_it;
         if (frame->RenderTime() == -1)
-          frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms));
+          frame->SetRenderTime(
+              timing_->RenderTimeMs(frame->Timestamp(), now_ms));
         wait_ms = timing_->MaxWaitingTime(frame->RenderTime(), now_ms);
 
         // This will cause the frame buffer to prefer high framerate rather
@@ -146,7 +147,7 @@
       if (!frame->delayed_by_retransmission()) {
         int64_t frame_delay;
 
-        if (inter_frame_delay_.CalculateDelay(frame->timestamp, &frame_delay,
+        if (inter_frame_delay_.CalculateDelay(frame->Timestamp(), &frame_delay,
                                               frame->ReceivedTime())) {
           jitter_estimator_->UpdateEstimate(frame_delay, frame->size());
         }
@@ -163,7 +164,7 @@
       if (HasBadRenderTiming(*frame, now_ms)) {
         jitter_estimator_->Reset();
         timing_->Reset();
-        frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms));
+        frame->SetRenderTime(timing_->RenderTimeMs(frame->Timestamp(), now_ms));
       }
 
       UpdateJitterDelay();
@@ -177,17 +178,17 @@
         const VideoLayerFrameId& frame_key = next_frame_it_->first;
 
         const bool frame_is_higher_spatial_layer_of_last_decoded_frame =
-            last_decoded_frame_timestamp_ == frame->timestamp &&
+            last_decoded_frame_timestamp_ == frame->Timestamp() &&
             last_decoded_frame_key.picture_id == frame_key.picture_id &&
             last_decoded_frame_key.spatial_layer < frame_key.spatial_layer;
 
-        if (AheadOrAt(last_decoded_frame_timestamp_, frame->timestamp) &&
+        if (AheadOrAt(last_decoded_frame_timestamp_, frame->Timestamp()) &&
             !frame_is_higher_spatial_layer_of_last_decoded_frame) {
           // TODO(brandtr): Consider clearing the entire buffer when we hit
           // these conditions.
           RTC_LOG(LS_WARNING)
               << "Frame with (timestamp:picture_id:spatial_id) ("
-              << frame->timestamp << ":" << frame->id.picture_id << ":"
+              << frame->Timestamp() << ":" << frame->id.picture_id << ":"
               << static_cast<int>(frame->id.spatial_layer) << ")"
               << " sent to decoder after frame with"
               << " (timestamp:picture_id:spatial_id) ("
@@ -198,7 +199,7 @@
       }
 
       AdvanceLastDecodedFrame(next_frame_it_);
-      last_decoded_frame_timestamp_ = frame->timestamp;
+      last_decoded_frame_timestamp_ = frame->Timestamp();
       *frame_out = std::move(frame);
       return kFrameFound;
     }
@@ -297,7 +298,7 @@
     timing_->set_max_playout_delay(playout_delay.max_ms);
 
   if (!frame.delayed_by_retransmission())
-    timing_->IncomingTimestamp(frame.timestamp, frame.ReceivedTime());
+    timing_->IncomingTimestamp(frame.Timestamp(), frame.ReceivedTime());
 }
 
 int64_t FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
@@ -343,7 +344,7 @@
 
   if (last_decoded_frame_it_ != frames_.end() &&
       id <= last_decoded_frame_it_->first) {
-    if (AheadOf(frame->timestamp, last_decoded_frame_timestamp_) &&
+    if (AheadOf(frame->Timestamp(), last_decoded_frame_timestamp_) &&
         frame->is_keyframe()) {
       // If this frame has a newer timestamp but an earlier picture id then we
       // assume there has been a jump in the picture id due to some encoder
diff --git a/modules/video_coding/frame_buffer2_unittest.cc b/modules/video_coding/frame_buffer2_unittest.cc
index 1378be5..357ba86 100644
--- a/modules/video_coding/frame_buffer2_unittest.cc
+++ b/modules/video_coding/frame_buffer2_unittest.cc
@@ -90,8 +90,6 @@
  public:
   bool GetBitstream(uint8_t* destination) const override { return true; }
 
-  uint32_t Timestamp() const override { return timestamp; }
-
   int64_t ReceivedTime() const override { return 0; }
 
   int64_t RenderTime() const override { return _renderTimeMs; }
@@ -165,7 +163,7 @@
     std::unique_ptr<FrameObjectFake> frame(new FrameObjectFake());
     frame->id.picture_id = picture_id;
     frame->id.spatial_layer = spatial_layer;
-    frame->timestamp = ts_ms * 90;
+    frame->SetTimestamp(ts_ms * 90);
     frame->num_references = references.size();
     frame->inter_layer_predicted = inter_layer_predicted;
     for (size_t r = 0; r < references.size(); ++r)
@@ -520,7 +518,7 @@
     frame->SetSize(kFrameSize);
     frame->id.picture_id = pid;
     frame->id.spatial_layer = 0;
-    frame->timestamp = ts;
+    frame->SetTimestamp(ts);
     frame->num_references = 0;
     frame->inter_layer_predicted = false;
 
diff --git a/modules/video_coding/frame_object.cc b/modules/video_coding/frame_object.cc
index a3fc0d1..20e7565 100644
--- a/modules/video_coding/frame_object.cc
+++ b/modules/video_coding/frame_object.cc
@@ -26,7 +26,6 @@
     : packet_buffer_(packet_buffer),
       first_seq_num_(first_seq_num),
       last_seq_num_(last_seq_num),
-      timestamp_(0),
       received_time_(received_time),
       times_nacked_(times_nacked) {
   VCMPacket* first_packet = packet_buffer_->GetPacket(first_seq_num);
@@ -69,7 +68,7 @@
   _encodedHeight = first_packet->height;
 
   // EncodedFrame members
-  timestamp = first_packet->timestamp;
+  SetTimestamp(first_packet->timestamp);
 
   VCMPacket* last_packet = packet_buffer_->GetPacket(last_seq_num);
   RTC_CHECK(last_packet);
@@ -140,10 +139,6 @@
   return packet_buffer_->GetBitstream(*this, destination);
 }
 
-uint32_t RtpFrameObject::Timestamp() const {
-  return timestamp_;
-}
-
 int64_t RtpFrameObject::ReceivedTime() const {
   return received_time_;
 }
diff --git a/modules/video_coding/frame_object.h b/modules/video_coding/frame_object.h
index 8980984..6c6480a 100644
--- a/modules/video_coding/frame_object.h
+++ b/modules/video_coding/frame_object.h
@@ -37,7 +37,6 @@
   enum FrameType frame_type() const;
   VideoCodecType codec_type() const;
   bool GetBitstream(uint8_t* destination) const override;
-  uint32_t Timestamp() const override;
   int64_t ReceivedTime() const override;
   int64_t RenderTime() const override;
   bool delayed_by_retransmission() const override;
@@ -49,7 +48,6 @@
   VideoCodecType codec_type_;
   uint16_t first_seq_num_;
   uint16_t last_seq_num_;
-  uint32_t timestamp_;
   int64_t received_time_;
 
   // Equal to times nacked of the packet with the highet times nacked
diff --git a/modules/video_coding/generic_decoder.cc b/modules/video_coding/generic_decoder.cc
index 01500e7..44610ad 100644
--- a/modules/video_coding/generic_decoder.cc
+++ b/modules/video_coding/generic_decoder.cc
@@ -225,7 +225,7 @@
   } else {
     _frameInfos[_nextFrameInfoIdx].content_type = _last_keyframe_content_type;
   }
-  _callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]);
+  _callback->Map(frame.Timestamp(), &_frameInfos[_nextFrameInfoIdx]);
 
   _nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength;
   int32_t ret = decoder_->Decode(frame.EncodedImage(), frame.MissingFrame(),
@@ -234,13 +234,13 @@
   _callback->OnDecoderImplementationName(decoder_->ImplementationName());
   if (ret < WEBRTC_VIDEO_CODEC_OK) {
     RTC_LOG(LS_WARNING) << "Failed to decode frame with timestamp "
-                        << frame.TimeStamp() << ", error code: " << ret;
-    _callback->Pop(frame.TimeStamp());
+                        << frame.Timestamp() << ", error code: " << ret;
+    _callback->Pop(frame.Timestamp());
     return ret;
   } else if (ret == WEBRTC_VIDEO_CODEC_NO_OUTPUT ||
              ret == WEBRTC_VIDEO_CODEC_REQUEST_SLI) {
     // No output
-    _callback->Pop(frame.TimeStamp());
+    _callback->Pop(frame.Timestamp());
   }
   return ret;
 }
diff --git a/modules/video_coding/jitter_buffer.cc b/modules/video_coding/jitter_buffer.cc
index 5f45ece..0699e3b 100644
--- a/modules/video_coding/jitter_buffer.cc
+++ b/modules/video_coding/jitter_buffer.cc
@@ -54,7 +54,7 @@
 }
 
 void FrameList::InsertFrame(VCMFrameBuffer* frame) {
-  insert(rbegin().base(), FrameListPair(frame->TimeStamp(), frame));
+  insert(rbegin().base(), FrameListPair(frame->Timestamp(), frame));
 }
 
 VCMFrameBuffer* FrameList::PopFrame(uint32_t timestamp) {
@@ -110,7 +110,7 @@
     }
     free_frames->push_back(oldest_frame);
     TRACE_EVENT_INSTANT1("webrtc", "JB::OldOrEmptyFrameDropped", "timestamp",
-                         oldest_frame->TimeStamp());
+                         oldest_frame->Timestamp());
     erase(begin());
   }
 }
@@ -206,7 +206,7 @@
       continue;
     }
     SsMap::iterator ss_it;
-    if (Find(frame_it.second->TimeStamp(), &ss_it)) {
+    if (Find(frame_it.second->Timestamp(), &ss_it)) {
       if (gof_idx >= ss_it->second.num_frames_in_gof) {
         continue;  // Assume corresponding SS not yet received.
       }
@@ -522,7 +522,7 @@
     }
   }
 
-  *timestamp = oldest_frame->TimeStamp();
+  *timestamp = oldest_frame->Timestamp();
   return true;
 }
 
@@ -558,7 +558,7 @@
       // Wait for this one to get complete.
       waiting_for_completion_.frame_size = frame->Length();
       waiting_for_completion_.latest_packet_time = frame->LatestPacketTimeMs();
-      waiting_for_completion_.timestamp = frame->TimeStamp();
+      waiting_for_completion_.timestamp = frame->Timestamp();
     }
   }
 
@@ -709,8 +709,8 @@
       frame->InsertPacket(packet, now_ms, decode_error_mode_, frame_data);
 
   if (previous_state != kStateComplete) {
-    TRACE_EVENT_ASYNC_BEGIN1("webrtc", "Video", frame->TimeStamp(), "timestamp",
-                             frame->TimeStamp());
+    TRACE_EVENT_ASYNC_BEGIN1("webrtc", "Video", frame->Timestamp(), "timestamp",
+                             frame->Timestamp());
   }
 
   if (buffer_state > 0) {
@@ -825,7 +825,7 @@
   for (FrameList::const_iterator it = decodable_frames_.begin();
        it != decodable_frames_.end(); ++it) {
     VCMFrameBuffer* decodable_frame = it->second;
-    if (IsNewerTimestamp(decodable_frame->TimeStamp(), frame.TimeStamp())) {
+    if (IsNewerTimestamp(decodable_frame->Timestamp(), frame.Timestamp())) {
       break;
     }
     decoding_state.SetState(decodable_frame);
@@ -859,7 +859,7 @@
        it != incomplete_frames_.end();) {
     VCMFrameBuffer* frame = it->second;
     if (IsNewerTimestamp(original_decoded_state.time_stamp(),
-                         frame->TimeStamp())) {
+                         frame->Timestamp())) {
       ++it;
       continue;
     }
@@ -941,11 +941,11 @@
   if (incomplete_frames_.empty()) {
     return 0;
   }
-  uint32_t start_timestamp = incomplete_frames_.Front()->TimeStamp();
+  uint32_t start_timestamp = incomplete_frames_.Front()->Timestamp();
   if (!decodable_frames_.empty()) {
-    start_timestamp = decodable_frames_.Back()->TimeStamp();
+    start_timestamp = decodable_frames_.Back()->Timestamp();
   }
-  return incomplete_frames_.Back()->TimeStamp() - start_timestamp;
+  return incomplete_frames_.Back()->Timestamp() - start_timestamp;
 }
 
 uint16_t VCMJitterBuffer::EstimatedLowSequenceNumber(
@@ -1178,10 +1178,10 @@
   incoming_frame_count_++;
 
   if (frame.FrameType() == kVideoFrameKey) {
-    TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", frame.TimeStamp(),
+    TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", frame.Timestamp(),
                             "KeyComplete");
   } else {
-    TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", frame.TimeStamp(),
+    TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", frame.Timestamp(),
                             "DeltaComplete");
   }
 
@@ -1257,7 +1257,7 @@
   }
   // No retransmitted frames should be a part of the jitter
   // estimate.
-  UpdateJitterEstimate(frame.LatestPacketTimeMs(), frame.TimeStamp(),
+  UpdateJitterEstimate(frame.LatestPacketTimeMs(), frame.Timestamp(),
                        frame.Length(), incomplete_frame);
 }
 
diff --git a/modules/video_coding/jitter_buffer_unittest.cc b/modules/video_coding/jitter_buffer_unittest.cc
index 71c17ea..b40b8ba 100644
--- a/modules/video_coding/jitter_buffer_unittest.cc
+++ b/modules/video_coding/jitter_buffer_unittest.cc
@@ -250,7 +250,7 @@
     VCMEncodedFrame* found_frame = jitter_buffer_->NextCompleteFrame(10);
     if (!found_frame)
       return nullptr;
-    return jitter_buffer_->ExtractAndSetDecode(found_frame->TimeStamp());
+    return jitter_buffer_->ExtractAndSetDecode(found_frame->Timestamp());
   }
 
   VCMEncodedFrame* DecodeIncompleteFrame() {
@@ -405,7 +405,7 @@
       return false;
 
     VCMEncodedFrame* frame =
-        jitter_buffer_->ExtractAndSetDecode(found_frame->TimeStamp());
+        jitter_buffer_->ExtractAndSetDecode(found_frame->Timestamp());
     bool ret = (frame != NULL);
     jitter_buffer_->ReleaseFrame(frame);
     return ret;
@@ -952,12 +952,12 @@
   EXPECT_EQ(kCompleteSession, jitter_buffer_->InsertPacket(*packet_, &re));
 
   VCMEncodedFrame* frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(1000U, frame_out->TimeStamp());
+  EXPECT_EQ(1000U, frame_out->Timestamp());
   EXPECT_EQ(kVideoFrameKey, frame_out->FrameType());
   jitter_buffer_->ReleaseFrame(frame_out);
 
   frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(13000U, frame_out->TimeStamp());
+  EXPECT_EQ(13000U, frame_out->Timestamp());
   EXPECT_EQ(kVideoFrameDelta, frame_out->FrameType());
   jitter_buffer_->ReleaseFrame(frame_out);
 }
@@ -1014,7 +1014,7 @@
   EXPECT_EQ(kCompleteSession, jitter_buffer_->InsertPacket(*packet_, &re));
 
   VCMEncodedFrame* frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(3000U, frame_out->TimeStamp());
+  EXPECT_EQ(3000U, frame_out->Timestamp());
   EXPECT_EQ(kVideoFrameKey, frame_out->FrameType());
   EXPECT_EQ(0, frame_out->CodecSpecific()->codecSpecific.VP9.temporal_idx);
   EXPECT_FALSE(
@@ -1022,14 +1022,14 @@
   jitter_buffer_->ReleaseFrame(frame_out);
 
   frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(6000U, frame_out->TimeStamp());
+  EXPECT_EQ(6000U, frame_out->Timestamp());
   EXPECT_EQ(kVideoFrameDelta, frame_out->FrameType());
   EXPECT_EQ(2, frame_out->CodecSpecific()->codecSpecific.VP9.temporal_idx);
   EXPECT_TRUE(frame_out->CodecSpecific()->codecSpecific.VP9.temporal_up_switch);
   jitter_buffer_->ReleaseFrame(frame_out);
 
   frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(9000U, frame_out->TimeStamp());
+  EXPECT_EQ(9000U, frame_out->Timestamp());
   EXPECT_EQ(kVideoFrameDelta, frame_out->FrameType());
   EXPECT_EQ(1, frame_out->CodecSpecific()->codecSpecific.VP9.temporal_idx);
   EXPECT_TRUE(frame_out->CodecSpecific()->codecSpecific.VP9.temporal_up_switch);
@@ -1105,7 +1105,7 @@
   EXPECT_EQ(kCompleteSession, jitter_buffer_->InsertPacket(*packet_, &re));
 
   VCMEncodedFrame* frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(3000U, frame_out->TimeStamp());
+  EXPECT_EQ(3000U, frame_out->Timestamp());
   EXPECT_EQ(kVideoFrameKey, frame_out->FrameType());
   EXPECT_EQ(0, frame_out->CodecSpecific()->codecSpecific.VP9.temporal_idx);
   EXPECT_FALSE(
@@ -1113,7 +1113,7 @@
   jitter_buffer_->ReleaseFrame(frame_out);
 
   frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(6000U, frame_out->TimeStamp());
+  EXPECT_EQ(6000U, frame_out->Timestamp());
   EXPECT_EQ(kVideoFrameDelta, frame_out->FrameType());
   EXPECT_EQ(1, frame_out->CodecSpecific()->codecSpecific.VP9.temporal_idx);
   EXPECT_TRUE(frame_out->CodecSpecific()->codecSpecific.VP9.temporal_up_switch);
@@ -1461,8 +1461,8 @@
   uint32_t next_timestamp;
   VCMEncodedFrame* frame = jitter_buffer_->NextCompleteFrame(0);
   EXPECT_NE(frame, nullptr);
-  EXPECT_EQ(packet_->timestamp, frame->TimeStamp());
-  frame = jitter_buffer_->ExtractAndSetDecode(frame->TimeStamp());
+  EXPECT_EQ(packet_->timestamp, frame->Timestamp());
+  frame = jitter_buffer_->ExtractAndSetDecode(frame->Timestamp());
   EXPECT_TRUE(frame != NULL);
   jitter_buffer_->ReleaseFrame(frame);
 
@@ -1708,7 +1708,7 @@
             jitter_buffer_->InsertPacket(*packet_, &retransmitted));
 
   VCMEncodedFrame* frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(3000u, frame_out->TimeStamp());
+  EXPECT_EQ(3000u, frame_out->Timestamp());
   CheckOutFrame(frame_out, size_, false);
   EXPECT_EQ(kVideoFrameKey, frame_out->FrameType());
   jitter_buffer_->ReleaseFrame(frame_out);
@@ -1743,7 +1743,7 @@
             jitter_buffer_->InsertPacket(*packet_, &retransmitted));
 
   VCMEncodedFrame* frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(timestamp_, frame_out->TimeStamp());
+  EXPECT_EQ(timestamp_, frame_out->Timestamp());
 
   CheckOutFrame(frame_out, size_, false);
 
@@ -1853,13 +1853,13 @@
             jitter_buffer_->InsertPacket(*packet_, &retransmitted));
 
   VCMEncodedFrame* frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(0xffffff00, frame_out->TimeStamp());
+  EXPECT_EQ(0xffffff00, frame_out->Timestamp());
   CheckOutFrame(frame_out, size_, false);
   EXPECT_EQ(kVideoFrameKey, frame_out->FrameType());
   jitter_buffer_->ReleaseFrame(frame_out);
 
   VCMEncodedFrame* frame_out2 = DecodeCompleteFrame();
-  EXPECT_EQ(2700u, frame_out2->TimeStamp());
+  EXPECT_EQ(2700u, frame_out2->Timestamp());
   CheckOutFrame(frame_out2, size_, false);
   EXPECT_EQ(kVideoFrameDelta, frame_out2->FrameType());
   jitter_buffer_->ReleaseFrame(frame_out2);
@@ -1896,13 +1896,13 @@
             jitter_buffer_->InsertPacket(*packet_, &retransmitted));
 
   VCMEncodedFrame* frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(0xffffff00, frame_out->TimeStamp());
+  EXPECT_EQ(0xffffff00, frame_out->Timestamp());
   CheckOutFrame(frame_out, size_, false);
   EXPECT_EQ(kVideoFrameKey, frame_out->FrameType());
   jitter_buffer_->ReleaseFrame(frame_out);
 
   VCMEncodedFrame* frame_out2 = DecodeCompleteFrame();
-  EXPECT_EQ(2700u, frame_out2->TimeStamp());
+  EXPECT_EQ(2700u, frame_out2->Timestamp());
   CheckOutFrame(frame_out2, size_, false);
   EXPECT_EQ(kVideoFrameDelta, frame_out2->FrameType());
   jitter_buffer_->ReleaseFrame(frame_out2);
@@ -1997,7 +1997,7 @@
             jitter_buffer_->InsertPacket(*packet_, &retransmitted));
 
   VCMEncodedFrame* frame_out = DecodeCompleteFrame();
-  EXPECT_EQ(first_key_frame_timestamp, frame_out->TimeStamp());
+  EXPECT_EQ(first_key_frame_timestamp, frame_out->Timestamp());
   CheckOutFrame(frame_out, size_, false);
   EXPECT_EQ(kVideoFrameKey, frame_out->FrameType());
   jitter_buffer_->ReleaseFrame(frame_out);
@@ -2023,7 +2023,7 @@
     VCMEncodedFrame* testFrame = DecodeIncompleteFrame();
     // Timestamp should never be the last TS inserted.
     if (testFrame != NULL) {
-      EXPECT_TRUE(testFrame->TimeStamp() < timestamp_);
+      EXPECT_TRUE(testFrame->Timestamp() < timestamp_);
       jitter_buffer_->ReleaseFrame(testFrame);
     }
   }
diff --git a/modules/video_coding/receiver.cc b/modules/video_coding/receiver.cc
index a1eeded..4ed61da 100644
--- a/modules/video_coding/receiver.cc
+++ b/modules/video_coding/receiver.cc
@@ -140,7 +140,7 @@
       jitter_buffer_.NextCompleteFrame(max_wait_time_ms);
 
   if (found_frame) {
-    frame_timestamp = found_frame->TimeStamp();
+    frame_timestamp = found_frame->Timestamp();
     min_playout_delay_ms = found_frame->EncodedImage().playout_delay_.min_ms;
     max_playout_delay_ms = found_frame->EncodedImage().playout_delay_.max_ms;
   } else {
@@ -212,7 +212,7 @@
     return NULL;
   }
   frame->SetRenderTime(render_time_ms);
-  TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", frame->TimeStamp(), "SetRenderTS",
+  TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", frame->Timestamp(), "SetRenderTS",
                           "render_time", frame->RenderTimeMs());
   if (!frame->Complete()) {
     // Update stats for incomplete frames.
diff --git a/test/fuzzers/frame_buffer2_fuzzer.cc b/test/fuzzers/frame_buffer2_fuzzer.cc
index 57f0c74..2d58309 100644
--- a/test/fuzzers/frame_buffer2_fuzzer.cc
+++ b/test/fuzzers/frame_buffer2_fuzzer.cc
@@ -57,7 +57,6 @@
   ~FuzzyFrameObject() {}
 
   bool GetBitstream(uint8_t* destination) const override { return false; }
-  uint32_t Timestamp() const override { return timestamp; }
   int64_t ReceivedTime() const override { return 0; }
   int64_t RenderTime() const override { return _renderTimeMs; }
 };
@@ -76,7 +75,7 @@
       std::unique_ptr<FuzzyFrameObject> frame(new FuzzyFrameObject());
       frame->id.picture_id = reader.GetNum<int64_t>();
       frame->id.spatial_layer = reader.GetNum<uint8_t>();
-      frame->timestamp = reader.GetNum<uint32_t>();
+      frame->SetTimestamp(reader.GetNum<uint32_t>());
       frame->num_references = reader.GetNum<uint8_t>() %
                               video_coding::EncodedFrame::kMaxFrameReferences;
 
diff --git a/video/video_stream_decoder_impl.cc b/video/video_stream_decoder_impl.cc
index 19e75a8..ef2d969 100644
--- a/video/video_stream_decoder_impl.cc
+++ b/video/video_stream_decoder_impl.cc
@@ -186,7 +186,7 @@
     }
 
     int64_t decode_start_time_ms = rtc::TimeMillis();
-    int64_t timestamp = frame->timestamp;
+    int64_t timestamp = frame->Timestamp();
     int64_t render_time_us = frame->RenderTimeMs() * 1000;
     bookkeeping_queue_.PostTask(
         [this, decode_start_time_ms, timestamp, render_time_us]() {