Remove ViECapture usage in VideoSendStream.
Instead a ViECapturer object is allocated and directly operated on. This additionally exposes ViESharedData to Call to access the module ProcessThread, moving towards Call ownership of shared resources. BUG=1695 R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/45339004 Cr-Commit-Position: refs/heads/master@{#9119}
This commit is contained in:
parent
46bd31b994
commit
f16fcbec73
@ -718,6 +718,7 @@ class FakeWebRtcVideoEngine
|
|||||||
}
|
}
|
||||||
webrtc::ViEChannel* GetChannel(int channel_id) override { return nullptr; }
|
webrtc::ViEChannel* GetChannel(int channel_id) override { return nullptr; }
|
||||||
webrtc::ViEEncoder* GetEncoder(int channel_id) override { return nullptr; }
|
webrtc::ViEEncoder* GetEncoder(int channel_id) override { return nullptr; }
|
||||||
|
webrtc::ViESharedData* shared_data() override { return nullptr; }
|
||||||
|
|
||||||
WEBRTC_FUNC(CreateReceiveChannel, (int& channel, int original_channel)) {
|
WEBRTC_FUNC(CreateReceiveChannel, (int& channel, int original_channel)) {
|
||||||
return CreateChannel(channel, original_channel);
|
return CreateChannel(channel, original_channel);
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "webrtc/video/audio_receive_stream.h"
|
#include "webrtc/video/audio_receive_stream.h"
|
||||||
#include "webrtc/video/video_receive_stream.h"
|
#include "webrtc/video/video_receive_stream.h"
|
||||||
#include "webrtc/video/video_send_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_base.h"
|
||||||
#include "webrtc/video_engine/include/vie_codec.h"
|
#include "webrtc/video_engine/include/vie_codec.h"
|
||||||
#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
|
#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
|
||||||
@ -152,8 +153,8 @@ class Call : public webrtc::Call, public PacketReceiver {
|
|||||||
VideoSendStream::RtpStateMap suspended_video_send_ssrcs_;
|
VideoSendStream::RtpStateMap suspended_video_send_ssrcs_;
|
||||||
|
|
||||||
VideoEngine* video_engine_;
|
VideoEngine* video_engine_;
|
||||||
|
ViESharedData* vie_shared_data_;
|
||||||
ViERTP_RTCP* rtp_rtcp_;
|
ViERTP_RTCP* rtp_rtcp_;
|
||||||
ViECodec* codec_;
|
|
||||||
ViERender* render_;
|
ViERender* render_;
|
||||||
ViEBase* base_;
|
ViEBase* base_;
|
||||||
ViENetwork* network_;
|
ViENetwork* network_;
|
||||||
@ -209,9 +210,6 @@ Call::Call(webrtc::VideoEngine* video_engine, const Call::Config& config)
|
|||||||
rtp_rtcp_ = ViERTP_RTCP::GetInterface(video_engine_);
|
rtp_rtcp_ = ViERTP_RTCP::GetInterface(video_engine_);
|
||||||
DCHECK(rtp_rtcp_ != nullptr);
|
DCHECK(rtp_rtcp_ != nullptr);
|
||||||
|
|
||||||
codec_ = ViECodec::GetInterface(video_engine_);
|
|
||||||
DCHECK(codec_ != nullptr);
|
|
||||||
|
|
||||||
network_ = ViENetwork::GetInterface(video_engine_);
|
network_ = ViENetwork::GetInterface(video_engine_);
|
||||||
|
|
||||||
// As a workaround for non-existing calls in the old API, create a base
|
// As a workaround for non-existing calls in the old API, create a base
|
||||||
@ -222,6 +220,7 @@ Call::Call(webrtc::VideoEngine* video_engine, const Call::Config& config)
|
|||||||
base_->CreateChannel(base_channel_id_);
|
base_->CreateChannel(base_channel_id_);
|
||||||
DCHECK(base_channel_id_ != -1);
|
DCHECK(base_channel_id_ != -1);
|
||||||
channel_group_ = base_->GetChannelGroup(base_channel_id_);
|
channel_group_ = base_->GetChannelGroup(base_channel_id_);
|
||||||
|
vie_shared_data_ = base_->shared_data();
|
||||||
|
|
||||||
network_->SetBitrateConfig(base_channel_id_,
|
network_->SetBitrateConfig(base_channel_id_,
|
||||||
config_.bitrate_config.min_bitrate_bps,
|
config_.bitrate_config.min_bitrate_bps,
|
||||||
@ -241,7 +240,6 @@ Call::~Call() {
|
|||||||
|
|
||||||
base_->Release();
|
base_->Release();
|
||||||
network_->Release();
|
network_->Release();
|
||||||
codec_->Release();
|
|
||||||
render_->Release();
|
render_->Release();
|
||||||
rtp_rtcp_->Release();
|
rtp_rtcp_->Release();
|
||||||
CHECK(webrtc::VideoEngine::Delete(video_engine_));
|
CHECK(webrtc::VideoEngine::Delete(video_engine_));
|
||||||
@ -288,10 +286,10 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream(
|
|||||||
|
|
||||||
// TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if
|
// TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if
|
||||||
// the call has already started.
|
// the call has already started.
|
||||||
VideoSendStream* send_stream =
|
VideoSendStream* send_stream = new VideoSendStream(
|
||||||
new VideoSendStream(config_.send_transport, overuse_observer_proxy_.get(),
|
config_.send_transport, overuse_observer_proxy_.get(), video_engine_,
|
||||||
video_engine_, channel_group_, config, encoder_config,
|
channel_group_, vie_shared_data_->module_process_thread(), config,
|
||||||
suspended_video_send_ssrcs_, base_channel_id_);
|
encoder_config, suspended_video_send_ssrcs_, base_channel_id_);
|
||||||
|
|
||||||
// This needs to be taken before send_crit_ as both locks need to be held
|
// This needs to be taken before send_crit_ as both locks need to be held
|
||||||
// while changing network state.
|
// while changing network state.
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "webrtc/video_engine/include/vie_external_codec.h"
|
#include "webrtc/video_engine/include/vie_external_codec.h"
|
||||||
#include "webrtc/video_engine/include/vie_image_process.h"
|
#include "webrtc/video_engine/include/vie_image_process.h"
|
||||||
#include "webrtc/video_engine/include/vie_network.h"
|
#include "webrtc/video_engine/include/vie_network.h"
|
||||||
|
#include "webrtc/video_engine/vie_capturer.h"
|
||||||
#include "webrtc/video_engine/vie_channel.h"
|
#include "webrtc/video_engine/vie_channel.h"
|
||||||
#include "webrtc/video_engine/vie_channel_group.h"
|
#include "webrtc/video_engine/vie_channel_group.h"
|
||||||
#include "webrtc/video_engine/vie_encoder.h"
|
#include "webrtc/video_engine/vie_encoder.h"
|
||||||
@ -109,6 +110,7 @@ VideoSendStream::VideoSendStream(
|
|||||||
CpuOveruseObserver* overuse_observer,
|
CpuOveruseObserver* overuse_observer,
|
||||||
webrtc::VideoEngine* video_engine,
|
webrtc::VideoEngine* video_engine,
|
||||||
ChannelGroup* channel_group,
|
ChannelGroup* channel_group,
|
||||||
|
ProcessThread* module_process_thread,
|
||||||
const VideoSendStream::Config& config,
|
const VideoSendStream::Config& config,
|
||||||
const VideoEncoderConfig& encoder_config,
|
const VideoEncoderConfig& encoder_config,
|
||||||
const std::map<uint32_t, RtpState>& suspended_ssrcs,
|
const std::map<uint32_t, RtpState>& suspended_ssrcs,
|
||||||
@ -118,6 +120,7 @@ VideoSendStream::VideoSendStream(
|
|||||||
config_(config),
|
config_(config),
|
||||||
suspended_ssrcs_(suspended_ssrcs),
|
suspended_ssrcs_(suspended_ssrcs),
|
||||||
channel_group_(channel_group),
|
channel_group_(channel_group),
|
||||||
|
module_process_thread_(module_process_thread),
|
||||||
channel_(-1),
|
channel_(-1),
|
||||||
use_config_bitrate_(true),
|
use_config_bitrate_(true),
|
||||||
stats_proxy_(Clock::GetRealTimeClock(), config) {
|
stats_proxy_(Clock::GetRealTimeClock(), config) {
|
||||||
@ -187,9 +190,8 @@ VideoSendStream::VideoSendStream(
|
|||||||
|
|
||||||
vie_channel_->SetRTCPCName(rtcp_cname);
|
vie_channel_->SetRTCPCName(rtcp_cname);
|
||||||
|
|
||||||
capture_ = ViECapture::GetInterface(video_engine);
|
vie_capturer_ = ViECapturer::CreateViECapturer(module_process_thread_);
|
||||||
capture_->AllocateExternalCaptureDevice(capture_id_, external_capture_);
|
CHECK_EQ(0, vie_capturer_->RegisterFrameCallback(channel_, vie_encoder_));
|
||||||
capture_->ConnectCaptureDevice(capture_id_, channel_);
|
|
||||||
|
|
||||||
vie_channel_->RegisterSendTransport(&transport_adapter_);
|
vie_channel_->RegisterSendTransport(&transport_adapter_);
|
||||||
// 28 to match packet overhead in ModuleRtpRtcpImpl.
|
// 28 to match packet overhead in ModuleRtpRtcpImpl.
|
||||||
@ -207,11 +209,11 @@ VideoSendStream::VideoSendStream(
|
|||||||
codec_ = ViECodec::GetInterface(video_engine);
|
codec_ = ViECodec::GetInterface(video_engine);
|
||||||
CHECK(ReconfigureVideoEncoder(encoder_config));
|
CHECK(ReconfigureVideoEncoder(encoder_config));
|
||||||
|
|
||||||
if (overuse_observer)
|
if (overuse_observer) {
|
||||||
video_engine_base_->RegisterCpuOveruseObserver(channel_, overuse_observer);
|
vie_capturer_->RegisterCpuOveruseObserver(overuse_observer);
|
||||||
|
}
|
||||||
// Registered regardless of monitoring, used for stats.
|
// Registered regardless of monitoring, used for stats.
|
||||||
video_engine_base_->RegisterCpuOveruseMetricsObserver(channel_,
|
vie_capturer_->RegisterCpuOveruseMetricsObserver(&stats_proxy_);
|
||||||
&stats_proxy_);
|
|
||||||
|
|
||||||
video_engine_base_->RegisterSendSideDelayObserver(channel_, &stats_proxy_);
|
video_engine_base_->RegisterSendSideDelayObserver(channel_, &stats_proxy_);
|
||||||
video_engine_base_->RegisterSendStatisticsProxy(channel_, &stats_proxy_);
|
video_engine_base_->RegisterSendStatisticsProxy(channel_, &stats_proxy_);
|
||||||
@ -233,7 +235,6 @@ VideoSendStream::VideoSendStream(
|
|||||||
}
|
}
|
||||||
|
|
||||||
VideoSendStream::~VideoSendStream() {
|
VideoSendStream::~VideoSendStream() {
|
||||||
capture_->DeregisterObserver(capture_id_);
|
|
||||||
codec_->DeregisterEncoderObserver(channel_);
|
codec_->DeregisterEncoderObserver(channel_);
|
||||||
|
|
||||||
vie_channel_->RegisterSendFrameCountObserver(nullptr);
|
vie_channel_->RegisterSendFrameCountObserver(nullptr);
|
||||||
@ -247,8 +248,9 @@ VideoSendStream::~VideoSendStream() {
|
|||||||
|
|
||||||
vie_channel_->DeregisterSendTransport();
|
vie_channel_->DeregisterSendTransport();
|
||||||
|
|
||||||
capture_->DisconnectCaptureDevice(channel_);
|
vie_capturer_->RegisterCpuOveruseObserver(nullptr);
|
||||||
capture_->ReleaseCaptureDevice(capture_id_);
|
vie_capturer_->DeregisterFrameCallback(vie_encoder_);
|
||||||
|
delete vie_capturer_;
|
||||||
|
|
||||||
vie_encoder_->DeRegisterExternalEncoder(
|
vie_encoder_->DeRegisterExternalEncoder(
|
||||||
config_.encoder_settings.payload_type);
|
config_.encoder_settings.payload_type);
|
||||||
@ -256,7 +258,6 @@ VideoSendStream::~VideoSendStream() {
|
|||||||
video_engine_base_->DeleteChannel(channel_);
|
video_engine_base_->DeleteChannel(channel_);
|
||||||
|
|
||||||
video_engine_base_->Release();
|
video_engine_base_->Release();
|
||||||
capture_->Release();
|
|
||||||
codec_->Release();
|
codec_->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,7 +267,7 @@ void VideoSendStream::IncomingCapturedFrame(const I420VideoFrame& frame) {
|
|||||||
config_.local_renderer->RenderFrame(frame, 0);
|
config_.local_renderer->RenderFrame(frame, 0);
|
||||||
|
|
||||||
stats_proxy_.OnIncomingFrame();
|
stats_proxy_.OnIncomingFrame();
|
||||||
external_capture_->IncomingFrame(frame);
|
vie_capturer_->IncomingFrame(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoSendStreamInput* VideoSendStream::Input() { return this; }
|
VideoSendStreamInput* VideoSendStream::Input() { return this; }
|
||||||
|
@ -27,14 +27,14 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class CpuOveruseObserver;
|
class CpuOveruseObserver;
|
||||||
class VideoEngine;
|
class ProcessThread;
|
||||||
class ViEBase;
|
class ViEBase;
|
||||||
class ViECapture;
|
class ViECapturer;
|
||||||
class ViECodec;
|
|
||||||
class ViEChannel;
|
class ViEChannel;
|
||||||
|
class ViECodec;
|
||||||
class ViEEncoder;
|
class ViEEncoder;
|
||||||
class ViEExternalCapture;
|
|
||||||
class ViEExternalCodec;
|
class ViEExternalCodec;
|
||||||
|
class VideoEngine;
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
@ -45,6 +45,7 @@ class VideoSendStream : public webrtc::VideoSendStream,
|
|||||||
CpuOveruseObserver* overuse_observer,
|
CpuOveruseObserver* overuse_observer,
|
||||||
webrtc::VideoEngine* video_engine,
|
webrtc::VideoEngine* video_engine,
|
||||||
ChannelGroup* channel_group,
|
ChannelGroup* channel_group,
|
||||||
|
ProcessThread* module_process_thread,
|
||||||
const VideoSendStream::Config& config,
|
const VideoSendStream::Config& config,
|
||||||
const VideoEncoderConfig& encoder_config,
|
const VideoEncoderConfig& encoder_config,
|
||||||
const std::map<uint32_t, RtpState>& suspended_ssrcs,
|
const std::map<uint32_t, RtpState>& suspended_ssrcs,
|
||||||
@ -83,16 +84,15 @@ class VideoSendStream : public webrtc::VideoSendStream,
|
|||||||
std::map<uint32_t, RtpState> suspended_ssrcs_;
|
std::map<uint32_t, RtpState> suspended_ssrcs_;
|
||||||
|
|
||||||
ChannelGroup* const channel_group_;
|
ChannelGroup* const channel_group_;
|
||||||
|
ProcessThread* const module_process_thread_;
|
||||||
|
|
||||||
ViEBase* video_engine_base_;
|
ViEBase* video_engine_base_;
|
||||||
ViECapture* capture_;
|
|
||||||
ViEChannel* vie_channel_;
|
ViEChannel* vie_channel_;
|
||||||
ViECodec* codec_;
|
ViECodec* codec_;
|
||||||
ViEEncoder* vie_encoder_;
|
ViEEncoder* vie_encoder_;
|
||||||
ViEExternalCapture* external_capture_;
|
ViECapturer* vie_capturer_;
|
||||||
|
|
||||||
int channel_;
|
int channel_;
|
||||||
int capture_id_;
|
|
||||||
|
|
||||||
// Used as a workaround to indicate that we should be using the configured
|
// Used as a workaround to indicate that we should be using the configured
|
||||||
// start bitrate initially, instead of the one reported by VideoEngine (which
|
// start bitrate initially, instead of the one reported by VideoEngine (which
|
||||||
|
@ -34,7 +34,7 @@ class SendStatisticsProxy;
|
|||||||
class ChannelGroup;
|
class ChannelGroup;
|
||||||
class ViEChannel;
|
class ViEChannel;
|
||||||
class ViEEncoder;
|
class ViEEncoder;
|
||||||
class ViERenderManager;
|
class ViESharedData;
|
||||||
|
|
||||||
// CpuOveruseObserver is called when a system overuse is detected and
|
// CpuOveruseObserver is called when a system overuse is detected and
|
||||||
// VideoEngine cannot keep up the encoding frequency.
|
// VideoEngine cannot keep up the encoding frequency.
|
||||||
@ -269,6 +269,8 @@ class WEBRTC_DLLEXPORT ViEBase {
|
|||||||
int channel,
|
int channel,
|
||||||
ReceiveStatisticsProxy* receive_statistics_proxy) = 0;
|
ReceiveStatisticsProxy* receive_statistics_proxy) = 0;
|
||||||
|
|
||||||
|
virtual ViESharedData* shared_data() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ViEBase() {}
|
ViEBase() {}
|
||||||
virtual ~ViEBase() {}
|
virtual ~ViEBase() {}
|
||||||
|
@ -67,12 +67,12 @@ class ViEBaseImpl
|
|||||||
virtual int GetVersion(char version[1024]);
|
virtual int GetVersion(char version[1024]);
|
||||||
virtual int LastError();
|
virtual int LastError();
|
||||||
|
|
||||||
|
ViESharedData* shared_data() { return &shared_data_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit ViEBaseImpl(const Config& config);
|
explicit ViEBaseImpl(const Config& config);
|
||||||
virtual ~ViEBaseImpl();
|
virtual ~ViEBaseImpl();
|
||||||
|
|
||||||
ViESharedData* shared_data() { return &shared_data_; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int CreateChannel(int& video_channel, int original_channel, // NOLINT
|
int CreateChannel(int& video_channel, int original_channel, // NOLINT
|
||||||
bool sender, bool disable_default_encoder);
|
bool sender, bool disable_default_encoder);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "webrtc/video_engine/vie_capturer.h"
|
#include "webrtc/video_engine/vie_capturer.h"
|
||||||
|
|
||||||
|
#include "webrtc/base/checks.h"
|
||||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||||
#include "webrtc/modules/interface/module_common_types.h"
|
#include "webrtc/modules/interface/module_common_types.h"
|
||||||
#include "webrtc/modules/utility/interface/process_thread.h"
|
#include "webrtc/modules/utility/interface/process_thread.h"
|
||||||
@ -58,8 +59,7 @@ class RegistrableCpuOveruseMetricsObserver : public CpuOveruseMetricsObserver {
|
|||||||
|
|
||||||
ViECapturer::ViECapturer(int capture_id,
|
ViECapturer::ViECapturer(int capture_id,
|
||||||
int engine_id,
|
int engine_id,
|
||||||
const Config& config,
|
ProcessThread* module_process_thread)
|
||||||
ProcessThread& module_process_thread)
|
|
||||||
: ViEFrameProviderBase(capture_id, engine_id),
|
: ViEFrameProviderBase(capture_id, engine_id),
|
||||||
capture_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
capture_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
effects_and_stats_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
effects_and_stats_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
@ -92,11 +92,11 @@ ViECapturer::ViECapturer(int capture_id,
|
|||||||
cpu_overuse_metrics_observer_.get())) {
|
cpu_overuse_metrics_observer_.get())) {
|
||||||
capture_thread_->Start();
|
capture_thread_->Start();
|
||||||
capture_thread_->SetPriority(kHighPriority);
|
capture_thread_->SetPriority(kHighPriority);
|
||||||
module_process_thread_.RegisterModule(overuse_detector_.get());
|
module_process_thread_->RegisterModule(overuse_detector_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
ViECapturer::~ViECapturer() {
|
ViECapturer::~ViECapturer() {
|
||||||
module_process_thread_.DeRegisterModule(overuse_detector_.get());
|
module_process_thread_->DeRegisterModule(overuse_detector_.get());
|
||||||
|
|
||||||
// Stop the thread.
|
// Stop the thread.
|
||||||
rtc::AtomicOps::Increment(&stop_);
|
rtc::AtomicOps::Increment(&stop_);
|
||||||
@ -104,7 +104,7 @@ ViECapturer::~ViECapturer() {
|
|||||||
|
|
||||||
// Stop the camera input.
|
// Stop the camera input.
|
||||||
if (capture_module_) {
|
if (capture_module_) {
|
||||||
module_process_thread_.DeRegisterModule(capture_module_);
|
module_process_thread_->DeRegisterModule(capture_module_);
|
||||||
capture_module_->DeRegisterCaptureDataCallback();
|
capture_module_->DeRegisterCaptureDataCallback();
|
||||||
capture_module_->Release();
|
capture_module_->Release();
|
||||||
capture_module_ = NULL;
|
capture_module_ = NULL;
|
||||||
@ -124,14 +124,22 @@ ViECapturer::~ViECapturer() {
|
|||||||
delete brightness_frame_stats_;
|
delete brightness_frame_stats_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ViECapturer* ViECapturer::CreateViECapturer(
|
||||||
|
ProcessThread* module_process_thread) {
|
||||||
|
ViECapturer* capturer = new ViECapturer(0, 0, module_process_thread);
|
||||||
|
// Init with nullptr, 0 will set capture as an external capturer.
|
||||||
|
CHECK_EQ(0, capturer->Init(nullptr, 0));
|
||||||
|
return capturer;
|
||||||
|
}
|
||||||
|
|
||||||
ViECapturer* ViECapturer::CreateViECapture(
|
ViECapturer* ViECapturer::CreateViECapture(
|
||||||
int capture_id,
|
int capture_id,
|
||||||
int engine_id,
|
int engine_id,
|
||||||
const Config& config,
|
const Config& config,
|
||||||
VideoCaptureModule* capture_module,
|
VideoCaptureModule* capture_module,
|
||||||
ProcessThread& module_process_thread) {
|
ProcessThread& module_process_thread) {
|
||||||
ViECapturer* capture = new ViECapturer(capture_id, engine_id, config,
|
ViECapturer* capture = new ViECapturer(capture_id, engine_id,
|
||||||
module_process_thread);
|
&module_process_thread);
|
||||||
if (!capture || capture->Init(capture_module) != 0) {
|
if (!capture || capture->Init(capture_module) != 0) {
|
||||||
delete capture;
|
delete capture;
|
||||||
capture = NULL;
|
capture = NULL;
|
||||||
@ -144,7 +152,7 @@ int32_t ViECapturer::Init(VideoCaptureModule* capture_module) {
|
|||||||
capture_module_ = capture_module;
|
capture_module_ = capture_module;
|
||||||
capture_module_->RegisterCaptureDataCallback(*this);
|
capture_module_->RegisterCaptureDataCallback(*this);
|
||||||
capture_module_->AddRef();
|
capture_module_->AddRef();
|
||||||
module_process_thread_.RegisterModule(capture_module_);
|
module_process_thread_->RegisterModule(capture_module_);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,8 +163,8 @@ ViECapturer* ViECapturer::CreateViECapture(
|
|||||||
const char* device_unique_idUTF8,
|
const char* device_unique_idUTF8,
|
||||||
const uint32_t device_unique_idUTF8Length,
|
const uint32_t device_unique_idUTF8Length,
|
||||||
ProcessThread& module_process_thread) {
|
ProcessThread& module_process_thread) {
|
||||||
ViECapturer* capture = new ViECapturer(capture_id, engine_id, config,
|
ViECapturer* capture = new ViECapturer(capture_id, engine_id,
|
||||||
module_process_thread);
|
&module_process_thread);
|
||||||
if (!capture ||
|
if (!capture ||
|
||||||
capture->Init(device_unique_idUTF8, device_unique_idUTF8Length) != 0) {
|
capture->Init(device_unique_idUTF8, device_unique_idUTF8Length) != 0) {
|
||||||
delete capture;
|
delete capture;
|
||||||
@ -180,7 +188,7 @@ int32_t ViECapturer::Init(const char* device_unique_idUTF8,
|
|||||||
}
|
}
|
||||||
capture_module_->AddRef();
|
capture_module_->AddRef();
|
||||||
capture_module_->RegisterCaptureDataCallback(*this);
|
capture_module_->RegisterCaptureDataCallback(*this);
|
||||||
module_process_thread_.RegisterModule(capture_module_);
|
module_process_thread_->RegisterModule(capture_module_);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,12 @@ class ViECapturer
|
|||||||
protected VideoCaptureDataCallback,
|
protected VideoCaptureDataCallback,
|
||||||
protected VideoCaptureFeedBack {
|
protected VideoCaptureFeedBack {
|
||||||
public:
|
public:
|
||||||
|
ViECapturer(int capture_id,
|
||||||
|
int engine_id,
|
||||||
|
ProcessThread* module_process_thread);
|
||||||
|
|
||||||
|
static ViECapturer* CreateViECapturer(ProcessThread* module_process_thread);
|
||||||
|
|
||||||
static ViECapturer* CreateViECapture(int capture_id,
|
static ViECapturer* CreateViECapture(int capture_id,
|
||||||
int engine_id,
|
int engine_id,
|
||||||
const Config& config,
|
const Config& config,
|
||||||
@ -102,11 +108,6 @@ class ViECapturer
|
|||||||
void GetCpuOveruseMetrics(CpuOveruseMetrics* metrics) const;
|
void GetCpuOveruseMetrics(CpuOveruseMetrics* metrics) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ViECapturer(int capture_id,
|
|
||||||
int engine_id,
|
|
||||||
const Config& config,
|
|
||||||
ProcessThread& module_process_thread);
|
|
||||||
|
|
||||||
int32_t Init(VideoCaptureModule* capture_module);
|
int32_t Init(VideoCaptureModule* capture_module);
|
||||||
int32_t Init(const char* device_unique_idUTF8,
|
int32_t Init(const char* device_unique_idUTF8,
|
||||||
uint32_t device_unique_idUTF8Length);
|
uint32_t device_unique_idUTF8Length);
|
||||||
@ -145,7 +146,7 @@ class ViECapturer
|
|||||||
rtc::scoped_ptr<CriticalSectionWrapper> effects_and_stats_cs_;
|
rtc::scoped_ptr<CriticalSectionWrapper> effects_and_stats_cs_;
|
||||||
VideoCaptureModule* capture_module_;
|
VideoCaptureModule* capture_module_;
|
||||||
bool use_external_capture_;
|
bool use_external_capture_;
|
||||||
ProcessThread& module_process_thread_;
|
ProcessThread* const module_process_thread_;
|
||||||
const int capture_id_;
|
const int capture_id_;
|
||||||
|
|
||||||
// Frame used in IncomingFrameI420.
|
// Frame used in IncomingFrameI420.
|
||||||
|
@ -41,6 +41,9 @@ class ViESharedData {
|
|||||||
ViEChannelManager* channel_manager() { return channel_manager_.get(); }
|
ViEChannelManager* channel_manager() { return channel_manager_.get(); }
|
||||||
ViEInputManager* input_manager() { return input_manager_.get(); }
|
ViEInputManager* input_manager() { return input_manager_.get(); }
|
||||||
ViERenderManager* render_manager() { return render_manager_.get(); }
|
ViERenderManager* render_manager() { return render_manager_.get(); }
|
||||||
|
ProcessThread* module_process_thread() {
|
||||||
|
return module_process_thread_.get();
|
||||||
|
}
|
||||||
|
|
||||||
std::map<int, CpuOveruseObserver*>* overuse_observers() {
|
std::map<int, CpuOveruseObserver*>* overuse_observers() {
|
||||||
return &overuse_observers_; }
|
return &overuse_observers_; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user