Renamed FrameObject to EncodedFrame.

The plan is to:
 1. Move FrameObject to api/video.
 2. Rename FrameObject to EncodedFrame.
 3. Move EncodedFrame out of the video_coding namespace.

This is the 2nd CL.

Bug: webrtc:8909
Change-Id: I5e76a0a3b306156b8bc1de67834b4adf14bebef9
Reviewed-on: https://webrtc-review.googlesource.com/56182
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22158}
diff --git a/api/video/encoded_frame.h b/api/video/encoded_frame.h
index 0b506be..09b0592 100644
--- a/api/video/encoded_frame.h
+++ b/api/video/encoded_frame.h
@@ -16,14 +16,13 @@
 namespace webrtc {
 namespace video_coding {
 
-// TODO(philipel): Rename FrameObject to EncodedFrame.
 // TODO(philipel): Remove webrtc::VCMEncodedFrame inheritance.
-class FrameObject : public webrtc::VCMEncodedFrame {
+class EncodedFrame : public webrtc::VCMEncodedFrame {
  public:
   static const uint8_t kMaxFrameReferences = 5;
 
-  FrameObject() = default;
-  virtual ~FrameObject() {}
+  EncodedFrame() = default;
+  virtual ~EncodedFrame() {}
 
   virtual bool GetBitstream(uint8_t* destination) const = 0;
 
@@ -59,6 +58,9 @@
   bool inter_layer_predicted = false;
 };
 
+// TODO(philipel): Remove this when downstream projects have been updated.
+using FrameObject = EncodedFrame;
+
 }  // namespace video_coding
 }  // namespace webrtc
 
diff --git a/modules/video_coding/frame_buffer2.cc b/modules/video_coding/frame_buffer2.cc
index 87fc498..db09e76 100644
--- a/modules/video_coding/frame_buffer2.cc
+++ b/modules/video_coding/frame_buffer2.cc
@@ -60,7 +60,7 @@
 
 FrameBuffer::ReturnReason FrameBuffer::NextFrame(
     int64_t max_wait_time_ms,
-    std::unique_ptr<FrameObject>* frame_out,
+    std::unique_ptr<EncodedFrame>* frame_out,
     bool keyframe_required) {
   TRACE_EVENT0("webrtc", "FrameBuffer::NextFrame");
   int64_t latest_return_time_ms =
@@ -106,7 +106,7 @@
           continue;
         }
 
-        FrameObject* frame = frame_it->second.frame.get();
+        EncodedFrame* frame = frame_it->second.frame.get();
 
         if (keyframe_required && !frame->is_keyframe())
           continue;
@@ -134,7 +134,7 @@
     rtc::CritScope lock(&crit_);
     now_ms = clock_->TimeInMilliseconds();
     if (next_frame_it_ != frames_.end()) {
-      std::unique_ptr<FrameObject> frame =
+      std::unique_ptr<EncodedFrame> frame =
           std::move(next_frame_it_->second.frame);
 
       if (!frame->delayed_by_retransmission()) {
@@ -208,7 +208,8 @@
   return kTimeout;
 }
 
-bool FrameBuffer::HasBadRenderTiming(const FrameObject& frame, int64_t now_ms) {
+bool FrameBuffer::HasBadRenderTiming(const EncodedFrame& frame,
+                                     int64_t now_ms) {
   // Assume that render timing errors are due to changes in the video stream.
   int64_t render_time_ms = frame.RenderTimeMs();
   const int64_t kMaxVideoDelayMs = 10000;
@@ -255,7 +256,7 @@
   jitter_estimator_->UpdateRtt(rtt_ms);
 }
 
-bool FrameBuffer::ValidReferences(const FrameObject& frame) const {
+bool FrameBuffer::ValidReferences(const EncodedFrame& frame) const {
   if (frame.picture_id < 0)
     return false;
 
@@ -275,7 +276,7 @@
   return true;
 }
 
-void FrameBuffer::UpdatePlayoutDelays(const FrameObject& frame) {
+void FrameBuffer::UpdatePlayoutDelays(const EncodedFrame& frame) {
   TRACE_EVENT0("webrtc", "FrameBuffer::UpdatePlayoutDelays");
   PlayoutDelay playout_delay = frame.EncodedImage().playout_delay_;
   if (playout_delay.min_ms >= 0)
@@ -285,7 +286,7 @@
     timing_->set_max_playout_delay(playout_delay.max_ms);
 }
 
-int64_t FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) {
+int64_t FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
   TRACE_EVENT0("webrtc", "FrameBuffer::InsertFrame");
   RTC_DCHECK(frame);
   if (stats_callback_)
@@ -459,7 +460,7 @@
   }
 }
 
-bool FrameBuffer::UpdateFrameInfoWithIncomingFrame(const FrameObject& frame,
+bool FrameBuffer::UpdateFrameInfoWithIncomingFrame(const EncodedFrame& frame,
                                                    FrameMap::iterator info) {
   TRACE_EVENT0("webrtc", "FrameBuffer::UpdateFrameInfoWithIncomingFrame");
   FrameKey key(frame.picture_id, frame.spatial_layer);
diff --git a/modules/video_coding/frame_buffer2.h b/modules/video_coding/frame_buffer2.h
index 19fd94e..df8d8fe 100644
--- a/modules/video_coding/frame_buffer2.h
+++ b/modules/video_coding/frame_buffer2.h
@@ -16,7 +16,7 @@
 #include <memory>
 #include <utility>
 
-#include "modules/video_coding/frame_object.h"
+#include "api/video/encoded_frame.h"
 #include "modules/video_coding/include/video_coding_defines.h"
 #include "modules/video_coding/inter_frame_delay.h"
 #include "rtc_base/constructormagic.h"
@@ -47,7 +47,7 @@
 
   // Insert a frame into the frame buffer. Returns the picture id
   // of the last continuous frame or -1 if there is no continuous frame.
-  int64_t InsertFrame(std::unique_ptr<FrameObject> frame);
+  int64_t InsertFrame(std::unique_ptr<EncodedFrame> frame);
 
   // Get the next frame for decoding. Will return at latest after
   // |max_wait_time_ms|.
@@ -57,7 +57,7 @@
   //    kTimeout.
   //  - If the FrameBuffer is stopped then it will return kStopped.
   ReturnReason NextFrame(int64_t max_wait_time_ms,
-                         std::unique_ptr<FrameObject>* frame_out,
+                         std::unique_ptr<EncodedFrame>* frame_out,
                          bool keyframe_required = false);
 
   // Tells the FrameBuffer which protection mode that is in use. Affects
@@ -120,18 +120,18 @@
     // If this frame is continuous or not.
     bool continuous = false;
 
-    // The actual FrameObject.
-    std::unique_ptr<FrameObject> frame;
+    // The actual EncodedFrame.
+    std::unique_ptr<EncodedFrame> frame;
   };
 
   using FrameMap = std::map<FrameKey, FrameInfo>;
 
   // Check that the references of |frame| are valid.
-  bool ValidReferences(const FrameObject& frame) const;
+  bool ValidReferences(const EncodedFrame& frame) const;
 
   // Updates the minimal and maximal playout delays
   // depending on the frame.
-  void UpdatePlayoutDelays(const FrameObject& frame)
+  void UpdatePlayoutDelays(const EncodedFrame& frame)
       RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_);
 
   // Update all directly dependent and indirectly dependent frames and mark
@@ -151,7 +151,7 @@
   // Update the corresponding FrameInfo of |frame| and all FrameInfos that
   // |frame| references.
   // Return false if |frame| will never be decodable, true otherwise.
-  bool UpdateFrameInfoWithIncomingFrame(const FrameObject& frame,
+  bool UpdateFrameInfoWithIncomingFrame(const EncodedFrame& frame,
                                         FrameMap::iterator info)
       RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_);
 
@@ -161,7 +161,7 @@
 
   void ClearFramesAndHistory() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_);
 
-  bool HasBadRenderTiming(const FrameObject& frame, int64_t now_ms)
+  bool HasBadRenderTiming(const EncodedFrame& frame, int64_t now_ms)
       RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_);
 
   FrameMap frames_ RTC_GUARDED_BY(crit_);
diff --git a/modules/video_coding/frame_buffer2_unittest.cc b/modules/video_coding/frame_buffer2_unittest.cc
index 9cdd81b..12151d4 100644
--- a/modules/video_coding/frame_buffer2_unittest.cc
+++ b/modules/video_coding/frame_buffer2_unittest.cc
@@ -86,7 +86,7 @@
   MOCK_METHOD1(GetJitterEstimate, int(double rttMultiplier));
 };
 
-class FrameObjectFake : public FrameObject {
+class FrameObjectFake : public EncodedFrame {
  public:
   bool GetBitstream(uint8_t* destination) const override { return true; }
 
@@ -155,7 +155,7 @@
                   bool inter_layer_predicted,
                   T... refs) {
     static_assert(sizeof...(refs) <= kMaxReferences,
-                  "To many references specified for FrameObject.");
+                  "To many references specified for EncodedFrame.");
     std::array<uint16_t, sizeof...(refs)> references = {
         {rtc::checked_cast<uint16_t>(refs)...}};
 
@@ -174,7 +174,7 @@
   void ExtractFrame(int64_t max_wait_time = 0, bool keyframe_required = false) {
     crit_.Enter();
     if (max_wait_time == 0) {
-      std::unique_ptr<FrameObject> frame;
+      std::unique_ptr<EncodedFrame> frame;
       FrameBuffer::ReturnReason res =
           buffer_.NextFrame(0, &frame, keyframe_required);
       if (res != FrameBuffer::ReturnReason::kStopped)
@@ -213,7 +213,7 @@
         if (tfb->tear_down_)
           return;
 
-        std::unique_ptr<FrameObject> frame;
+        std::unique_ptr<EncodedFrame> frame;
         FrameBuffer::ReturnReason res =
             tfb->buffer_.NextFrame(tfb->max_wait_time_, &frame);
         if (res != FrameBuffer::ReturnReason::kStopped)
@@ -228,7 +228,7 @@
   VCMTimingFake timing_;
   ::testing::NiceMock<VCMJitterEstimatorMock> jitter_estimator_;
   FrameBuffer buffer_;
-  std::vector<std::unique_ptr<FrameObject>> frames_;
+  std::vector<std::unique_ptr<EncodedFrame>> frames_;
   Random rand_;
   ::testing::NiceMock<VCMReceiveStatisticsCallbackMock> stats_callback_;
 
diff --git a/modules/video_coding/frame_object.cc b/modules/video_coding/frame_object.cc
index 3bb5283..4aa18ba 100644
--- a/modules/video_coding/frame_object.cc
+++ b/modules/video_coding/frame_object.cc
@@ -32,11 +32,11 @@
   VCMPacket* first_packet = packet_buffer_->GetPacket(first_seq_num);
   RTC_CHECK(first_packet);
 
-  // RtpFrameObject members
+  // EncodedFrame members
   frame_type_ = first_packet->frameType;
   codec_type_ = first_packet->codec;
 
-  // TODO(philipel): Remove when encoded image is replaced by FrameObject.
+  // TODO(philipel): Remove when encoded image is replaced by EncodedFrame.
   // VCMEncodedFrame members
   CopyCodecSpecific(&first_packet->video_header);
   _completeFrame = true;
@@ -68,7 +68,7 @@
   _encodedWidth = first_packet->width;
   _encodedHeight = first_packet->height;
 
-  // FrameObject members
+  // EncodedFrame members
   timestamp = first_packet->timestamp;
 
   VCMPacket* last_packet = packet_buffer_->GetPacket(last_seq_num);
diff --git a/modules/video_coding/frame_object.h b/modules/video_coding/frame_object.h
index 72b719c..69c1cde 100644
--- a/modules/video_coding/frame_object.h
+++ b/modules/video_coding/frame_object.h
@@ -21,7 +21,7 @@
 
 class PacketBuffer;
 
-class RtpFrameObject : public FrameObject {
+class RtpFrameObject : public EncodedFrame {
  public:
   RtpFrameObject(PacketBuffer* packet_buffer,
                  uint16_t first_seq_num,
diff --git a/modules/video_coding/packet_buffer.h b/modules/video_coding/packet_buffer.h
index 869a81c..9b1228d 100644
--- a/modules/video_coding/packet_buffer.h
+++ b/modules/video_coding/packet_buffer.h
@@ -30,7 +30,6 @@
 
 namespace video_coding {
 
-class FrameObject;
 class RtpFrameObject;
 
 // A received frame is a frame which has received all its packets.
diff --git a/modules/video_coding/rtp_frame_reference_finder.h b/modules/video_coding/rtp_frame_reference_finder.h
index 95da4f3..00e638d 100644
--- a/modules/video_coding/rtp_frame_reference_finder.h
+++ b/modules/video_coding/rtp_frame_reference_finder.h
@@ -26,7 +26,7 @@
 namespace webrtc {
 namespace video_coding {
 
-class FrameObject;
+class EncodedFrame;
 class RtpFrameObject;
 
 // A complete frame is a frame which has received all its packets and all its
@@ -34,7 +34,7 @@
 class OnCompleteFrameCallback {
  public:
   virtual ~OnCompleteFrameCallback() {}
-  virtual void OnCompleteFrame(std::unique_ptr<FrameObject> frame) = 0;
+  virtual void OnCompleteFrame(std::unique_ptr<EncodedFrame> frame) = 0;
 };
 
 class RtpFrameReferenceFinder {
diff --git a/modules/video_coding/rtp_frame_reference_finder_unittest.cc b/modules/video_coding/rtp_frame_reference_finder_unittest.cc
index 5a81987..de02a43 100644
--- a/modules/video_coding/rtp_frame_reference_finder_unittest.cc
+++ b/modules/video_coding/rtp_frame_reference_finder_unittest.cc
@@ -64,7 +64,7 @@
 
   uint16_t Rand() { return rand_.Rand<uint16_t>(); }
 
-  void OnCompleteFrame(std::unique_ptr<FrameObject> frame) override {
+  void OnCompleteFrame(std::unique_ptr<EncodedFrame> frame) override {
     int64_t pid = frame->picture_id;
     uint16_t sidx = frame->spatial_layer;
     auto frame_it = frames_from_callback_.find(std::make_pair(pid, sidx));
@@ -260,8 +260,9 @@
       return f1.first < f2.first;
     }
   };
-  std::map<std::pair<int64_t, uint8_t>, std::unique_ptr<FrameObject>, FrameComp>
-      frames_from_callback_;
+  std::
+      map<std::pair<int64_t, uint8_t>, std::unique_ptr<EncodedFrame>, FrameComp>
+          frames_from_callback_;
 };
 
 TEST_F(TestRtpFrameReferenceFinder, PaddingPackets) {
diff --git a/video/rtp_video_stream_receiver.cc b/video/rtp_video_stream_receiver.cc
index e01e85f..d6503b2 100644
--- a/video/rtp_video_stream_receiver.cc
+++ b/video/rtp_video_stream_receiver.cc
@@ -395,7 +395,7 @@
 }
 
 void RtpVideoStreamReceiver::OnCompleteFrame(
-    std::unique_ptr<video_coding::FrameObject> frame) {
+    std::unique_ptr<video_coding::EncodedFrame> frame) {
   {
     rtc::CritScope lock(&last_seq_num_cs_);
     video_coding::RtpFrameObject* rtp_frame =
diff --git a/video/rtp_video_stream_receiver.h b/video/rtp_video_stream_receiver.h
index 71cb5db..da8b837 100644
--- a/video/rtp_video_stream_receiver.h
+++ b/video/rtp_video_stream_receiver.h
@@ -135,7 +135,7 @@
 
   // Implements OnCompleteFrameCallback.
   void OnCompleteFrame(
-      std::unique_ptr<video_coding::FrameObject> frame) override;
+      std::unique_ptr<video_coding::EncodedFrame> frame) override;
 
   void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;
 
diff --git a/video/rtp_video_stream_receiver_unittest.cc b/video/rtp_video_stream_receiver_unittest.cc
index cc9e61f..5526ee8 100644
--- a/video/rtp_video_stream_receiver_unittest.cc
+++ b/video/rtp_video_stream_receiver_unittest.cc
@@ -61,14 +61,14 @@
  public:
   MockOnCompleteFrameCallback() : buffer_(rtc::ByteBuffer::ORDER_NETWORK) {}
 
-  MOCK_METHOD1(DoOnCompleteFrame, void(video_coding::FrameObject* frame));
+  MOCK_METHOD1(DoOnCompleteFrame, void(video_coding::EncodedFrame* frame));
   MOCK_METHOD1(DoOnCompleteFrameFailNullptr,
-               void(video_coding::FrameObject* frame));
+               void(video_coding::EncodedFrame* frame));
   MOCK_METHOD1(DoOnCompleteFrameFailLength,
-               void(video_coding::FrameObject* frame));
+               void(video_coding::EncodedFrame* frame));
   MOCK_METHOD1(DoOnCompleteFrameFailBitstream,
-               void(video_coding::FrameObject* frame));
-  void OnCompleteFrame(std::unique_ptr<video_coding::FrameObject> frame) {
+               void(video_coding::EncodedFrame* frame));
+  void OnCompleteFrame(std::unique_ptr<video_coding::EncodedFrame> frame) {
     if (!frame) {
       DoOnCompleteFrameFailNullptr(nullptr);
       return;
diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc
index 9a572ca..0990311 100644
--- a/video/video_receive_stream.cc
+++ b/video/video_receive_stream.cc
@@ -355,7 +355,7 @@
 }
 
 void VideoReceiveStream::OnCompleteFrame(
-    std::unique_ptr<video_coding::FrameObject> frame) {
+    std::unique_ptr<video_coding::EncodedFrame> frame) {
   int64_t last_continuous_pid = frame_buffer_->InsertFrame(std::move(frame));
   if (last_continuous_pid != -1)
     rtp_video_stream_receiver_.FrameContinuous(last_continuous_pid);
@@ -416,7 +416,7 @@
   static const int kMaxWaitForKeyFrameMs = 200;
 
   int wait_ms = keyframe_required_ ? kMaxWaitForKeyFrameMs : kMaxWaitForFrameMs;
-  std::unique_ptr<video_coding::FrameObject> frame;
+  std::unique_ptr<video_coding::EncodedFrame> frame;
   // TODO(philipel): Call NextFrame with |keyframe_required| argument when
   //                 downstream project has been fixed.
   video_coding::FrameBuffer::ReturnReason res =
diff --git a/video/video_receive_stream.h b/video/video_receive_stream.h
index 60afd8d..2ca4026 100644
--- a/video/video_receive_stream.h
+++ b/video/video_receive_stream.h
@@ -101,7 +101,7 @@
 
   // Implements video_coding::OnCompleteFrameCallback.
   void OnCompleteFrame(
-      std::unique_ptr<video_coding::FrameObject> frame) override;
+      std::unique_ptr<video_coding::EncodedFrame> frame) override;
 
   // Implements CallStatsObserver::OnRttUpdate
   void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;