Revert of Deliver video frames on Android, on the decode thread. (patchset #7 id:120001 of https://codereview.webrtc.org/2764573002/ )

Reason for revert:
Breaks Chrome FYI Android bots.

See:
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/20418
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus6%29/builds/14724
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/builds/20133
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28K%20Nexus5%29/builds/15111

Original issue's description:
> Deliver video frames on Android, on the decode thread.
>
> VideoCoding
> * Adding a method for polling for frames on Android only until the capture implementation takes care of this (longer term plan).
>
> CodecDatabase
> * Add an accessor for the current decoder
> * Use std::unique_ptr<> for ownership.
> * Remove "Release()" and "ReleaseDecoder()". Instead just delete.
> * Remove |friend| relationship between CodecDatabase and VCMGenericDecoder.
>
> VCMDecodedFrameCallback
> * DCHECKs for thread correctness.
> * Remove |lock_| now that a threading model has been established and verified.
>
> VCMGenericDecoder
> * All methods now have thread checks.
> * Variable access associated with thread checkers.
>
> VideoReceiver
> * Added two notification methods, DecoderThreadStarting() and DecoderThreadStopped()
>   * Allows us to establish a period when the decoder thread is not running and it is safe to modify variables such as callbacks, that are only read when the decoder thread is running.
>   * Allows us to DCHECK thread guarantees.
>   * Allows synchronizing callbacks from the module process thread and have them only active while the decoder thread is running.
>   * The above, allows us to establish two modes for the thread, single-threaded-mutable and multi-threaded-const.
>   * Using that knowledge, we can remove |receive_crit_| as well as locking for a number of member variables.
>
> MediaCodecVideoDecoder
> * Removed frame polling code from this class, since this is now done from the root thread function in VideoReceiveStream.
>
> VideoReceiveStream
> * On Android: Polls for decoded frames every 10ms (same interval as previously in MediaCodecVideoDecoder)
> * [Un]Registers the |video_receiver_| with the module thread only around the time the decoder thread is started/stopped.
> * Notifies the receiver of start/stop events of the decoder thread.
> * Changed the decoder thread to use the new PlatformThread callback type.
>
> BUG=webrtc:7361, 695438
>
> Review-Url: https://codereview.webrtc.org/2764573002
> Cr-Commit-Position: refs/heads/master@{#17527}
> Committed: https://chromium.googlesource.com/external/webrtc/+/e3aa88bbd5accadec73fa7e38584dfbf6aabe8a9

TBR=sakal@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org,tommi@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7361, 695438

Review-Url: https://codereview.webrtc.org/2792033003
Cr-Commit-Position: refs/heads/master@{#17530}
diff --git a/webrtc/modules/video_coding/video_coding_impl.h b/webrtc/modules/video_coding/video_coding_impl.h
index d6e722d..5e547df 100644
--- a/webrtc/modules/video_coding/video_coding_impl.h
+++ b/webrtc/modules/video_coding/video_coding_impl.h
@@ -35,7 +35,6 @@
 
 namespace webrtc {
 
-class ProcessThread;
 class VideoBitrateAllocator;
 class VideoBitrateAllocationObserver;
 
@@ -151,7 +150,7 @@
                 VCMTiming* timing,
                 NackSender* nack_sender = nullptr,
                 KeyFrameRequestSender* keyframe_request_sender = nullptr);
-  ~VideoReceiver() override;
+  ~VideoReceiver();
 
   int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec,
                                int32_t numberOfCores,
@@ -169,10 +168,8 @@
 
   int32_t Decode(const webrtc::VCMEncodedFrame* frame);
 
-#if defined(WEBRTC_ANDROID)
-  // See https://bugs.chromium.org/p/webrtc/issues/detail?id=7361
-  void PollDecodedFrames();
-#endif
+  // Called on the decoder thread when thread is exiting.
+  void DecodingStopped();
 
   int32_t IncomingPacket(const uint8_t* incomingPayload,
                          size_t payloadLength,
@@ -198,66 +195,39 @@
 
   int64_t TimeUntilNextProcess() override;
   void Process() override;
-  void ProcessThreadAttached(ProcessThread* process_thread) override;
 
   void TriggerDecoderShutdown();
-  void DecoderThreadStarting();
-  void DecoderThreadStopped();
 
  protected:
-  int32_t Decode(const webrtc::VCMEncodedFrame& frame);
+  int32_t Decode(const webrtc::VCMEncodedFrame& frame)
+      EXCLUSIVE_LOCKS_REQUIRED(receive_crit_);
   int32_t RequestKeyFrame();
 
  private:
-  // Used for DCHECKing thread correctness.
-  // In build where DCHECKs are enabled, will return false before
-  // DecoderThreadStarting is called, then true until DecoderThreadStopped
-  // is called.
-  // In builds where DCHECKs aren't enabled, it will return true.
-  bool IsDecoderThreadRunning();
-
   rtc::ThreadChecker construction_thread_;
-  rtc::ThreadChecker decoder_thread_;
-  rtc::ThreadChecker module_thread_;
   Clock* const clock_;
   rtc::CriticalSection process_crit_;
+  rtc::CriticalSection receive_crit_;
   VCMTiming* _timing;
   VCMReceiver _receiver;
   VCMDecodedFrameCallback _decodedFrameCallback;
+  VCMFrameTypeCallback* _frameTypeCallback GUARDED_BY(process_crit_);
+  VCMReceiveStatisticsCallback* _receiveStatsCallback GUARDED_BY(process_crit_);
+  VCMPacketRequestCallback* _packetRequestCallback GUARDED_BY(process_crit_);
 
-  // These callbacks are set on the construction thread before being attached
-  // to the module thread or decoding started, so a lock is not required.
-  VCMFrameTypeCallback* _frameTypeCallback;
-  VCMReceiveStatisticsCallback* _receiveStatsCallback;
-  VCMPacketRequestCallback* _packetRequestCallback;
-
-  // Used on both the module and decoder thread.
+  VCMFrameBuffer _frameFromFile;
   bool _scheduleKeyRequest GUARDED_BY(process_crit_);
   bool drop_frames_until_keyframe_ GUARDED_BY(process_crit_);
+  size_t max_nack_list_size_ GUARDED_BY(process_crit_);
 
-  // Modified on the construction thread while not attached to the process
-  // thread.  Once attached to the process thread, its value is only read
-  // so a lock is not required.
-  size_t max_nack_list_size_;
+  VCMCodecDataBase _codecDataBase GUARDED_BY(receive_crit_);
+  EncodedImageCallback* pre_decode_image_callback_;
 
-  // Callbacks are set before the decoder thread starts.
-  // Once the decoder thread has been started, usage of |_codecDataBase| moves
-  // over to the decoder thread.
-  VCMCodecDataBase _codecDataBase;
-  EncodedImageCallback* const pre_decode_image_callback_;
-
-  VCMProcessTimer _receiveStatsTimer ACCESS_ON(module_thread_);
-  VCMProcessTimer _retransmissionTimer ACCESS_ON(module_thread_);
-  VCMProcessTimer _keyRequestTimer ACCESS_ON(module_thread_);
-  QpParser qp_parser_ ACCESS_ON(decoder_thread_);
-  ThreadUnsafeOneTimeEvent first_frame_received_ ACCESS_ON(decoder_thread_);
-  // Modified on the construction thread. Can be read without a lock and assumed
-  // to be non-null on the module and decoder threads.
-  ProcessThread* process_thread_ = nullptr;
-  bool is_attached_to_process_thread_ ACCESS_ON(construction_thread_) = false;
-#if RTC_DCHECK_IS_ON
-  bool decoder_thread_is_running_ = false;
-#endif
+  VCMProcessTimer _receiveStatsTimer;
+  VCMProcessTimer _retransmissionTimer;
+  VCMProcessTimer _keyRequestTimer;
+  QpParser qp_parser_;
+  ThreadUnsafeOneTimeEvent first_frame_received_;
 };
 
 }  // namespace vcm