Revert of Remove the deprecated EncodeInternal interface from AudioEncoder (patchset #4 id:60001 of https://codereview.webrtc.org/1864993002/ )

Reason for revert:
Broke import. Implementations of the old interface still exists somewhere.

Original issue's description:
> Remove the deprecated EncodeInternal interface from AudioEncoder
>
> Also hid MaxEncodedBytes by making it private. It will get removed as soon as subclasses have had time to remove their overrides.
>
> BUG=webrtc:5591
>
> Committed: https://crrev.com/5222d315dbea8f3563c100cc9f2451907f70b05f
> Cr-Commit-Position: refs/heads/master@{#12329}

TBR=kwiberg@webrtc.org,solenberg@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5591

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

Cr-Commit-Position: refs/heads/master@{#12330}
diff --git a/webrtc/modules/audio_coding/codecs/audio_encoder.h b/webrtc/modules/audio_coding/codecs/audio_encoder.h
index 58d9fff..3fdee25 100644
--- a/webrtc/modules/audio_coding/codecs/audio_encoder.h
+++ b/webrtc/modules/audio_coding/codecs/audio_encoder.h
@@ -52,6 +52,14 @@
 
   virtual ~AudioEncoder() = default;
 
+  // Returns the maximum number of bytes that can be produced by the encoder
+  // at each Encode() call. The caller can use the return value to determine
+  // the size of the buffer that needs to be allocated. This value is allowed
+  // to depend on encoder parameters like bitrate, frame size etc., so if
+  // any of these change, the caller of Encode() is responsible for checking
+  // that the buffer is large enough by calling MaxEncodedBytes() again.
+  virtual size_t MaxEncodedBytes() const = 0;
+
   // Returns the input sample rate in Hz and the number of input channels.
   // These are constants set at instantiation time.
   virtual int SampleRateHz() const = 0;
@@ -87,6 +95,33 @@
                      rtc::ArrayView<const int16_t> audio,
                      rtc::Buffer* encoded);
 
+  // Deprecated interface to Encode (remove eventually, bug 5591). May incur a
+  // copy. The encoder produces zero or more bytes of output in |encoded| and
+  // returns additional encoding information.  The caller is responsible for
+  // making sure that |max_encoded_bytes| is not smaller than the number of
+  // bytes actually produced by the encoder.
+  RTC_DEPRECATED EncodedInfo Encode(uint32_t rtp_timestamp,
+                                    rtc::ArrayView<const int16_t> audio,
+                                    size_t max_encoded_bytes,
+                                    uint8_t* encoded);
+
+  EncodedInfo DEPRECATED_Encode(uint32_t rtp_timestamp,
+                                rtc::ArrayView<const int16_t> audio,
+                                size_t max_encoded_bytes,
+                                uint8_t* encoded);
+
+  // Deprecated interface EncodeInternal (see bug 5591). May incur a copy.
+  // Subclasses implement this to perform the actual encoding. Called by
+  // Encode(). By default, this is implemented as a call to the newer
+  // EncodeImpl() that accepts an rtc::Buffer instead of a raw pointer.
+  // That version is protected, so see below. At least one of EncodeInternal
+  // or EncodeImpl _must_ be implemented by a subclass.
+  virtual EncodedInfo EncodeInternal(
+      uint32_t rtp_timestamp,
+      rtc::ArrayView<const int16_t> audio,
+      size_t max_encoded_bytes,
+      uint8_t* encoded);
+
   // Resets the encoder to its starting state, discarding any input that has
   // been fed to the encoder but not yet emitted in a packet.
   virtual void Reset() = 0;
@@ -127,19 +162,13 @@
 
  protected:
   // Subclasses implement this to perform the actual encoding. Called by
-  // Encode().
+  // Encode(). For compatibility reasons, this is implemented by default as a
+  // call to the older interface EncodeInternal(). At least one of
+  // EncodeInternal or EncodeImpl _must_ be implemented by a
+  // subclass. Preferably this one.
   virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
                                  rtc::ArrayView<const int16_t> audio,
-                                 rtc::Buffer* encoded) = 0;
-
- private:
-  // This function is deprecated. It was used to return the maximum number of
-  // bytes that can be produced by the encoder at each Encode() call.  Since the
-  // Encode interface was changed to use rtc::Buffer, this is no longer
-  // applicable. It is only kept in to avoid breaking subclasses that still have
-  // it implemented (with the override attribute). It will be removed as soon
-  // as these subclasses have been given a chance to change.
-  virtual size_t MaxEncodedBytes() const;
+                                 rtc::Buffer* encoded);
 };
 }  // namespace webrtc
 #endif  // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_