Get rid of unnecessary cast of FlexfecReceiveStreamImpl to FlexfecReceiveStream

BUG=None

Review-Url: https://codereview.webrtc.org/2967913002
Cr-Commit-Position: refs/heads/master@{#19131}
diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc
index 1a78d8e..6475e00 100644
--- a/webrtc/call/call.cc
+++ b/webrtc/call/call.cc
@@ -885,15 +885,10 @@
   RTC_DCHECK_RUN_ON(&configuration_thread_checker_);
 
   RTC_DCHECK(receive_stream != nullptr);
-  // There exist no other derived classes of FlexfecReceiveStream,
-  // so this downcast is safe.
-  FlexfecReceiveStreamImpl* receive_stream_impl =
-      static_cast<FlexfecReceiveStreamImpl*>(receive_stream);
   {
     WriteLockScoped write_lock(*receive_crit_);
 
-    const FlexfecReceiveStream::Config& config =
-        receive_stream_impl->GetConfig();
+    const FlexfecReceiveStream::Config& config = receive_stream->GetConfig();
     uint32_t ssrc = config.remote_ssrc;
     receive_rtp_config_.erase(ssrc);
 
@@ -903,7 +898,7 @@
         ->RemoveStream(ssrc);
   }
 
-  delete receive_stream_impl;
+  delete receive_stream;
 }
 
 Call::Stats Call::GetStats() const {
diff --git a/webrtc/call/flexfec_receive_stream.h b/webrtc/call/flexfec_receive_stream.h
index babeee0..353811a 100644
--- a/webrtc/call/flexfec_receive_stream.h
+++ b/webrtc/call/flexfec_receive_stream.h
@@ -23,6 +23,8 @@
 
 class FlexfecReceiveStream {
  public:
+  virtual ~FlexfecReceiveStream() = default;
+
   struct Stats {
     std::string ToString(int64_t time_ms) const;
 
@@ -82,8 +84,7 @@
 
   virtual Stats GetStats() const = 0;
 
- protected:
-  virtual ~FlexfecReceiveStream() = default;
+  virtual const Config& GetConfig() const = 0;
 };
 
 }  // namespace webrtc
diff --git a/webrtc/call/flexfec_receive_stream_impl.cc b/webrtc/call/flexfec_receive_stream_impl.cc
index a1e9bc6..16edadd 100644
--- a/webrtc/call/flexfec_receive_stream_impl.cc
+++ b/webrtc/call/flexfec_receive_stream_impl.cc
@@ -206,4 +206,9 @@
   return FlexfecReceiveStream::Stats();
 }
 
+const FlexfecReceiveStream::Config& FlexfecReceiveStreamImpl::GetConfig()
+    const {
+  return config_;
+}
+
 }  // namespace webrtc
diff --git a/webrtc/call/flexfec_receive_stream_impl.h b/webrtc/call/flexfec_receive_stream_impl.h
index 81c09d6..de5de41 100644
--- a/webrtc/call/flexfec_receive_stream_impl.h
+++ b/webrtc/call/flexfec_receive_stream_impl.h
@@ -40,8 +40,6 @@
       ProcessThread* process_thread);
   ~FlexfecReceiveStreamImpl() override;
 
-  const Config& GetConfig() const { return config_; }
-
   // RtpPacketSinkInterface.
   void OnRtpPacket(const RtpPacketReceived& packet) override;
 
@@ -49,6 +47,7 @@
   void Start() override;
   void Stop() override;
   Stats GetStats() const override;
+  const Config& GetConfig() const override;
 
  private:
   // Config.
diff --git a/webrtc/media/engine/fakewebrtccall.h b/webrtc/media/engine/fakewebrtccall.h
index 10a5e9f..15f2108 100644
--- a/webrtc/media/engine/fakewebrtccall.h
+++ b/webrtc/media/engine/fakewebrtccall.h
@@ -217,7 +217,7 @@
   explicit FakeFlexfecReceiveStream(
       const webrtc::FlexfecReceiveStream::Config& config);
 
-  const webrtc::FlexfecReceiveStream::Config& GetConfig() const;
+  const webrtc::FlexfecReceiveStream::Config& GetConfig() const override;
 
  private:
   // webrtc::FlexfecReceiveStream implementation.