aboutsummaryrefslogtreecommitdiff
path: root/webrtc
diff options
context:
space:
mode:
authormflodman <mflodman@webrtc.org>2015-11-12 21:02:42 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-13 05:02:46 +0000
commit0e7e259ebd69993bb5670a991f43aa1b06c9bf9e (patch)
treeff2acc7d9a631f5c229b6b2e69d32be6459e3ff9 /webrtc
parent69191ed845f3e1d4ec1671cb4558ea7483f97168 (diff)
downloadwebrtc-0e7e259ebd69993bb5670a991f43aa1b06c9bf9e.tar.gz
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-Commit-Position: refs/heads/master@{#10630}
Diffstat (limited to 'webrtc')
-rw-r--r--webrtc/call/BUILD.gn1
-rw-r--r--webrtc/call/bitrate_allocator.cc (renamed from webrtc/modules/bitrate_controller/bitrate_allocator.cc)5
-rw-r--r--webrtc/call/bitrate_allocator.h (renamed from webrtc/modules/bitrate_controller/include/bitrate_allocator.h)6
-rw-r--r--webrtc/call/bitrate_allocator_unittest.cc (renamed from webrtc/modules/bitrate_controller/bitrate_allocator_unittest.cc)4
-rw-r--r--webrtc/call/call.cc52
-rw-r--r--webrtc/call/congestion_controller.cc36
-rw-r--r--webrtc/call/congestion_controller.h20
-rw-r--r--webrtc/call/webrtc_call.gypi1
-rw-r--r--webrtc/modules/bitrate_controller/BUILD.gn1
-rw-r--r--webrtc/modules/bitrate_controller/bitrate_controller.gypi2
-rw-r--r--webrtc/modules/modules.gyp1
-rw-r--r--webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc3
-rw-r--r--webrtc/video/video_receive_stream.cc1
-rw-r--r--webrtc/video/video_send_stream.cc9
-rw-r--r--webrtc/video/video_send_stream.h3
-rw-r--r--webrtc/video_engine/vie_encoder.cc1
-rw-r--r--webrtc/video_engine/vie_encoder.h3
-rw-r--r--webrtc/webrtc_tests.gypi1
18 files changed, 89 insertions, 61 deletions
diff --git a/webrtc/call/BUILD.gn b/webrtc/call/BUILD.gn
index 3abc762a77..498c724900 100644
--- a/webrtc/call/BUILD.gn
+++ b/webrtc/call/BUILD.gn
@@ -10,6 +10,7 @@ import("../build/webrtc.gni")
source_set("call") {
sources = [
+ "bitrate_allocator.cc",
"call.cc",
"congestion_controller.cc",
"transport_adapter.cc",
diff --git a/webrtc/modules/bitrate_controller/bitrate_allocator.cc b/webrtc/call/bitrate_allocator.cc
index dc421bb69d..b3789d3bb6 100644
--- a/webrtc/modules/bitrate_controller/bitrate_allocator.cc
+++ b/webrtc/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 @@ void BitrateAllocator::EnforceMinBitrate(bool enforce_min_bitrate) {
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/webrtc/modules/bitrate_controller/include/bitrate_allocator.h b/webrtc/call/bitrate_allocator.h
index 4ee27f36d3..4a3fd59d49 100644
--- a/webrtc/modules/bitrate_controller/include/bitrate_allocator.h
+++ b/webrtc/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 @@ class BitrateAllocator {
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/webrtc/modules/bitrate_controller/bitrate_allocator_unittest.cc b/webrtc/call/bitrate_allocator_unittest.cc
index 4fc7e83b5b..86f75a4380 100644
--- a/webrtc/modules/bitrate_controller/bitrate_allocator_unittest.cc
+++ b/webrtc/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 @@ TEST_F(BitrateAllocatorTest, UpdatingBitrateObserver) {
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/webrtc/call/call.cc b/webrtc/call/call.cc
index 34ecfc4f16..95e065d883 100644
--- a/webrtc/call/call.cc
+++ b/webrtc/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 @@ const int Call::Config::kDefaultStartBitrateBps = 300000;
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 @@ class Call : public webrtc::Call, public PacketReceiver {
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 @@ class Call : public webrtc::Call, public PacketReceiver {
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 @@ class Call : public webrtc::Call, public PacketReceiver {
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 @@ Call::Call(const Call::Config& config)
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 @@ Call::Call(const Call::Config& config)
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 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream(
// 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 @@ void Call::OnSentPacket(const rtc::SentPacket& sent_packet) {
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/webrtc/call/congestion_controller.cc b/webrtc/call/congestion_controller.cc
index 27185c162d..d29b0d7745 100644
--- a/webrtc/call/congestion_controller.cc
+++ b/webrtc/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 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator {
} // 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 @@ CongestionController::CongestionController(ProcessThread* process_thread,
// 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 @@ CongestionController::GetTransportFeedbackObserver() {
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 @@ void CongestionController::SignalNetworkState(NetworkState state) {
}
}
-// 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/webrtc/call/congestion_controller.h b/webrtc/call/congestion_controller.h
index b424234123..98d8e433fd 100644
--- a/webrtc/call/congestion_controller.h
+++ b/webrtc/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 RemoteEstimatorProxy;
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 @@ class CongestionController : public BitrateObserver {
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/webrtc/call/webrtc_call.gypi b/webrtc/call/webrtc_call.gypi
index fd70ae81f4..0c3efff43a 100644
--- a/webrtc/call/webrtc_call.gypi
+++ b/webrtc/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/webrtc/modules/bitrate_controller/BUILD.gn b/webrtc/modules/bitrate_controller/BUILD.gn
index 4ef536b572..5e3741ba93 100644
--- a/webrtc/modules/bitrate_controller/BUILD.gn
+++ b/webrtc/modules/bitrate_controller/BUILD.gn
@@ -10,7 +10,6 @@ import("../../build/webrtc.gni")
source_set("bitrate_controller") {
sources = [
- "bitrate_allocator.cc",
"bitrate_controller_impl.cc",
"bitrate_controller_impl.h",
"include/bitrate_allocator.h",
diff --git a/webrtc/modules/bitrate_controller/bitrate_controller.gypi b/webrtc/modules/bitrate_controller/bitrate_controller.gypi
index 44c1b89ef2..3d86f2e32a 100644
--- a/webrtc/modules/bitrate_controller/bitrate_controller.gypi
+++ b/webrtc/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/webrtc/modules/modules.gyp b/webrtc/modules/modules.gyp
index 9795f44f48..9db7cfdb7a 100644
--- a/webrtc/modules/modules.gyp
+++ b/webrtc/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/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc b/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc
index 332590b1c6..5904594ac8 100644
--- a/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc
+++ b/webrtc/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/webrtc/video/video_receive_stream.cc b/webrtc/video/video_receive_stream.cc
index f5cb357098..7986b37bcf 100644
--- a/webrtc/video/video_receive_stream.cc
+++ b/webrtc/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/webrtc/video/video_send_stream.cc b/webrtc/video/video_send_stream.cc
index 289f735151..6e63264c4b 100644
--- a/webrtc/video/video_send_stream.cc
+++ b/webrtc/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 @@ VideoSendStream::VideoSendStream(
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 @@ VideoSendStream::VideoSendStream(
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 @@ int64_t VideoSendStream::GetRtt() const {
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/webrtc/video/video_send_stream.h b/webrtc/video/video_send_stream.h
index 6b0d30213a..64b7fceaf3 100644
--- a/webrtc/video/video_send_stream.h
+++ b/webrtc/video/video_send_stream.h
@@ -27,6 +27,7 @@
namespace webrtc {
+class BitrateAllocator;
class CallStats;
class CongestionController;
class EncoderStateFeedback;
@@ -43,6 +44,7 @@ class VideoSendStream : public webrtc::VideoSendStream,
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 @@ class VideoSendStream : public webrtc::VideoSendStream,
RtpStateMap GetRtpStates() const;
int64_t GetRtt() const;
+ int GetPaddingNeededBps() const;
private:
bool SetSendCodec(VideoCodec video_codec);
diff --git a/webrtc/video_engine/vie_encoder.cc b/webrtc/video_engine/vie_encoder.cc
index e09b89627c..d9a45b02ed 100644
--- a/webrtc/video_engine/vie_encoder.cc
+++ b/webrtc/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/webrtc/video_engine/vie_encoder.h b/webrtc/video_engine/vie_encoder.h
index 6421504e95..96889a244b 100644
--- a/webrtc/video_engine/vie_encoder.h
+++ b/webrtc/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/webrtc_tests.gypi b/webrtc/webrtc_tests.gypi
index 782cb1aa30..cd51bc9311 100644
--- a/webrtc/webrtc_tests.gypi
+++ b/webrtc/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',