Add EncodedImageCallback::OnEncodedImage().

OnEncodedImage() is going to replace Encoded(), which is deprecated now.
The new OnEncodedImage() returns Result struct that contains frame_id,
which tells the encoder RTP timestamp for the frame.

BUG=chromium:621691
R=niklas.enbom@webrtc.org, sprang@webrtc.org, stefan@webrtc.org

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

Committed: https://crrev.com/ad34dbe934d47f88011045671b4aea00dbd5a795
Cr-Original-Commit-Position: refs/heads/master@{#13613}
Cr-Commit-Position: refs/heads/master@{#13615}
diff --git a/webrtc/modules/video_coding/generic_encoder.cc b/webrtc/modules/video_coding/generic_encoder.cc
index e63da02..28eb10a 100644
--- a/webrtc/modules/video_coding/generic_encoder.cc
+++ b/webrtc/modules/video_coding/generic_encoder.cc
@@ -21,6 +21,7 @@
 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
 
 namespace webrtc {
+
 VCMGenericEncoder::VCMGenericEncoder(
     VideoEncoder* encoder,
     VCMEncodedFrameCallback* encoded_frame_callback,
@@ -143,23 +144,25 @@
 
 VCMEncodedFrameCallback::~VCMEncodedFrameCallback() {}
 
-int32_t VCMEncodedFrameCallback::Encoded(
+EncodedImageCallback::Result VCMEncodedFrameCallback::OnEncodedImage(
     const EncodedImage& encoded_image,
     const CodecSpecificInfo* codec_specific,
     const RTPFragmentationHeader* fragmentation_header) {
   TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded",
                        "timestamp", encoded_image._timeStamp);
-  int ret_val = post_encode_callback_->Encoded(encoded_image, codec_specific,
-                                               fragmentation_header);
-  if (ret_val < 0)
-    return ret_val;
+  Result result = post_encode_callback_->OnEncodedImage(
+      encoded_image, codec_specific, fragmentation_header);
+  if (result.error != Result::OK)
+    return result;
 
   if (media_opt_) {
     media_opt_->UpdateWithEncodedData(encoded_image);
-    if (internal_source_)
-      return media_opt_->DropFrame();  // Signal to encoder to drop next frame.
+    if (internal_source_) {
+      // Signal to encoder to drop next frame.
+      result.drop_next_frame = media_opt_->DropFrame();
+    }
   }
-  return VCM_OK;
+  return result;
 }
 
 }  // namespace webrtc