Move BitrateAllocator from BitrateController logic to Call.

This is a step on the way to have variable bitrate for audio and is
intended to be as much of a no-op as possible.

BUG=webrtc:5079

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

Cr-Original-Commit-Position: refs/heads/master@{#10630}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 0e7e259ebd69993bb5670a991f43aa1b06c9bf9e
diff --git a/call/BUILD.gn b/call/BUILD.gn
index 3abc762..498c724 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -10,6 +10,7 @@
 
 source_set("call") {
   sources = [
+    "bitrate_allocator.cc",
     "call.cc",
     "congestion_controller.cc",
     "transport_adapter.cc",
diff --git a/modules/bitrate_controller/bitrate_allocator.cc b/call/bitrate_allocator.cc
similarity index 97%
rename from modules/bitrate_controller/bitrate_allocator.cc
rename to call/bitrate_allocator.cc
index dc421bb..b3789d3 100644
--- a/modules/bitrate_controller/bitrate_allocator.cc
+++ b/call/bitrate_allocator.cc
@@ -9,7 +9,7 @@
  *
  */
 
-#include "webrtc/modules/bitrate_controller/include/bitrate_allocator.h"
+#include "webrtc/call/bitrate_allocator.h"
 
 #include <algorithm>
 #include <utility>
@@ -136,7 +136,8 @@
 BitrateAllocator::ObserverBitrateMap BitrateAllocator::NormalRateAllocation(
     uint32_t bitrate,
     uint32_t sum_min_bitrates) {
-  uint32_t number_of_observers = bitrate_observers_.size();
+  uint32_t number_of_observers =
+      static_cast<uint32_t>(bitrate_observers_.size());
   uint32_t bitrate_per_observer =
       (bitrate - sum_min_bitrates) / number_of_observers;
   // Use map to sort list based on max bitrate.
diff --git a/modules/bitrate_controller/include/bitrate_allocator.h b/call/bitrate_allocator.h
similarity index 94%
rename from modules/bitrate_controller/include/bitrate_allocator.h
rename to call/bitrate_allocator.h
index 4ee27f3..4a3fd59 100644
--- a/modules/bitrate_controller/include/bitrate_allocator.h
+++ b/call/bitrate_allocator.h
@@ -12,8 +12,8 @@
  *  and push the result to the encoders via BitrateObserver(s).
  */
 
-#ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_ALLOCATOR_H_
-#define WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_ALLOCATOR_H_
+#ifndef WEBRTC_CALL_BITRATE_ALLOCATOR_H_
+#define WEBRTC_CALL_BITRATE_ALLOCATOR_H_
 
 #include <list>
 #include <map>
@@ -99,4 +99,4 @@
   int64_t last_rtt_ GUARDED_BY(crit_sect_);
 };
 }  // namespace webrtc
-#endif  // WEBRTC_MODULES_BITRATE_CONTROLLER_INCLUDE_BITRATE_ALLOCATOR_H_
+#endif  // WEBRTC_CALL_BITRATE_ALLOCATOR_H_
diff --git a/modules/bitrate_controller/bitrate_allocator_unittest.cc b/call/bitrate_allocator_unittest.cc
similarity index 97%
rename from modules/bitrate_controller/bitrate_allocator_unittest.cc
rename to call/bitrate_allocator_unittest.cc
index 4fc7e83..86f75a4 100644
--- a/modules/bitrate_controller/bitrate_allocator_unittest.cc
+++ b/call/bitrate_allocator_unittest.cc
@@ -12,7 +12,7 @@
 #include <vector>
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/modules/bitrate_controller/include/bitrate_allocator.h"
+#include "webrtc/call/bitrate_allocator.h"
 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
 
 namespace webrtc {
@@ -53,7 +53,7 @@
   EXPECT_EQ(200000u, bitrate_observer.last_bitrate_);
 
   // TODO(pbos): Expect capping to 1.5M instead of 3M when not boosting the max
-  // bitrate for FEC/retransmissions (see TODO in BitrateAllocator).
+  // bitrate for FEC/retransmissions (see todo in BitrateAllocator).
   allocator_->OnNetworkChanged(4000000, 0, 0);
   EXPECT_EQ(3000000u, bitrate_observer.last_bitrate_);
   start_bitrate =
diff --git a/call/call.cc b/call/call.cc
index 34ecfc4..95e065d 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -23,10 +23,13 @@
 #include "webrtc/base/thread_checker.h"
 #include "webrtc/base/trace_event.h"
 #include "webrtc/call.h"
+#include "webrtc/call/bitrate_allocator.h"
 #include "webrtc/call/congestion_controller.h"
 #include "webrtc/call/rtc_event_log.h"
 #include "webrtc/common.h"
 #include "webrtc/config.h"
+#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
+#include "webrtc/modules/pacing/include/paced_sender.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
 #include "webrtc/modules/utility/include/process_thread.h"
@@ -47,7 +50,8 @@
 
 namespace internal {
 
-class Call : public webrtc::Call, public PacketReceiver {
+class Call : public webrtc::Call, public PacketReceiver,
+             public BitrateObserver {
  public:
   explicit Call(const Call::Config& config);
   virtual ~Call();
@@ -86,6 +90,10 @@
 
   void OnSentPacket(const rtc::SentPacket& sent_packet) override;
 
+  // Implements BitrateObserver.
+  void OnNetworkChanged(uint32_t bitrate_bps, uint8_t fraction_loss,
+                        int64_t rtt_ms) override;
+
  private:
   DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet,
                              size_t length);
@@ -113,7 +121,7 @@
   const int num_cpu_cores_;
   const rtc::scoped_ptr<ProcessThread> module_process_thread_;
   const rtc::scoped_ptr<CallStats> call_stats_;
-  const rtc::scoped_ptr<CongestionController> congestion_controller_;
+  const rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_;
   Call::Config config_;
   rtc::ThreadChecker configuration_thread_checker_;
 
@@ -148,6 +156,8 @@
   rtc::RateTracker received_rtcp_bytes_per_sec_;
   int64_t first_rtp_packet_received_ms_;
 
+  const rtc::scoped_ptr<CongestionController> congestion_controller_;
+
   RTC_DISALLOW_COPY_AND_ASSIGN(Call);
 };
 }  // namespace internal
@@ -163,9 +173,7 @@
       num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
       module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
       call_stats_(new CallStats()),
-      congestion_controller_(
-          new CongestionController(module_process_thread_.get(),
-                                   call_stats_.get())),
+      bitrate_allocator_(new BitrateAllocator()),
       config_(config),
       network_enabled_(true),
       receive_crit_(RWLockWrapper::CreateRWLock()),
@@ -173,7 +181,9 @@
       received_video_bytes_per_sec_(1000, 1),
       received_audio_bytes_per_sec_(1000, 1),
       received_rtcp_bytes_per_sec_(1000, 1),
-      first_rtp_packet_received_ms_(-1) {
+      first_rtp_packet_received_ms_(-1),
+      congestion_controller_(new CongestionController(
+          module_process_thread_.get(), call_stats_.get(), this)) {
   RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
   RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
   RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps,
@@ -335,8 +345,8 @@
   // the call has already started.
   VideoSendStream* send_stream = new VideoSendStream(
       num_cpu_cores_, module_process_thread_.get(), call_stats_.get(),
-      congestion_controller_.get(), config, encoder_config,
-      suspended_video_send_ssrcs_);
+      congestion_controller_.get(), bitrate_allocator_.get(), config,
+      encoder_config, suspended_video_send_ssrcs_);
 
   if (!network_enabled_)
     send_stream->SignalNetworkState(kNetworkDown);
@@ -522,6 +532,32 @@
   congestion_controller_->OnSentPacket(sent_packet);
 }
 
+void Call::OnNetworkChanged(uint32_t target_bitrate_bps, uint8_t fraction_loss,
+                            int64_t rtt_ms) {
+  uint32_t allocated_bitrate_bps = bitrate_allocator_->OnNetworkChanged(
+      target_bitrate_bps, fraction_loss, rtt_ms);
+
+  int pad_up_to_bitrate_bps = 0;
+  {
+    ReadLockScoped read_lock(*send_crit_);
+    // No need to update as long as we're not sending.
+    if (video_send_streams_.empty())
+      return;
+
+    for (VideoSendStream* stream : video_send_streams_)
+      pad_up_to_bitrate_bps += stream->GetPaddingNeededBps();
+  }
+  // Allocated bitrate might be higher than bitrate estimate if enforcing min
+  // bitrate, or lower if estimate is higher than the sum of max bitrates, so
+  // set the pacer bitrate to the maximum of the two.
+  uint32_t pacer_bitrate_bps =
+      std::max(target_bitrate_bps, allocated_bitrate_bps);
+  congestion_controller_->UpdatePacerBitrate(
+      target_bitrate_bps / 1000,
+      PacedSender::kDefaultPaceMultiplier * pacer_bitrate_bps / 1000,
+      pad_up_to_bitrate_bps / 1000);
+}
+
 void Call::ConfigureSync(const std::string& sync_group) {
   // Set sync only if there was no previous one.
   if (voice_engine() == nullptr || sync_group.empty())
diff --git a/call/congestion_controller.cc b/call/congestion_controller.cc
index 27185c1..d29b0d7 100644
--- a/call/congestion_controller.cc
+++ b/call/congestion_controller.cc
@@ -13,6 +13,7 @@
 #include "webrtc/base/checks.h"
 #include "webrtc/base/thread_annotations.h"
 #include "webrtc/common.h"
+#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
 #include "webrtc/modules/pacing/include/paced_sender.h"
 #include "webrtc/modules/pacing/include/packet_router.h"
 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h"
@@ -144,9 +145,9 @@
 }  // namespace
 
 CongestionController::CongestionController(ProcessThread* process_thread,
-                                           CallStats* call_stats)
+                                           CallStats* call_stats,
+                                           BitrateObserver* bitrate_observer)
     : remb_(new VieRemb()),
-      bitrate_allocator_(new BitrateAllocator()),
       packet_router_(new PacketRouter()),
       pacer_(new PacedSender(Clock::GetRealTimeClock(),
                              packet_router_.get(),
@@ -166,7 +167,7 @@
       // construction.
       bitrate_controller_(
           BitrateController::CreateBitrateController(Clock::GetRealTimeClock(),
-                                                     this)),
+                                                     bitrate_observer)),
       min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps) {
   call_stats_->RegisterStatsObserver(remote_bitrate_estimator_.get());
 
@@ -249,6 +250,12 @@
   return transport_feedback_adapter_.get();
 }
 
+void CongestionController::UpdatePacerBitrate(int bitrate_kbps,
+                                              int max_bitrate_kbps,
+                                              int min_bitrate_kbps) {
+  pacer_->UpdateBitrate(bitrate_kbps, max_bitrate_kbps, min_bitrate_kbps);
+}
+
 int64_t CongestionController::GetPacerQueuingDelayMs() const {
   return pacer_->QueueInMs();
 }
@@ -278,29 +285,6 @@
   }
 }
 
-// TODO(mflodman): Move this logic out from CongestionController.
-void CongestionController::OnNetworkChanged(uint32_t target_bitrate_bps,
-                                            uint8_t fraction_loss,
-                                            int64_t rtt) {
-  uint32_t allocated_bitrate_bps = bitrate_allocator_->OnNetworkChanged(
-      target_bitrate_bps, fraction_loss, rtt);
-  int pad_up_to_bitrate_bps = 0;
-  {
-    rtc::CritScope lock(&encoder_crit_);
-    for (const auto& encoder : encoders_)
-      pad_up_to_bitrate_bps += encoder->GetPaddingNeededBps();
-  }
-  // Allocated bitrate might be higher than bitrate estimate if enforcing min
-  // bitrate, or lower if estimate is higher than the sum of max bitrates, so
-  // set the pacer bitrate to the maximum of the two.
-  uint32_t pacer_bitrate_bps =
-      std::max(target_bitrate_bps, allocated_bitrate_bps);
-  pacer_->UpdateBitrate(
-      pacer_bitrate_bps / 1000,
-      PacedSender::kDefaultPaceMultiplier * pacer_bitrate_bps / 1000,
-      pad_up_to_bitrate_bps / 1000);
-}
-
 void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) {
   if (transport_feedback_adapter_) {
     transport_feedback_adapter_->OnSentPacket(sent_packet.packet_id,
diff --git a/call/congestion_controller.h b/call/congestion_controller.h
index b424234..98d8e43 100644
--- a/call/congestion_controller.h
+++ b/call/congestion_controller.h
@@ -16,12 +16,12 @@
 #include "webrtc/base/criticalsection.h"
 #include "webrtc/base/scoped_ptr.h"
 #include "webrtc/base/socket.h"
-#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
 #include "webrtc/stream.h"
 
 namespace webrtc {
 
-class BitrateAllocator;
+class BitrateController;
+class BitrateObserver;
 class CallStats;
 class Config;
 class PacedSender;
@@ -32,12 +32,14 @@
 class RtpRtcp;
 class SendStatisticsProxy;
 class TransportFeedbackAdapter;
+class TransportFeedbackObserver;
 class ViEEncoder;
 class VieRemb;
 
-class CongestionController : public BitrateObserver {
+class CongestionController {
  public:
-  CongestionController(ProcessThread* process_thread, CallStats* call_stats);
+  CongestionController(ProcessThread* process_thread, CallStats* call_stats,
+                       BitrateObserver* bitrate_observer);
   ~CongestionController();
   void AddEncoder(ViEEncoder* encoder);
   void RemoveEncoder(ViEEncoder* encoder);
@@ -54,21 +56,15 @@
   int64_t GetPacerQueuingDelayMs() const;
   PacedSender* pacer() const { return pacer_.get(); }
   PacketRouter* packet_router() const { return packet_router_.get(); }
-  BitrateAllocator* bitrate_allocator() const {
-      return bitrate_allocator_.get(); }
   TransportFeedbackObserver* GetTransportFeedbackObserver();
 
-  // Implements BitrateObserver.
-  void OnNetworkChanged(uint32_t target_bitrate_bps,
-                        uint8_t fraction_loss,
-                        int64_t rtt) override;
+  void UpdatePacerBitrate(int bitrate_kbps, int max_bitrate_kbps,
+                          int min_bitrate_kbps);
 
   void OnSentPacket(const rtc::SentPacket& sent_packet);
 
  private:
   rtc::scoped_ptr<VieRemb> remb_;
-  // TODO(mflodman): Move bitrate_allocator_ to Call.
-  rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_;
   rtc::scoped_ptr<PacketRouter> packet_router_;
   rtc::scoped_ptr<PacedSender> pacer_;
   rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
diff --git a/call/webrtc_call.gypi b/call/webrtc_call.gypi
index fd70ae8..0c3efff 100644
--- a/call/webrtc_call.gypi
+++ b/call/webrtc_call.gypi
@@ -14,6 +14,7 @@
       '<(webrtc_root)/webrtc.gyp:rtc_event_log',
     ],
     'webrtc_call_sources': [
+      'call/bitrate_allocator.cc',
       'call/call.cc',
       'call/congestion_controller.cc',
       'call/transport_adapter.cc',
diff --git a/modules/bitrate_controller/BUILD.gn b/modules/bitrate_controller/BUILD.gn
index 4ef536b..5e3741b 100644
--- a/modules/bitrate_controller/BUILD.gn
+++ b/modules/bitrate_controller/BUILD.gn
@@ -10,7 +10,6 @@
 
 source_set("bitrate_controller") {
   sources = [
-    "bitrate_allocator.cc",
     "bitrate_controller_impl.cc",
     "bitrate_controller_impl.h",
     "include/bitrate_allocator.h",
diff --git a/modules/bitrate_controller/bitrate_controller.gypi b/modules/bitrate_controller/bitrate_controller.gypi
index 44c1b89..3d86f2e 100644
--- a/modules/bitrate_controller/bitrate_controller.gypi
+++ b/modules/bitrate_controller/bitrate_controller.gypi
@@ -15,11 +15,9 @@
         '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
       ],
       'sources': [
-        'bitrate_allocator.cc',
         'bitrate_controller_impl.cc',
         'bitrate_controller_impl.h',
         'include/bitrate_controller.h',
-        'include/bitrate_allocator.h',
         'send_side_bandwidth_estimation.cc',
         'send_side_bandwidth_estimation.h',
       ],
diff --git a/modules/modules.gyp b/modules/modules.gyp
index 9795f44..9db7cfd 100644
--- a/modules/modules.gyp
+++ b/modules/modules.gyp
@@ -196,7 +196,6 @@
             'audio_processing/vad/vad_audio_proc_unittest.cc',
             'audio_processing/vad/vad_circular_buffer_unittest.cc',
             'audio_processing/vad/voice_activity_detector_unittest.cc',
-            'bitrate_controller/bitrate_allocator_unittest.cc',
             'bitrate_controller/bitrate_controller_unittest.cc',
             'bitrate_controller/send_side_bandwidth_estimation_unittest.cc',
             'desktop_capture/desktop_and_cursor_composer_unittest.cc',
diff --git a/modules/remote_bitrate_estimator/transport_feedback_adapter.cc b/modules/remote_bitrate_estimator/transport_feedback_adapter.cc
index 332590b..5904594 100644
--- a/modules/remote_bitrate_estimator/transport_feedback_adapter.cc
+++ b/modules/remote_bitrate_estimator/transport_feedback_adapter.cc
@@ -8,12 +8,13 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include "webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h"
+
 #include <limits>
 
 #include "webrtc/base/checks.h"
 #include "webrtc/base/logging.h"
 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h"
-#include "webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h"
 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
 #include "webrtc/modules/utility/include/process_thread.h"
 
diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc
index f5cb357..7986b37 100644
--- a/video/video_receive_stream.cc
+++ b/video/video_receive_stream.cc
@@ -18,6 +18,7 @@
 #include "webrtc/base/logging.h"
 #include "webrtc/call/congestion_controller.h"
 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
+#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
 #include "webrtc/system_wrappers/include/clock.h"
 #include "webrtc/video/receive_statistics_proxy.h"
 #include "webrtc/video_engine/call_stats.h"
diff --git a/video/video_send_stream.cc b/video/video_send_stream.cc
index 289f735..6e63264 100644
--- a/video/video_send_stream.cc
+++ b/video/video_send_stream.cc
@@ -20,6 +20,7 @@
 #include "webrtc/base/trace_event.h"
 #include "webrtc/call/congestion_controller.h"
 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
+#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
 #include "webrtc/modules/pacing/include/packet_router.h"
 #include "webrtc/video/video_capture_input.h"
 #include "webrtc/video_engine/call_stats.h"
@@ -31,7 +32,6 @@
 
 namespace webrtc {
 
-class BitrateAllocator;
 class PacedSender;
 class RtcpIntraFrameObserver;
 class TransportFeedbackObserver;
@@ -113,6 +113,7 @@
     ProcessThread* module_process_thread,
     CallStats* call_stats,
     CongestionController* congestion_controller,
+    BitrateAllocator* bitrate_allocator,
     const VideoSendStream::Config& config,
     const VideoEncoderConfig& encoder_config,
     const std::map<uint32_t, RtpState>& suspended_ssrcs)
@@ -144,7 +145,7 @@
   vie_encoder_.reset(new ViEEncoder(
       num_cpu_cores, module_process_thread_, &stats_proxy_,
       config.pre_encode_callback, congestion_controller_->pacer(),
-      congestion_controller_->bitrate_allocator()));
+      bitrate_allocator));
   RTC_CHECK(vie_encoder_->Init());
 
   vie_channel_.reset(new ViEChannel(
@@ -532,6 +533,10 @@
   return -1;
 }
 
+int VideoSendStream::GetPaddingNeededBps() const {
+  return vie_encoder_->GetPaddingNeededBps();
+}
+
 bool VideoSendStream::SetSendCodec(VideoCodec video_codec) {
   static const int kEncoderMinBitrate = 30;
   if (video_codec.maxBitrate == 0) {
diff --git a/video/video_send_stream.h b/video/video_send_stream.h
index 6b0d302..64b7fce 100644
--- a/video/video_send_stream.h
+++ b/video/video_send_stream.h
@@ -27,6 +27,7 @@
 
 namespace webrtc {
 
+class BitrateAllocator;
 class CallStats;
 class CongestionController;
 class EncoderStateFeedback;
@@ -43,6 +44,7 @@
                   ProcessThread* module_process_thread,
                   CallStats* call_stats,
                   CongestionController* congestion_controller,
+                  BitrateAllocator* bitrate_allocator,
                   const VideoSendStream::Config& config,
                   const VideoEncoderConfig& encoder_config,
                   const std::map<uint32_t, RtpState>& suspended_ssrcs);
@@ -68,6 +70,7 @@
   RtpStateMap GetRtpStates() const;
 
   int64_t GetRtt() const;
+  int GetPaddingNeededBps() const;
 
  private:
   bool SetSendCodec(VideoCodec video_codec);
diff --git a/video_engine/vie_encoder.cc b/video_engine/vie_encoder.cc
index e09b896..d9a45b0 100644
--- a/video_engine/vie_encoder.cc
+++ b/video_engine/vie_encoder.cc
@@ -17,6 +17,7 @@
 #include "webrtc/base/checks.h"
 #include "webrtc/base/logging.h"
 #include "webrtc/base/trace_event.h"
+#include "webrtc/call/bitrate_allocator.h"
 #include "webrtc/common_video/interface/video_image.h"
 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
 #include "webrtc/frame_callback.h"
diff --git a/video_engine/vie_encoder.h b/video_engine/vie_encoder.h
index 6421504..96889a2 100644
--- a/video_engine/vie_encoder.h
+++ b/video_engine/vie_encoder.h
@@ -19,7 +19,6 @@
 #include "webrtc/base/thread_annotations.h"
 #include "webrtc/common_types.h"
 #include "webrtc/frame_callback.h"
-#include "webrtc/modules/bitrate_controller/include/bitrate_allocator.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
 #include "webrtc/modules/video_processing/main/interface/video_processing.h"
@@ -28,6 +27,8 @@
 
 namespace webrtc {
 
+class BitrateAllocator;
+class BitrateObserver;
 class Config;
 class CriticalSectionWrapper;
 class EncodedImageCallback;
diff --git a/webrtc_tests.gypi b/webrtc_tests.gypi
index 782cb1a..cd51bc9 100644
--- a/webrtc_tests.gypi
+++ b/webrtc_tests.gypi
@@ -154,6 +154,7 @@
         'audio/audio_receive_stream_unittest.cc',
         'audio/audio_send_stream_unittest.cc',
         'audio/audio_state_unittest.cc',
+        'call/bitrate_allocator_unittest.cc',
         'call/bitrate_estimator_tests.cc',
         'call/call_unittest.cc',
         'call/packet_injection_tests.cc',