Remove VideoEngine interface usage from new API.
Instantiates ProcessThread/ChannelGroup inside Call instead of using VideoEngine or ViEBase. This removes the need for ViEChannelManager, ViEInputManager and other ViESharedData completely. Some interface headers are still referenced due to external interfaces being defined there. Upon interface removal these will be moved to implementation headers. BUG=1695 R=mflodman@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/50849005 Cr-Commit-Position: refs/heads/master@{#9160}
This commit is contained in:
@@ -21,9 +21,11 @@
|
||||
#include "webrtc/config.h"
|
||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
|
||||
#include "webrtc/modules/utility/interface/process_thread.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
|
||||
#include "webrtc/modules/video_render/include/video_render.h"
|
||||
#include "webrtc/system_wrappers/interface/cpu_info.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
|
||||
@@ -32,12 +34,6 @@
|
||||
#include "webrtc/video/audio_receive_stream.h"
|
||||
#include "webrtc/video/video_receive_stream.h"
|
||||
#include "webrtc/video/video_send_stream.h"
|
||||
#include "webrtc/video_engine/vie_shared_data.h"
|
||||
#include "webrtc/video_engine/include/vie_base.h"
|
||||
#include "webrtc/video_engine/include/vie_codec.h"
|
||||
#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
|
||||
#include "webrtc/video_engine/include/vie_network.h"
|
||||
#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
|
||||
|
||||
namespace webrtc {
|
||||
VideoEncoder* VideoEncoder::Create(VideoEncoder::EncoderType codec_type) {
|
||||
@@ -92,7 +88,7 @@ class CpuOveruseObserverProxy : public webrtc::CpuOveruseObserver {
|
||||
|
||||
class Call : public webrtc::Call, public PacketReceiver {
|
||||
public:
|
||||
Call(webrtc::VideoEngine* video_engine, const Call::Config& config);
|
||||
explicit Call(const Call::Config& config);
|
||||
virtual ~Call();
|
||||
|
||||
PacketReceiver* Receiver() override;
|
||||
@@ -127,6 +123,14 @@ class Call : public webrtc::Call, public PacketReceiver {
|
||||
DeliveryStatus DeliverRtp(MediaType media_type, const uint8_t* packet,
|
||||
size_t length);
|
||||
|
||||
void SetBitrateControllerConfig(
|
||||
const webrtc::Call::Config::BitrateConfig& bitrate_config);
|
||||
|
||||
const int num_cpu_cores_;
|
||||
const rtc::scoped_ptr<ProcessThread> module_process_thread_;
|
||||
const rtc::scoped_ptr<ChannelGroup> channel_group_;
|
||||
const int base_channel_id_;
|
||||
volatile int next_channel_id_;
|
||||
Call::Config config_;
|
||||
|
||||
// Needs to be held while write-locking |receive_crit_| or |send_crit_|. This
|
||||
@@ -151,40 +155,26 @@ class Call : public webrtc::Call, public PacketReceiver {
|
||||
|
||||
VideoSendStream::RtpStateMap suspended_video_send_ssrcs_;
|
||||
|
||||
VideoEngine* video_engine_;
|
||||
ViESharedData* vie_shared_data_;
|
||||
ViERTP_RTCP* rtp_rtcp_;
|
||||
ViERender* render_;
|
||||
ViEBase* base_;
|
||||
ViENetwork* network_;
|
||||
int base_channel_id_;
|
||||
ChannelGroup* channel_group_;
|
||||
|
||||
rtc::scoped_ptr<VideoRender> external_render_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Call);
|
||||
};
|
||||
} // namespace internal
|
||||
|
||||
Call* Call::Create(const Call::Config& config) {
|
||||
VideoEngine* video_engine = VideoEngine::Create();
|
||||
DCHECK(video_engine != nullptr);
|
||||
|
||||
return new internal::Call(video_engine, config);
|
||||
return new internal::Call(config);
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
|
||||
Call::Call(webrtc::VideoEngine* video_engine, const Call::Config& config)
|
||||
: config_(config),
|
||||
Call::Call(const Call::Config& config)
|
||||
: num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
|
||||
module_process_thread_(ProcessThread::Create()),
|
||||
channel_group_(new ChannelGroup(module_process_thread_.get(), nullptr)),
|
||||
base_channel_id_(0),
|
||||
next_channel_id_(base_channel_id_ + 1),
|
||||
config_(config),
|
||||
network_enabled_(true),
|
||||
receive_crit_(RWLockWrapper::CreateRWLock()),
|
||||
send_crit_(RWLockWrapper::CreateRWLock()),
|
||||
video_engine_(video_engine),
|
||||
base_channel_id_(-1),
|
||||
external_render_(
|
||||
VideoRender::CreateVideoRender(42, nullptr, false, kRenderExternal)) {
|
||||
DCHECK(video_engine != nullptr);
|
||||
send_crit_(RWLockWrapper::CreateRWLock()) {
|
||||
DCHECK(config.send_transport != nullptr);
|
||||
|
||||
DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
|
||||
@@ -195,35 +185,20 @@ Call::Call(webrtc::VideoEngine* video_engine, const Call::Config& config)
|
||||
config.bitrate_config.start_bitrate_bps);
|
||||
}
|
||||
|
||||
Trace::CreateTrace();
|
||||
module_process_thread_->Start();
|
||||
|
||||
// TODO(pbos): Remove base channel when CreateReceiveChannel no longer
|
||||
// requires one.
|
||||
CHECK(channel_group_->CreateSendChannel(base_channel_id_, 0, num_cpu_cores_,
|
||||
true));
|
||||
|
||||
if (config.overuse_callback) {
|
||||
overuse_observer_proxy_.reset(
|
||||
new CpuOveruseObserverProxy(config.overuse_callback));
|
||||
}
|
||||
|
||||
render_ = ViERender::GetInterface(video_engine_);
|
||||
DCHECK(render_ != nullptr);
|
||||
|
||||
render_->RegisterVideoRenderModule(*external_render_.get());
|
||||
|
||||
rtp_rtcp_ = ViERTP_RTCP::GetInterface(video_engine_);
|
||||
DCHECK(rtp_rtcp_ != nullptr);
|
||||
|
||||
network_ = ViENetwork::GetInterface(video_engine_);
|
||||
|
||||
// As a workaround for non-existing calls in the old API, create a base
|
||||
// channel used as default channel when creating send and receive streams.
|
||||
base_ = ViEBase::GetInterface(video_engine_);
|
||||
DCHECK(base_ != nullptr);
|
||||
|
||||
base_->CreateChannel(base_channel_id_);
|
||||
DCHECK(base_channel_id_ != -1);
|
||||
channel_group_ = base_->GetChannelGroup(base_channel_id_);
|
||||
vie_shared_data_ = base_->shared_data();
|
||||
|
||||
network_->SetBitrateConfig(base_channel_id_,
|
||||
config_.bitrate_config.min_bitrate_bps,
|
||||
config_.bitrate_config.start_bitrate_bps,
|
||||
config_.bitrate_config.max_bitrate_bps);
|
||||
SetBitrateControllerConfig(config_.bitrate_config);
|
||||
}
|
||||
|
||||
Call::~Call() {
|
||||
@@ -232,15 +207,10 @@ Call::~Call() {
|
||||
CHECK_EQ(0u, audio_receive_ssrcs_.size());
|
||||
CHECK_EQ(0u, video_receive_ssrcs_.size());
|
||||
CHECK_EQ(0u, video_receive_streams_.size());
|
||||
base_->DeleteChannel(base_channel_id_);
|
||||
|
||||
render_->DeRegisterVideoRenderModule(*external_render_.get());
|
||||
|
||||
base_->Release();
|
||||
network_->Release();
|
||||
render_->Release();
|
||||
rtp_rtcp_->Release();
|
||||
CHECK(webrtc::VideoEngine::Delete(video_engine_));
|
||||
channel_group_->DeleteChannel(base_channel_id_);
|
||||
module_process_thread_->Stop();
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
PacketReceiver* Call::Receiver() { return this; }
|
||||
@@ -285,9 +255,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(
|
||||
config_.send_transport, overuse_observer_proxy_.get(), video_engine_,
|
||||
channel_group_, vie_shared_data_->module_process_thread(), config,
|
||||
encoder_config, suspended_video_send_ssrcs_, base_channel_id_);
|
||||
config_.send_transport, overuse_observer_proxy_.get(), num_cpu_cores_,
|
||||
module_process_thread_.get(), channel_group_.get(),
|
||||
rtc::AtomicOps::Increment(&next_channel_id_), 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.
|
||||
@@ -342,8 +313,9 @@ webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream(
|
||||
TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream");
|
||||
LOG(LS_INFO) << "CreateVideoReceiveStream: " << config.ToString();
|
||||
VideoReceiveStream* receive_stream = new VideoReceiveStream(
|
||||
video_engine_, channel_group_, config, config_.send_transport,
|
||||
config_.voice_engine, base_channel_id_);
|
||||
num_cpu_cores_, base_channel_id_, channel_group_.get(),
|
||||
rtc::AtomicOps::Increment(&next_channel_id_), config,
|
||||
config_.send_transport, config_.voice_engine);
|
||||
|
||||
// This needs to be taken before receive_crit_ as both locks need to be held
|
||||
// while changing network state.
|
||||
@@ -393,12 +365,14 @@ void Call::DestroyVideoReceiveStream(
|
||||
|
||||
Call::Stats Call::GetStats() const {
|
||||
Stats stats;
|
||||
// Ignoring return values.
|
||||
// Fetch available send/receive bitrates.
|
||||
uint32_t send_bandwidth = 0;
|
||||
rtp_rtcp_->GetEstimatedSendBandwidth(base_channel_id_, &send_bandwidth);
|
||||
stats.send_bandwidth_bps = send_bandwidth;
|
||||
channel_group_->GetBitrateController()->AvailableBandwidth(&send_bandwidth);
|
||||
std::vector<unsigned int> ssrcs;
|
||||
uint32_t recv_bandwidth = 0;
|
||||
rtp_rtcp_->GetEstimatedReceiveBandwidth(base_channel_id_, &recv_bandwidth);
|
||||
channel_group_->GetRemoteBitrateEstimator()->LatestEstimate(&ssrcs,
|
||||
&recv_bandwidth);
|
||||
stats.send_bandwidth_bps = send_bandwidth;
|
||||
stats.recv_bandwidth_bps = recv_bandwidth;
|
||||
stats.pacer_delay_ms = channel_group_->GetPacerQueuingDelayMs();
|
||||
{
|
||||
@@ -429,8 +403,16 @@ void Call::SetBitrateConfig(
|
||||
return;
|
||||
}
|
||||
config_.bitrate_config = bitrate_config;
|
||||
network_->SetBitrateConfig(base_channel_id_, bitrate_config.min_bitrate_bps,
|
||||
bitrate_config.start_bitrate_bps,
|
||||
SetBitrateControllerConfig(bitrate_config);
|
||||
}
|
||||
|
||||
void Call::SetBitrateControllerConfig(
|
||||
const webrtc::Call::Config::BitrateConfig& bitrate_config) {
|
||||
BitrateController* bitrate_controller =
|
||||
channel_group_->GetBitrateController();
|
||||
if (bitrate_config.start_bitrate_bps > 0)
|
||||
bitrate_controller->SetStartBitrate(bitrate_config.start_bitrate_bps);
|
||||
bitrate_controller->SetMinMaxBitrate(bitrate_config.min_bitrate_bps,
|
||||
bitrate_config.max_bitrate_bps);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "webrtc/modules/remote_bitrate_estimator/rate_statistics.h"
|
||||
#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
|
||||
#include "webrtc/video_engine/include/vie_codec.h"
|
||||
#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
|
||||
#include "webrtc/video_engine/report_block_stats.h"
|
||||
#include "webrtc/video_receive_stream.h"
|
||||
#include "webrtc/video_renderer.h"
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/video_engine/include/vie_base.h"
|
||||
#include "webrtc/video_engine/include/vie_capture.h"
|
||||
#include "webrtc/video_engine/include/vie_codec.h"
|
||||
#include "webrtc/video_send_stream.h"
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
#include "webrtc/video/receive_statistics_proxy.h"
|
||||
#include "webrtc/video_encoder.h"
|
||||
#include "webrtc/video_engine/include/vie_base.h"
|
||||
#include "webrtc/video_receive_stream.h"
|
||||
|
||||
namespace webrtc {
|
||||
@@ -124,24 +123,24 @@ VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
VideoReceiveStream::VideoReceiveStream(webrtc::VideoEngine* video_engine,
|
||||
VideoReceiveStream::VideoReceiveStream(int num_cpu_cores,
|
||||
int base_channel_id,
|
||||
ChannelGroup* channel_group,
|
||||
int channel_id,
|
||||
const VideoReceiveStream::Config& config,
|
||||
newapi::Transport* transport,
|
||||
webrtc::VoiceEngine* voice_engine,
|
||||
int base_channel)
|
||||
webrtc::VoiceEngine* voice_engine)
|
||||
: transport_adapter_(transport),
|
||||
encoded_frame_proxy_(config.pre_decode_callback),
|
||||
config_(config),
|
||||
clock_(Clock::GetRealTimeClock()),
|
||||
channel_group_(channel_group),
|
||||
voe_sync_interface_(nullptr),
|
||||
channel_(-1) {
|
||||
video_engine_base_ = ViEBase::GetInterface(video_engine);
|
||||
video_engine_base_->CreateReceiveChannel(channel_, base_channel);
|
||||
DCHECK(channel_ != -1);
|
||||
channel_id_(channel_id),
|
||||
voe_sync_interface_(nullptr) {
|
||||
CHECK(channel_group_->CreateReceiveChannel(channel_id_, 0, base_channel_id,
|
||||
num_cpu_cores, true));
|
||||
|
||||
vie_channel_ = video_engine_base_->GetChannel(channel_);
|
||||
vie_channel_ = channel_group_->GetChannel(channel_id_);
|
||||
|
||||
// TODO(pbos): This is not fine grained enough...
|
||||
vie_channel_->SetNACKStatus(config_.rtp.nack.rtp_history_ms > 0);
|
||||
@@ -237,10 +236,7 @@ VideoReceiveStream::VideoReceiveStream(webrtc::VideoEngine* video_engine,
|
||||
CHECK_EQ(0, vie_channel_->SetReceiveCodec(codec));
|
||||
}
|
||||
|
||||
// Register a renderer without a window handle, at depth 0, that covers the
|
||||
// entire rendered area (0->1 both axes). This registers a renderer that
|
||||
// renders the entire video.
|
||||
incoming_video_stream_.reset(new IncomingVideoStream(channel_));
|
||||
incoming_video_stream_.reset(new IncomingVideoStream(0));
|
||||
incoming_video_stream_->SetExpectedRenderDelay(config.render_delay_ms);
|
||||
incoming_video_stream_->SetExternalCallback(this);
|
||||
vie_channel_->SetIncomingVideoStream(incoming_video_stream_.get());
|
||||
@@ -273,8 +269,7 @@ VideoReceiveStream::~VideoReceiveStream() {
|
||||
vie_channel_->RegisterReceiveChannelRtpStatisticsCallback(nullptr);
|
||||
vie_channel_->RegisterReceiveChannelRtcpStatisticsCallback(nullptr);
|
||||
vie_channel_->RegisterRtcpPacketTypeCounterObserver(nullptr);
|
||||
video_engine_base_->DeleteChannel(channel_);
|
||||
video_engine_base_->Release();
|
||||
channel_group_->DeleteChannel(channel_id_);
|
||||
}
|
||||
|
||||
void VideoReceiveStream::Start() {
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "webrtc/video/encoded_frame_callback_adapter.h"
|
||||
#include "webrtc/video/receive_statistics_proxy.h"
|
||||
#include "webrtc/video/transport_adapter.h"
|
||||
#include "webrtc/video_engine/include/vie_render.h"
|
||||
#include "webrtc/video_engine/vie_channel.h"
|
||||
#include "webrtc/video_engine/vie_channel_group.h"
|
||||
#include "webrtc/video_engine/vie_encoder.h"
|
||||
@@ -30,8 +29,6 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class VideoEngine;
|
||||
class ViEBase;
|
||||
class VoiceEngine;
|
||||
|
||||
namespace internal {
|
||||
@@ -40,12 +37,13 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
|
||||
public I420FrameCallback,
|
||||
public VideoRenderCallback {
|
||||
public:
|
||||
VideoReceiveStream(webrtc::VideoEngine* video_engine,
|
||||
VideoReceiveStream(int num_cpu_cores,
|
||||
int base_channel_id,
|
||||
ChannelGroup* channel_group,
|
||||
int channel_id,
|
||||
const VideoReceiveStream::Config& config,
|
||||
newapi::Transport* transport,
|
||||
webrtc::VoiceEngine* voice_engine,
|
||||
int base_channel);
|
||||
webrtc::VoiceEngine* voice_engine);
|
||||
virtual ~VideoReceiveStream();
|
||||
|
||||
void Start() override;
|
||||
@@ -73,16 +71,14 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
|
||||
Clock* const clock_;
|
||||
|
||||
ChannelGroup* const channel_group_;
|
||||
const int channel_id_;
|
||||
|
||||
ViEChannel* vie_channel_;
|
||||
rtc::scoped_ptr<IncomingVideoStream> incoming_video_stream_;
|
||||
|
||||
ViEBase* video_engine_base_;
|
||||
|
||||
VoEVideoSync* voe_sync_interface_;
|
||||
|
||||
rtc::scoped_ptr<ReceiveStatisticsProxy> stats_proxy_;
|
||||
|
||||
int channel_;
|
||||
};
|
||||
} // namespace internal
|
||||
} // namespace webrtc
|
||||
|
||||
@@ -20,12 +20,11 @@
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
#include "webrtc/system_wrappers/interface/trace_event.h"
|
||||
#include "webrtc/video_engine/encoder_state_feedback.h"
|
||||
#include "webrtc/video_engine/include/vie_base.h"
|
||||
#include "webrtc/video_engine/vie_capturer.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_engine/vie_defines.h"
|
||||
#include "webrtc/video_engine/vie_encoder.h"
|
||||
#include "webrtc/video_send_stream.h"
|
||||
|
||||
namespace webrtc {
|
||||
@@ -104,30 +103,25 @@ namespace internal {
|
||||
VideoSendStream::VideoSendStream(
|
||||
newapi::Transport* transport,
|
||||
CpuOveruseObserver* overuse_observer,
|
||||
webrtc::VideoEngine* video_engine,
|
||||
ChannelGroup* channel_group,
|
||||
int num_cpu_cores,
|
||||
ProcessThread* module_process_thread,
|
||||
ChannelGroup* channel_group,
|
||||
int channel_id,
|
||||
const VideoSendStream::Config& config,
|
||||
const VideoEncoderConfig& encoder_config,
|
||||
const std::map<uint32_t, RtpState>& suspended_ssrcs,
|
||||
int base_channel)
|
||||
const std::map<uint32_t, RtpState>& suspended_ssrcs)
|
||||
: transport_adapter_(transport),
|
||||
encoded_frame_proxy_(config.post_encode_callback),
|
||||
config_(config),
|
||||
suspended_ssrcs_(suspended_ssrcs),
|
||||
channel_group_(channel_group),
|
||||
module_process_thread_(module_process_thread),
|
||||
channel_(-1),
|
||||
channel_group_(channel_group),
|
||||
channel_id_(channel_id),
|
||||
use_config_bitrate_(true),
|
||||
stats_proxy_(Clock::GetRealTimeClock(), config) {
|
||||
// TODO(pbos): Move channel creation out of vie_base as soon as these are no
|
||||
// longer referenced by channel ids.
|
||||
video_engine_base_ = ViEBase::GetInterface(video_engine);
|
||||
video_engine_base_->CreateChannelWithoutDefaultEncoder(channel_,
|
||||
base_channel);
|
||||
DCHECK(channel_ != -1);
|
||||
vie_channel_ = video_engine_base_->GetChannel(channel_);
|
||||
vie_encoder_ = video_engine_base_->GetEncoder(channel_);
|
||||
CHECK(channel_group->CreateSendChannel(channel_id_, 0, num_cpu_cores, true));
|
||||
vie_channel_ = channel_group_->GetChannel(channel_id_);
|
||||
vie_encoder_ = channel_group_->GetEncoder(channel_id_);
|
||||
|
||||
DCHECK(!config_.rtp.ssrcs.empty());
|
||||
|
||||
@@ -148,8 +142,7 @@ VideoSendStream::VideoSendStream(
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(pbos): Remove channel_group_ usage from VideoSendStream. This should
|
||||
// be configured in call.cc.
|
||||
// TODO(pbos): Consider configuring REMB in Call.
|
||||
channel_group_->SetChannelRembStatus(true, false, vie_channel_);
|
||||
|
||||
// Enable NACK, FEC or both.
|
||||
@@ -187,7 +180,7 @@ VideoSendStream::VideoSendStream(
|
||||
vie_channel_->SetRTCPCName(rtcp_cname);
|
||||
|
||||
vie_capturer_ = ViECapturer::CreateViECapturer(module_process_thread_);
|
||||
CHECK_EQ(0, vie_capturer_->RegisterFrameCallback(channel_, vie_encoder_));
|
||||
CHECK_EQ(0, vie_capturer_->RegisterFrameCallback(channel_id_, vie_encoder_));
|
||||
|
||||
vie_channel_->RegisterSendTransport(&transport_adapter_);
|
||||
// 28 to match packet overhead in ModuleRtpRtcpImpl.
|
||||
@@ -210,8 +203,8 @@ VideoSendStream::VideoSendStream(
|
||||
// Registered regardless of monitoring, used for stats.
|
||||
vie_capturer_->RegisterCpuOveruseMetricsObserver(&stats_proxy_);
|
||||
|
||||
video_engine_base_->RegisterSendSideDelayObserver(channel_, &stats_proxy_);
|
||||
video_engine_base_->RegisterSendStatisticsProxy(channel_, &stats_proxy_);
|
||||
vie_channel_->RegisterSendSideDelayObserver(&stats_proxy_);
|
||||
vie_encoder_->RegisterSendStatisticsProxy(&stats_proxy_);
|
||||
|
||||
vie_encoder_->RegisterPreEncodeCallback(config_.pre_encode_callback);
|
||||
if (config_.post_encode_callback)
|
||||
@@ -256,9 +249,7 @@ VideoSendStream::~VideoSendStream() {
|
||||
vie_encoder_->DeRegisterExternalEncoder(
|
||||
config_.encoder_settings.payload_type);
|
||||
|
||||
video_engine_base_->DeleteChannel(channel_);
|
||||
|
||||
video_engine_base_->Release();
|
||||
channel_group_->DeleteChannel(channel_id_);
|
||||
}
|
||||
|
||||
void VideoSendStream::IncomingCapturedFrame(const I420VideoFrame& frame) {
|
||||
@@ -274,13 +265,19 @@ VideoSendStreamInput* VideoSendStream::Input() { return this; }
|
||||
|
||||
void VideoSendStream::Start() {
|
||||
transport_adapter_.Enable();
|
||||
video_engine_base_->StartSend(channel_);
|
||||
video_engine_base_->StartReceive(channel_);
|
||||
vie_encoder_->Pause();
|
||||
if (vie_channel_->StartSend() == 0) {
|
||||
// Was not already started, trigger a keyframe.
|
||||
vie_encoder_->SendKeyFrame();
|
||||
}
|
||||
vie_encoder_->Restart();
|
||||
vie_channel_->StartReceive();
|
||||
}
|
||||
|
||||
void VideoSendStream::Stop() {
|
||||
video_engine_base_->StopSend(channel_);
|
||||
video_engine_base_->StopReceive(channel_);
|
||||
// TODO(pbos): Make sure the encoder stops here.
|
||||
vie_channel_->StopSend();
|
||||
vie_channel_->StopReceive();
|
||||
transport_adapter_.Disable();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,11 +28,9 @@ namespace webrtc {
|
||||
|
||||
class CpuOveruseObserver;
|
||||
class ProcessThread;
|
||||
class ViEBase;
|
||||
class ViECapturer;
|
||||
class ViEChannel;
|
||||
class ViEEncoder;
|
||||
class VideoEngine;
|
||||
|
||||
namespace internal {
|
||||
|
||||
@@ -41,13 +39,13 @@ class VideoSendStream : public webrtc::VideoSendStream,
|
||||
public:
|
||||
VideoSendStream(newapi::Transport* transport,
|
||||
CpuOveruseObserver* overuse_observer,
|
||||
webrtc::VideoEngine* video_engine,
|
||||
ChannelGroup* channel_group,
|
||||
int num_cpu_cores,
|
||||
ProcessThread* module_process_thread,
|
||||
ChannelGroup* channel_group,
|
||||
int channel_id,
|
||||
const VideoSendStream::Config& config,
|
||||
const VideoEncoderConfig& encoder_config,
|
||||
const std::map<uint32_t, RtpState>& suspended_ssrcs,
|
||||
int base_channel);
|
||||
const std::map<uint32_t, RtpState>& suspended_ssrcs);
|
||||
|
||||
virtual ~VideoSendStream();
|
||||
|
||||
@@ -82,16 +80,14 @@ class VideoSendStream : public webrtc::VideoSendStream,
|
||||
VideoEncoderConfig encoder_config_;
|
||||
std::map<uint32_t, RtpState> suspended_ssrcs_;
|
||||
|
||||
ChannelGroup* const channel_group_;
|
||||
ProcessThread* const module_process_thread_;
|
||||
ChannelGroup* const channel_group_;
|
||||
const int channel_id_;
|
||||
|
||||
ViEBase* video_engine_base_;
|
||||
ViEChannel* vie_channel_;
|
||||
ViEEncoder* vie_encoder_;
|
||||
ViECapturer* vie_capturer_;
|
||||
|
||||
int channel_;
|
||||
|
||||
// Used as a workaround to indicate that we should be using the configured
|
||||
// start bitrate initially, instead of the one reported by VideoEngine (which
|
||||
// defaults to too high).
|
||||
|
||||
Reference in New Issue
Block a user