Rename ChannelGroup to CongestionController and move to webrtc/call/.
BUG=webrtc:5079 R=pbos@webrtc.org Review URL: https://codereview.webrtc.org/1419803002 . Cr-Commit-Position: refs/heads/master@{#10358}
This commit is contained in:
parent
edcbd5610b
commit
0c478b3d75
@ -11,6 +11,7 @@ import("../build/webrtc.gni")
|
||||
source_set("call") {
|
||||
sources = [
|
||||
"call.cc",
|
||||
"congestion_controller.cc",
|
||||
"transport_adapter.cc",
|
||||
"transport_adapter.h",
|
||||
]
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
#include "webrtc/base/thread_checker.h"
|
||||
#include "webrtc/base/trace_event.h"
|
||||
#include "webrtc/call.h"
|
||||
#include "webrtc/call/congestion_controller.h"
|
||||
#include "webrtc/call/rtc_event_log.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/config.h"
|
||||
@ -96,7 +97,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<ChannelGroup> channel_group_;
|
||||
const rtc::scoped_ptr<CongestionController> congestion_controller_;
|
||||
Call::Config config_;
|
||||
rtc::ThreadChecker configuration_thread_checker_;
|
||||
|
||||
@ -141,8 +142,8 @@ Call::Call(const Call::Config& config)
|
||||
: num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
|
||||
module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
|
||||
call_stats_(new CallStats()),
|
||||
channel_group_(new ChannelGroup(module_process_thread_.get(),
|
||||
call_stats_.get())),
|
||||
congestion_controller_(new CongestionController(
|
||||
module_process_thread_.get(), call_stats_.get())),
|
||||
config_(config),
|
||||
network_enabled_(true),
|
||||
receive_crit_(RWLockWrapper::CreateRWLock()),
|
||||
@ -168,9 +169,10 @@ Call::Call(const Call::Config& config)
|
||||
module_process_thread_->Start();
|
||||
module_process_thread_->RegisterModule(call_stats_.get());
|
||||
|
||||
channel_group_->SetBweBitrates(config_.bitrate_config.min_bitrate_bps,
|
||||
config_.bitrate_config.start_bitrate_bps,
|
||||
config_.bitrate_config.max_bitrate_bps);
|
||||
congestion_controller_->SetBweBitrates(
|
||||
config_.bitrate_config.min_bitrate_bps,
|
||||
config_.bitrate_config.start_bitrate_bps,
|
||||
config_.bitrate_config.max_bitrate_bps);
|
||||
}
|
||||
|
||||
Call::~Call() {
|
||||
@ -235,7 +237,7 @@ webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
|
||||
TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream");
|
||||
RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
|
||||
AudioReceiveStream* receive_stream = new AudioReceiveStream(
|
||||
channel_group_->GetRemoteBitrateEstimator(false), config);
|
||||
congestion_controller_->GetRemoteBitrateEstimator(false), config);
|
||||
{
|
||||
WriteLockScoped write_lock(*receive_crit_);
|
||||
RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) ==
|
||||
@ -277,9 +279,10 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream(
|
||||
|
||||
// TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if
|
||||
// the call has already started.
|
||||
VideoSendStream* send_stream = new VideoSendStream(num_cpu_cores_,
|
||||
module_process_thread_.get(), call_stats_.get(), channel_group_.get(),
|
||||
config, encoder_config, suspended_video_send_ssrcs_);
|
||||
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_);
|
||||
|
||||
// This needs to be taken before send_crit_ as both locks need to be held
|
||||
// while changing network state.
|
||||
@ -338,8 +341,8 @@ webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream(
|
||||
TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream");
|
||||
RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
|
||||
VideoReceiveStream* receive_stream = new VideoReceiveStream(
|
||||
num_cpu_cores_, channel_group_.get(), config, config_.voice_engine,
|
||||
module_process_thread_.get(), call_stats_.get());
|
||||
num_cpu_cores_, congestion_controller_.get(), config,
|
||||
config_.voice_engine, module_process_thread_.get(), call_stats_.get());
|
||||
|
||||
// This needs to be taken before receive_crit_ as both locks need to be held
|
||||
// while changing network state.
|
||||
@ -401,14 +404,15 @@ Call::Stats Call::GetStats() const {
|
||||
Stats stats;
|
||||
// Fetch available send/receive bitrates.
|
||||
uint32_t send_bandwidth = 0;
|
||||
channel_group_->GetBitrateController()->AvailableBandwidth(&send_bandwidth);
|
||||
congestion_controller_->GetBitrateController()->AvailableBandwidth(
|
||||
&send_bandwidth);
|
||||
std::vector<unsigned int> ssrcs;
|
||||
uint32_t recv_bandwidth = 0;
|
||||
channel_group_->GetRemoteBitrateEstimator(false)->LatestEstimate(
|
||||
congestion_controller_->GetRemoteBitrateEstimator(false)->LatestEstimate(
|
||||
&ssrcs, &recv_bandwidth);
|
||||
stats.send_bandwidth_bps = send_bandwidth;
|
||||
stats.recv_bandwidth_bps = recv_bandwidth;
|
||||
stats.pacer_delay_ms = channel_group_->GetPacerQueuingDelayMs();
|
||||
stats.pacer_delay_ms = congestion_controller_->GetPacerQueuingDelayMs();
|
||||
{
|
||||
ReadLockScoped read_lock(*send_crit_);
|
||||
// TODO(solenberg): Add audio send streams.
|
||||
@ -439,9 +443,9 @@ void Call::SetBitrateConfig(
|
||||
return;
|
||||
}
|
||||
config_.bitrate_config = bitrate_config;
|
||||
channel_group_->SetBweBitrates(bitrate_config.min_bitrate_bps,
|
||||
bitrate_config.start_bitrate_bps,
|
||||
bitrate_config.max_bitrate_bps);
|
||||
congestion_controller_->SetBweBitrates(bitrate_config.min_bitrate_bps,
|
||||
bitrate_config.start_bitrate_bps,
|
||||
bitrate_config.max_bitrate_bps);
|
||||
}
|
||||
|
||||
void Call::SignalNetworkState(NetworkState state) {
|
||||
@ -450,7 +454,7 @@ void Call::SignalNetworkState(NetworkState state) {
|
||||
// to guarantee a consistent state across streams.
|
||||
rtc::CritScope lock(&network_enabled_crit_);
|
||||
network_enabled_ = state == kNetworkUp;
|
||||
channel_group_->SignalNetworkState(state);
|
||||
congestion_controller_->SignalNetworkState(state);
|
||||
{
|
||||
ReadLockScoped write_lock(*send_crit_);
|
||||
for (auto& kv : audio_send_ssrcs_) {
|
||||
@ -470,7 +474,7 @@ void Call::SignalNetworkState(NetworkState state) {
|
||||
|
||||
void Call::OnSentPacket(const rtc::SentPacket& sent_packet) {
|
||||
RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
|
||||
channel_group_->OnSentPacket(sent_packet);
|
||||
congestion_controller_->OnSentPacket(sent_packet);
|
||||
}
|
||||
|
||||
void Call::ConfigureSync(const std::string& sync_group) {
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/video_engine/vie_channel_group.h"
|
||||
#include "webrtc/call/congestion_controller.h"
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/thread_annotations.h"
|
||||
@ -143,8 +143,8 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator {
|
||||
|
||||
} // namespace
|
||||
|
||||
ChannelGroup::ChannelGroup(ProcessThread* process_thread,
|
||||
CallStats* call_stats)
|
||||
CongestionController::CongestionController(ProcessThread* process_thread,
|
||||
CallStats* call_stats)
|
||||
: remb_(new VieRemb()),
|
||||
bitrate_allocator_(new BitrateAllocator()),
|
||||
packet_router_(new PacketRouter()),
|
||||
@ -178,7 +178,7 @@ ChannelGroup::ChannelGroup(ProcessThread* process_thread,
|
||||
process_thread->RegisterModule(bitrate_controller_.get());
|
||||
}
|
||||
|
||||
ChannelGroup::~ChannelGroup() {
|
||||
CongestionController::~CongestionController() {
|
||||
pacer_thread_->Stop();
|
||||
pacer_thread_->DeRegisterModule(pacer_.get());
|
||||
process_thread_->DeRegisterModule(bitrate_controller_.get());
|
||||
@ -191,12 +191,12 @@ ChannelGroup::~ChannelGroup() {
|
||||
RTC_DCHECK(encoders_.empty());
|
||||
}
|
||||
|
||||
void ChannelGroup::AddEncoder(ViEEncoder* encoder) {
|
||||
void CongestionController::AddEncoder(ViEEncoder* encoder) {
|
||||
rtc::CritScope lock(&encoder_crit_);
|
||||
encoders_.push_back(encoder);
|
||||
}
|
||||
|
||||
void ChannelGroup::RemoveEncoder(ViEEncoder* encoder) {
|
||||
void CongestionController::RemoveEncoder(ViEEncoder* encoder) {
|
||||
rtc::CritScope lock(&encoder_crit_);
|
||||
for (auto it = encoders_.begin(); it != encoders_.end(); ++it) {
|
||||
if (*it == encoder) {
|
||||
@ -206,9 +206,9 @@ void ChannelGroup::RemoveEncoder(ViEEncoder* encoder) {
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelGroup::SetBweBitrates(int min_bitrate_bps,
|
||||
int start_bitrate_bps,
|
||||
int max_bitrate_bps) {
|
||||
void CongestionController::SetBweBitrates(int min_bitrate_bps,
|
||||
int start_bitrate_bps,
|
||||
int max_bitrate_bps) {
|
||||
if (start_bitrate_bps > 0)
|
||||
bitrate_controller_->SetStartBitrate(start_bitrate_bps);
|
||||
bitrate_controller_->SetMinMaxBitrate(min_bitrate_bps, max_bitrate_bps);
|
||||
@ -220,11 +220,11 @@ void ChannelGroup::SetBweBitrates(int min_bitrate_bps,
|
||||
min_bitrate_bps_ = min_bitrate_bps;
|
||||
}
|
||||
|
||||
BitrateController* ChannelGroup::GetBitrateController() const {
|
||||
BitrateController* CongestionController::GetBitrateController() const {
|
||||
return bitrate_controller_.get();
|
||||
}
|
||||
|
||||
RemoteBitrateEstimator* ChannelGroup::GetRemoteBitrateEstimator(
|
||||
RemoteBitrateEstimator* CongestionController::GetRemoteBitrateEstimator(
|
||||
bool send_side_bwe) const {
|
||||
|
||||
if (send_side_bwe)
|
||||
@ -233,7 +233,8 @@ RemoteBitrateEstimator* ChannelGroup::GetRemoteBitrateEstimator(
|
||||
return remote_bitrate_estimator_.get();
|
||||
}
|
||||
|
||||
TransportFeedbackObserver* ChannelGroup::GetTransportFeedbackObserver() {
|
||||
TransportFeedbackObserver*
|
||||
CongestionController::GetTransportFeedbackObserver() {
|
||||
if (transport_feedback_adapter_.get() == nullptr) {
|
||||
transport_feedback_adapter_.reset(new TransportFeedbackAdapter(
|
||||
bitrate_controller_->CreateRtcpBandwidthObserver(),
|
||||
@ -248,14 +249,14 @@ TransportFeedbackObserver* ChannelGroup::GetTransportFeedbackObserver() {
|
||||
return transport_feedback_adapter_.get();
|
||||
}
|
||||
|
||||
int64_t ChannelGroup::GetPacerQueuingDelayMs() const {
|
||||
int64_t CongestionController::GetPacerQueuingDelayMs() const {
|
||||
return pacer_->QueueInMs();
|
||||
}
|
||||
|
||||
// TODO(mflodman): Move out of this class.
|
||||
void ChannelGroup::SetChannelRembStatus(bool sender,
|
||||
bool receiver,
|
||||
RtpRtcp* rtp_module) {
|
||||
void CongestionController::SetChannelRembStatus(bool sender,
|
||||
bool receiver,
|
||||
RtpRtcp* rtp_module) {
|
||||
rtp_module->SetREMBStatus(sender || receiver);
|
||||
if (sender) {
|
||||
remb_->AddRembSender(rtp_module);
|
||||
@ -269,7 +270,7 @@ void ChannelGroup::SetChannelRembStatus(bool sender,
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelGroup::SignalNetworkState(NetworkState state) {
|
||||
void CongestionController::SignalNetworkState(NetworkState state) {
|
||||
if (state == kNetworkUp) {
|
||||
pacer_->Resume();
|
||||
} else {
|
||||
@ -277,10 +278,10 @@ void ChannelGroup::SignalNetworkState(NetworkState state) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(mflodman): Move this logic out from ChannelGroup.
|
||||
void ChannelGroup::OnNetworkChanged(uint32_t target_bitrate_bps,
|
||||
uint8_t fraction_loss,
|
||||
int64_t rtt) {
|
||||
// TODO(mflodman): Move this logic out from CongestionController.
|
||||
void CongestionController::OnNetworkChanged(uint32_t target_bitrate_bps,
|
||||
uint8_t fraction_loss,
|
||||
int64_t rtt) {
|
||||
bitrate_allocator_->OnNetworkChanged(target_bitrate_bps, fraction_loss, rtt);
|
||||
int pad_up_to_bitrate_bps = 0;
|
||||
{
|
||||
@ -294,7 +295,7 @@ void ChannelGroup::OnNetworkChanged(uint32_t target_bitrate_bps,
|
||||
pad_up_to_bitrate_bps / 1000);
|
||||
}
|
||||
|
||||
void ChannelGroup::OnSentPacket(const rtc::SentPacket& sent_packet) {
|
||||
void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) {
|
||||
if (transport_feedback_adapter_) {
|
||||
transport_feedback_adapter_->UpdateSendTime(sent_packet.packet_id,
|
||||
sent_packet.send_time_ms);
|
||||
@ -8,20 +8,16 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_
|
||||
#define WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_
|
||||
#ifndef WEBRTC_CALL_CONGESTION_CONTROLLER_H_
|
||||
#define WEBRTC_CALL_CONGESTION_CONTROLLER_H_
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#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/video_receive_stream.h"
|
||||
#include "webrtc/video_send_stream.h"
|
||||
#include "webrtc/stream.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -39,12 +35,10 @@ class TransportFeedbackAdapter;
|
||||
class ViEEncoder;
|
||||
class VieRemb;
|
||||
|
||||
// Channel group contains data common for several channels. All channels in the
|
||||
// group are assumed to send/receive data to the same end-point.
|
||||
class ChannelGroup : public BitrateObserver {
|
||||
class CongestionController : public BitrateObserver {
|
||||
public:
|
||||
ChannelGroup(ProcessThread* process_thread, CallStats* call_stats);
|
||||
~ChannelGroup();
|
||||
CongestionController(ProcessThread* process_thread, CallStats* call_stats);
|
||||
~CongestionController();
|
||||
void AddEncoder(ViEEncoder* encoder);
|
||||
void RemoveEncoder(ViEEncoder* encoder);
|
||||
void SetBweBitrates(int min_bitrate_bps,
|
||||
@ -63,7 +57,6 @@ class ChannelGroup : public BitrateObserver {
|
||||
BitrateAllocator* bitrate_allocator() const {
|
||||
return bitrate_allocator_.get(); }
|
||||
TransportFeedbackObserver* GetTransportFeedbackObserver();
|
||||
RtcpIntraFrameObserver* GetRtcpIntraFrameObserver() const;
|
||||
|
||||
// Implements BitrateObserver.
|
||||
void OnNetworkChanged(uint32_t target_bitrate_bps,
|
||||
@ -74,6 +67,7 @@ class ChannelGroup : public BitrateObserver {
|
||||
|
||||
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_;
|
||||
@ -96,4 +90,4 @@ class ChannelGroup : public BitrateObserver {
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_
|
||||
#endif // WEBRTC_CALL_CONGESTION_CONTROLLER_H_
|
||||
@ -15,6 +15,7 @@
|
||||
],
|
||||
'webrtc_call_sources': [
|
||||
'call/call.cc',
|
||||
'call/congestion_controller.cc',
|
||||
'call/transport_adapter.cc',
|
||||
'call/transport_adapter.h',
|
||||
],
|
||||
|
||||
@ -24,8 +24,6 @@ source_set("video") {
|
||||
"../video_engine/stream_synchronization.h",
|
||||
"../video_engine/vie_channel.cc",
|
||||
"../video_engine/vie_channel.h",
|
||||
"../video_engine/vie_channel_group.cc",
|
||||
"../video_engine/vie_channel_group.h",
|
||||
"../video_engine/vie_defines.h",
|
||||
"../video_engine/vie_encoder.cc",
|
||||
"../video_engine/vie_encoder.h",
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/call/congestion_controller.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
@ -137,30 +138,33 @@ VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
VideoReceiveStream::VideoReceiveStream(int num_cpu_cores,
|
||||
ChannelGroup* channel_group,
|
||||
const VideoReceiveStream::Config& config,
|
||||
webrtc::VoiceEngine* voice_engine,
|
||||
ProcessThread* process_thread,
|
||||
CallStats* call_stats)
|
||||
VideoReceiveStream::VideoReceiveStream(
|
||||
int num_cpu_cores,
|
||||
CongestionController* congestion_controller,
|
||||
const VideoReceiveStream::Config& config,
|
||||
webrtc::VoiceEngine* voice_engine,
|
||||
ProcessThread* process_thread,
|
||||
CallStats* call_stats)
|
||||
: transport_adapter_(config.rtcp_send_transport),
|
||||
encoded_frame_proxy_(config.pre_decode_callback),
|
||||
config_(config),
|
||||
clock_(Clock::GetRealTimeClock()),
|
||||
channel_group_(channel_group),
|
||||
congestion_controller_(congestion_controller),
|
||||
call_stats_(call_stats) {
|
||||
LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString();
|
||||
|
||||
bool send_side_bwe = UseSendSideBwe(config_.rtp.extensions);
|
||||
|
||||
RemoteBitrateEstimator* bitrate_estimator =
|
||||
channel_group_->GetRemoteBitrateEstimator(send_side_bwe);
|
||||
congestion_controller_->GetRemoteBitrateEstimator(send_side_bwe);
|
||||
|
||||
vie_channel_.reset(new ViEChannel(
|
||||
num_cpu_cores, &transport_adapter_, process_thread, nullptr,
|
||||
channel_group_->GetBitrateController()->CreateRtcpBandwidthObserver(),
|
||||
congestion_controller_->GetBitrateController()->
|
||||
CreateRtcpBandwidthObserver(),
|
||||
nullptr, bitrate_estimator, call_stats_->rtcp_rtt_stats(),
|
||||
channel_group_->pacer(), channel_group_->packet_router(), 1, false));
|
||||
congestion_controller_->pacer(), congestion_controller_->packet_router(),
|
||||
1, false));
|
||||
|
||||
RTC_CHECK(vie_channel_->Init() == 0);
|
||||
|
||||
@ -195,8 +199,8 @@ VideoReceiveStream::VideoReceiveStream(int num_cpu_cores,
|
||||
vie_channel_->SetUseRtxPayloadMappingOnRestore(
|
||||
config_.rtp.use_rtx_payload_mapping_on_restore);
|
||||
|
||||
channel_group_->SetChannelRembStatus(false, config_.rtp.remb,
|
||||
vie_channel_->rtp_rtcp());
|
||||
congestion_controller_->SetChannelRembStatus(false, config_.rtp.remb,
|
||||
vie_channel_->rtp_rtcp());
|
||||
|
||||
for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) {
|
||||
const std::string& extension = config_.rtp.extensions[i].name;
|
||||
@ -287,12 +291,13 @@ VideoReceiveStream::~VideoReceiveStream() {
|
||||
vie_channel_->DeRegisterExternalDecoder(config_.decoders[i].payload_type);
|
||||
|
||||
call_stats_->DeregisterStatsObserver(vie_channel_->GetStatsObserver());
|
||||
channel_group_->SetChannelRembStatus(false, false, vie_channel_->rtp_rtcp());
|
||||
congestion_controller_->SetChannelRembStatus(false, false,
|
||||
vie_channel_->rtp_rtcp());
|
||||
|
||||
uint32_t remote_ssrc = vie_channel_->GetRemoteSSRC();
|
||||
bool send_side_bwe = UseSendSideBwe(config_.rtp.extensions);
|
||||
channel_group_->GetRemoteBitrateEstimator(send_side_bwe)->RemoveStream(
|
||||
remote_ssrc);
|
||||
congestion_controller_->GetRemoteBitrateEstimator(send_side_bwe)->
|
||||
RemoveStream(remote_ssrc);
|
||||
}
|
||||
|
||||
void VideoReceiveStream::Start() {
|
||||
|
||||
@ -24,13 +24,13 @@
|
||||
#include "webrtc/video/receive_statistics_proxy.h"
|
||||
#include "webrtc/video_encoder.h"
|
||||
#include "webrtc/video_engine/vie_channel.h"
|
||||
#include "webrtc/video_engine/vie_channel_group.h"
|
||||
#include "webrtc/video_engine/vie_encoder.h"
|
||||
#include "webrtc/video_receive_stream.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class CallStats;
|
||||
class CongestionController;
|
||||
class VoiceEngine;
|
||||
|
||||
namespace internal {
|
||||
@ -41,7 +41,7 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
|
||||
public EncodedImageCallback {
|
||||
public:
|
||||
VideoReceiveStream(int num_cpu_cores,
|
||||
ChannelGroup* channel_group,
|
||||
CongestionController* congestion_controller,
|
||||
const VideoReceiveStream::Config& config,
|
||||
webrtc::VoiceEngine* voice_engine,
|
||||
ProcessThread* process_thread,
|
||||
@ -82,7 +82,7 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
|
||||
const VideoReceiveStream::Config config_;
|
||||
Clock* const clock_;
|
||||
|
||||
ChannelGroup* const channel_group_;
|
||||
CongestionController* const congestion_controller_;
|
||||
CallStats* const call_stats_;
|
||||
|
||||
rtc::scoped_ptr<IncomingVideoStream> incoming_video_stream_;
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/trace_event.h"
|
||||
#include "webrtc/call/congestion_controller.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/modules/pacing/include/packet_router.h"
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
@ -25,7 +26,6 @@
|
||||
#include "webrtc/video_engine/encoder_state_feedback.h"
|
||||
#include "webrtc/video_engine/payload_router.h"
|
||||
#include "webrtc/video_engine/vie_channel.h"
|
||||
#include "webrtc/video_engine/vie_channel_group.h"
|
||||
#include "webrtc/video_engine/vie_defines.h"
|
||||
#include "webrtc/video_engine/vie_encoder.h"
|
||||
#include "webrtc/video_send_stream.h"
|
||||
@ -113,7 +113,7 @@ VideoSendStream::VideoSendStream(
|
||||
int num_cpu_cores,
|
||||
ProcessThread* module_process_thread,
|
||||
CallStats* call_stats,
|
||||
ChannelGroup* channel_group,
|
||||
CongestionController* congestion_controller,
|
||||
const VideoSendStream::Config& config,
|
||||
const VideoEncoderConfig& encoder_config,
|
||||
const std::map<uint32_t, RtpState>& suspended_ssrcs)
|
||||
@ -123,7 +123,7 @@ VideoSendStream::VideoSendStream(
|
||||
suspended_ssrcs_(suspended_ssrcs),
|
||||
module_process_thread_(module_process_thread),
|
||||
call_stats_(call_stats),
|
||||
channel_group_(channel_group),
|
||||
congestion_controller_(congestion_controller),
|
||||
encoder_feedback_(new EncoderStateFeedback()),
|
||||
use_config_bitrate_(true),
|
||||
stats_proxy_(Clock::GetRealTimeClock(), config) {
|
||||
@ -135,7 +135,7 @@ VideoSendStream::VideoSendStream(
|
||||
for (const RtpExtension& extension : config.rtp.extensions) {
|
||||
if (extension.name == RtpExtension::kTransportSequenceNumber) {
|
||||
transport_feedback_observer =
|
||||
channel_group_->GetTransportFeedbackObserver();
|
||||
congestion_controller_->GetTransportFeedbackObserver();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -144,18 +144,19 @@ VideoSendStream::VideoSendStream(
|
||||
|
||||
vie_encoder_.reset(new ViEEncoder(
|
||||
num_cpu_cores, module_process_thread_, &stats_proxy_,
|
||||
config.pre_encode_callback, channel_group_->pacer(),
|
||||
channel_group_->bitrate_allocator()));
|
||||
config.pre_encode_callback, congestion_controller_->pacer(),
|
||||
congestion_controller_->bitrate_allocator()));
|
||||
RTC_CHECK(vie_encoder_->Init());
|
||||
|
||||
vie_channel_.reset(new ViEChannel(
|
||||
num_cpu_cores, config.send_transport, module_process_thread_,
|
||||
encoder_feedback_->GetRtcpIntraFrameObserver(),
|
||||
channel_group_->GetBitrateController()->CreateRtcpBandwidthObserver(),
|
||||
congestion_controller_->GetBitrateController()->
|
||||
CreateRtcpBandwidthObserver(),
|
||||
transport_feedback_observer,
|
||||
channel_group_->GetRemoteBitrateEstimator(false),
|
||||
call_stats_->rtcp_rtt_stats(), channel_group_->pacer(),
|
||||
channel_group_->packet_router(), ssrcs.size(), true));
|
||||
congestion_controller_->GetRemoteBitrateEstimator(false),
|
||||
call_stats_->rtcp_rtt_stats(), congestion_controller_->pacer(),
|
||||
congestion_controller_->packet_router(), ssrcs.size(), true));
|
||||
RTC_CHECK(vie_channel_->Init() == 0);
|
||||
|
||||
call_stats_->RegisterStatsObserver(vie_channel_->GetStatsObserver());
|
||||
@ -186,7 +187,8 @@ VideoSendStream::VideoSendStream(
|
||||
}
|
||||
}
|
||||
|
||||
channel_group_->SetChannelRembStatus(true, false, vie_channel_->rtp_rtcp());
|
||||
congestion_controller_->SetChannelRembStatus(true, false,
|
||||
vie_channel_->rtp_rtcp());
|
||||
|
||||
// Enable NACK, FEC or both.
|
||||
const bool enable_protection_nack = config_.rtp.nack.rtp_history_ms > 0;
|
||||
@ -228,7 +230,7 @@ VideoSendStream::VideoSendStream(
|
||||
if (config_.suspend_below_min_bitrate)
|
||||
vie_encoder_->SuspendBelowMinBitrate();
|
||||
|
||||
channel_group_->AddEncoder(vie_encoder_.get());
|
||||
congestion_controller_->AddEncoder(vie_encoder_.get());
|
||||
encoder_feedback_->AddEncoder(ssrcs, vie_encoder_.get());
|
||||
|
||||
vie_channel_->RegisterSendChannelRtcpStatisticsCallback(&stats_proxy_);
|
||||
@ -254,16 +256,18 @@ VideoSendStream::~VideoSendStream() {
|
||||
config_.encoder_settings.payload_type);
|
||||
|
||||
call_stats_->DeregisterStatsObserver(vie_channel_->GetStatsObserver());
|
||||
channel_group_->SetChannelRembStatus(false, false, vie_channel_->rtp_rtcp());
|
||||
congestion_controller_->SetChannelRembStatus(false, false,
|
||||
vie_channel_->rtp_rtcp());
|
||||
|
||||
// Remove the feedback, stop all encoding threads and processing. This must be
|
||||
// done before deleting the channel.
|
||||
channel_group_->RemoveEncoder(vie_encoder_.get());
|
||||
congestion_controller_->RemoveEncoder(vie_encoder_.get());
|
||||
encoder_feedback_->RemoveEncoder(vie_encoder_.get());
|
||||
vie_encoder_->StopThreadsAndRemoveSharedMembers();
|
||||
|
||||
uint32_t remote_ssrc = vie_channel_->GetRemoteSSRC();
|
||||
channel_group_->GetRemoteBitrateEstimator(false)->RemoveStream(remote_ssrc);
|
||||
congestion_controller_->GetRemoteBitrateEstimator(false)->RemoveStream(
|
||||
remote_ssrc);
|
||||
}
|
||||
|
||||
VideoCaptureInput* VideoSendStream::Input() {
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
class CallStats;
|
||||
class ChannelGroup;
|
||||
class CongestionController;
|
||||
class EncoderStateFeedback;
|
||||
class ProcessThread;
|
||||
class ViEChannel;
|
||||
@ -42,7 +42,7 @@ class VideoSendStream : public webrtc::VideoSendStream,
|
||||
VideoSendStream(int num_cpu_cores,
|
||||
ProcessThread* module_process_thread,
|
||||
CallStats* call_stats,
|
||||
ChannelGroup* channel_group,
|
||||
CongestionController* congestion_controller,
|
||||
const VideoSendStream::Config& config,
|
||||
const VideoEncoderConfig& encoder_config,
|
||||
const std::map<uint32_t, RtpState>& suspended_ssrcs);
|
||||
@ -80,7 +80,7 @@ class VideoSendStream : public webrtc::VideoSendStream,
|
||||
|
||||
ProcessThread* const module_process_thread_;
|
||||
CallStats* const call_stats_;
|
||||
ChannelGroup* const channel_group_;
|
||||
CongestionController* const congestion_controller_;
|
||||
|
||||
rtc::scoped_ptr<VideoCaptureInput> input_;
|
||||
rtc::scoped_ptr<ViEChannel> vie_channel_;
|
||||
|
||||
@ -52,8 +52,6 @@
|
||||
'video_engine/stream_synchronization.h',
|
||||
'video_engine/vie_channel.cc',
|
||||
'video_engine/vie_channel.h',
|
||||
'video_engine/vie_channel_group.cc',
|
||||
'video_engine/vie_channel_group.h',
|
||||
'video_engine/vie_defines.h',
|
||||
'video_engine/vie_encoder.cc',
|
||||
'video_engine/vie_encoder.h',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user