Changed constructor used for CriticalSectionScoped in ViE.
Only changed: - Name of some of the critsects. - All critsects (but one) are now scoped_ptr. - Use of ptr constructor of CriticalSectionScoped instead of reference version. BUG=184 TEST=vie_auto_test Review URL: http://webrtc-codereview.appspot.com/330015 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1291 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
6a4bef4e65
commit
d32c44738a
@ -32,8 +32,8 @@ ViECapturer::ViECapturer(int capture_id,
|
||||
int engine_id,
|
||||
ProcessThread& module_process_thread)
|
||||
: ViEFrameProviderBase(capture_id, engine_id),
|
||||
capture_cs_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
deliver_cs_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
capture_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
deliver_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
capture_module_(NULL),
|
||||
external_capture_module_(NULL),
|
||||
module_process_thread_(module_process_thread),
|
||||
@ -51,9 +51,9 @@ ViECapturer::ViECapturer(int capture_id,
|
||||
current_brightness_level_(Normal),
|
||||
reported_brightness_level_(Normal),
|
||||
denoising_enabled_(false),
|
||||
observer_cs_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
observer_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
observer_(NULL),
|
||||
encoding_critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
encoding_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
capture_encoder_(NULL),
|
||||
encode_complete_callback_(NULL),
|
||||
vie_encoder_(NULL),
|
||||
@ -77,18 +77,18 @@ ViECapturer::~ViECapturer() {
|
||||
capture_id_, engine_id_);
|
||||
|
||||
// Stop the thread.
|
||||
deliver_cs_.Enter();
|
||||
capture_cs_.Enter();
|
||||
deliver_cs_->Enter();
|
||||
capture_cs_->Enter();
|
||||
capture_thread_.SetNotAlive();
|
||||
capture_event_.Set();
|
||||
capture_cs_.Leave();
|
||||
deliver_cs_.Leave();
|
||||
capture_cs_->Leave();
|
||||
deliver_cs_->Leave();
|
||||
|
||||
provider_crit_sect_.Enter();
|
||||
provider_cs_->Enter();
|
||||
if (vie_encoder_) {
|
||||
vie_encoder_->DeRegisterExternalEncoder(codec_.plType);
|
||||
}
|
||||
provider_crit_sect_.Leave();
|
||||
provider_cs_->Leave();
|
||||
|
||||
// Stop the camera input.
|
||||
if (capture_module_) {
|
||||
@ -121,10 +121,6 @@ ViECapturer::~ViECapturer() {
|
||||
if (vcm_) {
|
||||
delete vcm_;
|
||||
}
|
||||
delete &capture_cs_;
|
||||
delete &deliver_cs_;
|
||||
delete &encoding_critsect_;
|
||||
delete &observer_cs_;
|
||||
}
|
||||
|
||||
ViECapturer* ViECapturer::CreateViECapture(
|
||||
@ -224,7 +220,7 @@ WebRtc_Word32 ViECapturer::Start(const CaptureCapability capture_capability) {
|
||||
VideoCaptureCapability capability;
|
||||
requested_capability_ = capture_capability;
|
||||
if (EncoderActive()) {
|
||||
CriticalSectionScoped cs(encoding_critsect_);
|
||||
CriticalSectionScoped cs(encoding_cs_.get());
|
||||
capability.width = codec_.width;
|
||||
capability.height = codec_.height;
|
||||
capability.maxFPS = codec_.maxFramerate;
|
||||
@ -355,7 +351,7 @@ void ViECapturer::OnIncomingCapturedFrame(const WebRtc_Word32 capture_id,
|
||||
WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
"%s(capture_id: %d)", __FUNCTION__, capture_id);
|
||||
|
||||
CriticalSectionScoped cs(capture_cs_);
|
||||
CriticalSectionScoped cs(capture_cs_.get());
|
||||
if (codec_type != kVideoCodecUnknown) {
|
||||
if (encoded_frame_.Length() != 0) {
|
||||
// The last encoded frame has not been sent yet. Need to wait.
|
||||
@ -363,11 +359,11 @@ void ViECapturer::OnIncomingCapturedFrame(const WebRtc_Word32 capture_id,
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
"%s(capture_id: %d) Last encoded frame not yet delivered.",
|
||||
__FUNCTION__, capture_id);
|
||||
capture_cs_.Leave();
|
||||
capture_cs_->Leave();
|
||||
// Wait for the coded frame to be sent before unblocking this.
|
||||
deliver_event_.Wait(kMaxDeliverWaitTime);
|
||||
assert(encoded_frame_.Length() == 0);
|
||||
capture_cs_.Enter();
|
||||
capture_cs_->Enter();
|
||||
}
|
||||
encoded_frame_.SwapFrame(video_frame);
|
||||
} else {
|
||||
@ -385,7 +381,7 @@ void ViECapturer::OnCaptureDelayChanged(const WebRtc_Word32 id,
|
||||
|
||||
// Deliver the network delay to all registered callbacks.
|
||||
ViEFrameProviderBase::SetFrameDelay(delay);
|
||||
CriticalSectionScoped cs(encoding_critsect_);
|
||||
CriticalSectionScoped cs(encoding_cs_.get());
|
||||
if (vie_encoder_) {
|
||||
vie_encoder_->DelayChanged(id, delay);
|
||||
}
|
||||
@ -393,7 +389,7 @@ void ViECapturer::OnCaptureDelayChanged(const WebRtc_Word32 id,
|
||||
|
||||
WebRtc_Word32 ViECapturer::RegisterEffectFilter(
|
||||
ViEEffectFilter* effect_filter) {
|
||||
CriticalSectionScoped cs(deliver_cs_);
|
||||
CriticalSectionScoped cs(deliver_cs_.get());
|
||||
|
||||
if (!effect_filter) {
|
||||
if (!effect_filter_) {
|
||||
@ -451,7 +447,7 @@ WebRtc_Word32 ViECapturer::EnableDenoising(bool enable) {
|
||||
"%s(capture_device_id: %d, enable: %d)", __FUNCTION__,
|
||||
capture_id_, enable);
|
||||
|
||||
CriticalSectionScoped cs(deliver_cs_);
|
||||
CriticalSectionScoped cs(deliver_cs_.get());
|
||||
if (enable) {
|
||||
if (denoising_enabled_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
@ -480,7 +476,7 @@ WebRtc_Word32 ViECapturer::EnableDeflickering(bool enable) {
|
||||
"%s(capture_device_id: %d, enable: %d)", __FUNCTION__,
|
||||
capture_id_, enable);
|
||||
|
||||
CriticalSectionScoped cs(deliver_cs_);
|
||||
CriticalSectionScoped cs(deliver_cs_.get());
|
||||
if (enable) {
|
||||
if (deflicker_frame_stats_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
@ -509,7 +505,7 @@ WebRtc_Word32 ViECapturer::EnableBrightnessAlarm(bool enable) {
|
||||
"%s(capture_device_id: %d, enable: %d)", __FUNCTION__,
|
||||
capture_id_, enable);
|
||||
|
||||
CriticalSectionScoped cs(deliver_cs_);
|
||||
CriticalSectionScoped cs(deliver_cs_.get());
|
||||
if (enable) {
|
||||
if (brightness_frame_stats_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
@ -539,26 +535,26 @@ bool ViECapturer::ViECaptureThreadFunction(void* obj) {
|
||||
|
||||
bool ViECapturer::ViECaptureProcess() {
|
||||
if (capture_event_.Wait(kThreadWaitTimeMs) == kEventSignaled) {
|
||||
deliver_cs_.Enter();
|
||||
deliver_cs_->Enter();
|
||||
if (captured_frame_.Length() > 0) {
|
||||
// New I420 frame.
|
||||
capture_cs_.Enter();
|
||||
capture_cs_->Enter();
|
||||
deliver_frame_.SwapFrame(captured_frame_);
|
||||
captured_frame_.SetLength(0);
|
||||
capture_cs_.Leave();
|
||||
capture_cs_->Leave();
|
||||
DeliverI420Frame(deliver_frame_);
|
||||
}
|
||||
if (encoded_frame_.Length() > 0) {
|
||||
capture_cs_.Enter();
|
||||
capture_cs_->Enter();
|
||||
deliver_frame_.SwapFrame(encoded_frame_);
|
||||
encoded_frame_.SetLength(0);
|
||||
deliver_event_.Set();
|
||||
capture_cs_.Leave();
|
||||
capture_cs_->Leave();
|
||||
DeliverCodedFrame(deliver_frame_);
|
||||
}
|
||||
deliver_cs_.Leave();
|
||||
deliver_cs_->Leave();
|
||||
if (current_brightness_level_ != reported_brightness_level_) {
|
||||
CriticalSectionScoped cs(observer_cs_);
|
||||
CriticalSectionScoped cs(observer_cs_.get());
|
||||
if (observer_) {
|
||||
observer_->BrightnessAlarm(id_, current_brightness_level_);
|
||||
reported_brightness_level_ = current_brightness_level_;
|
||||
@ -637,28 +633,28 @@ void ViECapturer::DeliverCodedFrame(VideoFrame& video_frame) {
|
||||
|
||||
int ViECapturer::DeregisterFrameCallback(
|
||||
const ViEFrameCallback* callbackObject) {
|
||||
provider_crit_sect_.Enter();
|
||||
provider_cs_->Enter();
|
||||
if (callbackObject == vie_encoder_) {
|
||||
// Don't use this camera as encoder anymore. Need to tell the ViEEncoder.
|
||||
ViEEncoder* vie_encoder = NULL;
|
||||
vie_encoder = vie_encoder_;
|
||||
vie_encoder_ = NULL;
|
||||
provider_crit_sect_.Leave();
|
||||
provider_cs_->Leave();
|
||||
|
||||
// Need to take this here in order to avoid deadlock with VCM. The reason is
|
||||
// that VCM will call ::Release and a deadlock can occur.
|
||||
deliver_cs_.Enter();
|
||||
deliver_cs_->Enter();
|
||||
vie_encoder->DeRegisterExternalEncoder(codec_.plType);
|
||||
deliver_cs_.Leave();
|
||||
deliver_cs_->Leave();
|
||||
return 0;
|
||||
}
|
||||
provider_crit_sect_.Leave();
|
||||
provider_cs_->Leave();
|
||||
return ViEFrameProviderBase::DeregisterFrameCallback(callbackObject);
|
||||
}
|
||||
|
||||
bool ViECapturer::IsFrameCallbackRegistered(
|
||||
const ViEFrameCallback* callbackObject) {
|
||||
CriticalSectionScoped cs(provider_crit_sect_);
|
||||
CriticalSectionScoped cs(provider_cs_.get());
|
||||
if (callbackObject == vie_encoder_) {
|
||||
return true;
|
||||
}
|
||||
@ -677,7 +673,7 @@ WebRtc_Word32 ViECapturer::PreEncodeToViEEncoder(const VideoCodec& codec,
|
||||
return -1;
|
||||
}
|
||||
|
||||
CriticalSectionScoped cs(encoding_critsect_);
|
||||
CriticalSectionScoped cs(encoding_cs_.get());
|
||||
VideoCaptureModule::VideoCaptureEncodeInterface* capture_encoder =
|
||||
capture_module_->GetEncodeInterface(codec);
|
||||
if (!capture_encoder) {
|
||||
@ -729,7 +725,7 @@ WebRtc_Word32 ViECapturer::InitEncode(const VideoCodec* codec_settings,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
"%s(capture_device_id: %d)", __FUNCTION__, capture_id_);
|
||||
|
||||
CriticalSectionScoped cs(encoding_critsect_);
|
||||
CriticalSectionScoped cs(encoding_cs_.get());
|
||||
if (!capture_encoder_ || !codec_settings) {
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
}
|
||||
@ -754,7 +750,7 @@ WebRtc_Word32 ViECapturer::InitEncode(const VideoCodec* codec_settings,
|
||||
WebRtc_Word32 ViECapturer::Encode(const RawImage& input_image,
|
||||
const CodecSpecificInfo* codec_specific_info,
|
||||
const VideoFrameType* frame_types) {
|
||||
CriticalSectionScoped cs(encoding_critsect_);
|
||||
CriticalSectionScoped cs(encoding_cs_.get());
|
||||
if (!capture_encoder_) {
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
}
|
||||
@ -772,7 +768,7 @@ WebRtc_Word32 ViECapturer::RegisterEncodeCompleteCallback(
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
"%s(capture_device_id: %d)", __FUNCTION__, capture_id_);
|
||||
|
||||
CriticalSectionScoped cs(deliver_cs_);
|
||||
CriticalSectionScoped cs(deliver_cs_.get());
|
||||
if (!capture_encoder_) {
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
}
|
||||
@ -784,12 +780,12 @@ WebRtc_Word32 ViECapturer::Release() {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
"%s(capture_device_id: %d)", __FUNCTION__, capture_id_);
|
||||
{
|
||||
CriticalSectionScoped cs(deliver_cs_);
|
||||
CriticalSectionScoped cs(deliver_cs_.get());
|
||||
encode_complete_callback_ = NULL;
|
||||
}
|
||||
|
||||
{
|
||||
CriticalSectionScoped cs(encoding_critsect_);
|
||||
CriticalSectionScoped cs(encoding_cs_.get());
|
||||
|
||||
decoder_initialized_ = false;
|
||||
codec_.codecType = kVideoCodecUnknown;
|
||||
@ -819,7 +815,7 @@ WebRtc_Word32 ViECapturer::SetChannelParameters(WebRtc_UWord32 packet_loss,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
"%s(capture_device_id: %d)", __FUNCTION__, capture_id_);
|
||||
|
||||
CriticalSectionScoped cs(encoding_critsect_);
|
||||
CriticalSectionScoped cs(encoding_cs_.get());
|
||||
if (!capture_encoder_) {
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
}
|
||||
@ -831,7 +827,7 @@ WebRtc_Word32 ViECapturer::SetRates(WebRtc_UWord32 new_bit_rate,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
"%s(capture_device_id: %d)", __FUNCTION__, capture_id_);
|
||||
|
||||
CriticalSectionScoped cs(encoding_critsect_);
|
||||
CriticalSectionScoped cs(encoding_cs_.get());
|
||||
if (!capture_encoder_) {
|
||||
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
|
||||
}
|
||||
@ -839,9 +835,9 @@ WebRtc_Word32 ViECapturer::SetRates(WebRtc_UWord32 new_bit_rate,
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViECapturer::FrameToRender(VideoFrame& video_frame) {
|
||||
deliver_cs_.Enter();
|
||||
deliver_cs_->Enter();
|
||||
DeliverI420Frame(video_frame);
|
||||
deliver_cs_.Leave();
|
||||
deliver_cs_->Leave();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -861,7 +857,7 @@ WebRtc_Word32 ViECapturer::RegisterObserver(ViECaptureObserver& observer) {
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViECapturer::DeRegisterObserver() {
|
||||
CriticalSectionScoped cs(observer_cs_);
|
||||
CriticalSectionScoped cs(observer_cs_.get());
|
||||
if (!observer_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
"%s No observer registered", __FUNCTION__, capture_id_);
|
||||
@ -875,7 +871,7 @@ WebRtc_Word32 ViECapturer::DeRegisterObserver() {
|
||||
}
|
||||
|
||||
bool ViECapturer::IsObserverRegistered() {
|
||||
CriticalSectionScoped cs(observer_cs_);
|
||||
CriticalSectionScoped cs(observer_cs_.get());
|
||||
return observer_ != NULL;
|
||||
}
|
||||
|
||||
@ -884,7 +880,7 @@ void ViECapturer::OnCaptureFrameRate(const WebRtc_Word32 id,
|
||||
WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
"OnCaptureFrameRate %d", frame_rate);
|
||||
|
||||
CriticalSectionScoped cs(observer_cs_);
|
||||
CriticalSectionScoped cs(observer_cs_.get());
|
||||
observer_->CapturedFrameRate(id_, (WebRtc_UWord8) frame_rate);
|
||||
}
|
||||
|
||||
@ -893,7 +889,7 @@ void ViECapturer::OnNoPictureAlarm(const WebRtc_Word32 id,
|
||||
WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, capture_id_),
|
||||
"OnNoPictureAlarm %d", alarm);
|
||||
|
||||
CriticalSectionScoped cs(observer_cs_);
|
||||
CriticalSectionScoped cs(observer_cs_.get());
|
||||
CaptureAlarm vie_alarm = (alarm == Raised) ? AlarmRaised : AlarmCleared;
|
||||
observer_->NoPictureAlarm(id, vie_alarm);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "modules/video_coding/codecs/interface/video_codec_interface.h"
|
||||
#include "modules/video_coding/main/interface/video_coding.h"
|
||||
#include "modules/video_processing/main/interface/video_processing.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "typedefs.h"
|
||||
#include "video_engine/include/vie_capture.h"
|
||||
#include "video_engine/vie_defines.h"
|
||||
@ -168,8 +169,8 @@ class ViECapturer
|
||||
|
||||
private:
|
||||
// Never take capture_cs_ before deliver_cs_!
|
||||
CriticalSectionWrapper& capture_cs_;
|
||||
CriticalSectionWrapper& deliver_cs_;
|
||||
scoped_ptr<CriticalSectionWrapper> capture_cs_;
|
||||
scoped_ptr<CriticalSectionWrapper> deliver_cs_;
|
||||
VideoCaptureModule* capture_module_;
|
||||
VideoCaptureExternal* external_capture_module_;
|
||||
ProcessThread& module_process_thread_;
|
||||
@ -195,11 +196,11 @@ class ViECapturer
|
||||
bool denoising_enabled_;
|
||||
|
||||
// Statistics observer.
|
||||
CriticalSectionWrapper& observer_cs_;
|
||||
scoped_ptr<CriticalSectionWrapper> observer_cs_;
|
||||
ViECaptureObserver* observer_;
|
||||
|
||||
// Encoding using encoding capable cameras.
|
||||
CriticalSectionWrapper& encoding_critsect_;
|
||||
scoped_ptr<CriticalSectionWrapper> encoding_cs_;
|
||||
VideoCaptureModule::VideoCaptureEncodeInterface* capture_encoder_;
|
||||
EncodedImageCallback* encode_complete_callback_;
|
||||
VideoCodec codec_;
|
||||
|
@ -43,7 +43,7 @@ ViEChannel::ViEChannel(WebRtc_Word32 channel_id,
|
||||
engine_id_(engine_id),
|
||||
number_of_cores_(number_of_cores),
|
||||
num_socket_threads_(kViESocketThreads),
|
||||
callbackCritsect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
callback_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
rtp_rtcp_(*RtpRtcp::CreateRtpRtcp(ViEModuleId(engine_id, channel_id),
|
||||
false)),
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
@ -210,8 +210,6 @@ ViEChannel::~ViEChannel() {
|
||||
delete &vie_sender_;
|
||||
delete &vie_sync_;
|
||||
|
||||
delete &callbackCritsect_;
|
||||
|
||||
// Release modules.
|
||||
RtpRtcp::DestroyRtpRtcp(&rtp_rtcp_);
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
@ -434,7 +432,7 @@ WebRtc_Word32 ViEChannel::GetReceiveCodec(VideoCodec& video_codec) {
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::RegisterCodecObserver(ViEDecoderObserver* observer) {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (observer) {
|
||||
if (codec_observer_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
@ -722,7 +720,7 @@ WebRtc_Word32 ViEChannel::EnableKeyFrameRequestCallback(const bool enable) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: %d", __FUNCTION__, enable);
|
||||
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (enable && !codec_observer_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: No ViECodecObserver set", __FUNCTION__, enable);
|
||||
@ -828,7 +826,7 @@ WebRtc_Word32 ViEChannel::GetRemoteRTCPCName(WebRtc_Word8 rtcp_cname[]) {
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::RegisterRtpObserver(ViERTPObserver* observer) {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (observer) {
|
||||
if (rtp_observer_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
@ -852,7 +850,7 @@ WebRtc_Word32 ViEChannel::RegisterRtpObserver(ViERTPObserver* observer) {
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::RegisterRtcpObserver(ViERTCPObserver* observer) {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (observer) {
|
||||
if (rtcp_observer_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
@ -1148,14 +1146,14 @@ WebRtc_Word32 ViEChannel::SetLocalReceiver(const WebRtc_UWord16 rtp_port,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
callbackCritsect_.Enter();
|
||||
callback_cs_->Enter();
|
||||
if (external_transport_) {
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: external transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.Receiving()) {
|
||||
@ -1189,14 +1187,14 @@ WebRtc_Word32 ViEChannel::GetLocalReceiver(WebRtc_UWord16& rtp_port,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
callbackCritsect_.Enter();
|
||||
callback_cs_->Enter();
|
||||
if (external_transport_) {
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: external transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.ReceiveSocketsInitialized() == false) {
|
||||
@ -1232,14 +1230,14 @@ WebRtc_Word32 ViEChannel::SetSendDestination(
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
callbackCritsect_.Enter();
|
||||
callback_cs_->Enter();
|
||||
if (external_transport_) {
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: external transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
const bool is_ipv6 = socket_transport_.IpV6Enabled();
|
||||
@ -1351,14 +1349,14 @@ WebRtc_Word32 ViEChannel::GetSendDestination(
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
callbackCritsect_.Enter();
|
||||
callback_cs_->Enter();
|
||||
if (external_transport_) {
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: external transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.SendSocketsInitialized() == false) {
|
||||
@ -1388,7 +1386,7 @@ WebRtc_Word32 ViEChannel::GetSendDestination(
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::StartSend() {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s", __FUNCTION__);
|
||||
|
||||
@ -1471,7 +1469,7 @@ bool ViEChannel::Sending() {
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::StartReceive() {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
@ -1520,7 +1518,7 @@ WebRtc_Word32 ViEChannel::StopReceive() {
|
||||
StopDecodeThread();
|
||||
vcm_.ResetDecoder();
|
||||
{
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
return 0;
|
||||
}
|
||||
@ -1558,7 +1556,7 @@ WebRtc_Word32 ViEChannel::GetSourceInfo(WebRtc_UWord16& rtp_port,
|
||||
WebRtc_Word8* ip_address,
|
||||
WebRtc_UWord32 ip_address_length) {
|
||||
{
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
if (external_transport_) {
|
||||
@ -1612,7 +1610,7 @@ WebRtc_Word32 ViEChannel::RegisterSendTransport(Transport& transport) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: transport already registered", __FUNCTION__);
|
||||
@ -1628,7 +1626,7 @@ WebRtc_Word32 ViEChannel::RegisterSendTransport(Transport& transport) {
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::DeregisterSendTransport() {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
@ -1650,7 +1648,7 @@ WebRtc_Word32 ViEChannel::DeregisterSendTransport() {
|
||||
WebRtc_Word32 ViEChannel::ReceivedRTPPacket(
|
||||
const void* rtp_packet, const WebRtc_Word32 rtp_packet_length) {
|
||||
{
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (!external_transport_) {
|
||||
return -1;
|
||||
}
|
||||
@ -1661,7 +1659,7 @@ WebRtc_Word32 ViEChannel::ReceivedRTPPacket(
|
||||
WebRtc_Word32 ViEChannel::ReceivedRTCPPacket(
|
||||
const void* rtcp_packet, const WebRtc_Word32 rtcp_packet_length) {
|
||||
{
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (!external_transport_) {
|
||||
return -1;
|
||||
}
|
||||
@ -1670,18 +1668,18 @@ WebRtc_Word32 ViEChannel::ReceivedRTCPPacket(
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::EnableIPv6() {
|
||||
callbackCritsect_.Enter();
|
||||
callback_cs_->Enter();
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s", __FUNCTION__);
|
||||
|
||||
if (external_transport_) {
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.IpV6Enabled()) {
|
||||
@ -1709,7 +1707,7 @@ bool ViEChannel::IsIPv6Enabled() {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
@ -1728,17 +1726,17 @@ bool ViEChannel::IsIPv6Enabled() {
|
||||
WebRtc_Word32 ViEChannel::SetSourceFilter(const WebRtc_UWord16 rtp_port,
|
||||
const WebRtc_UWord16 rtcp_port,
|
||||
const WebRtc_Word8* ip_address) {
|
||||
callbackCritsect_.Enter();
|
||||
callback_cs_->Enter();
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
if (external_transport_) {
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.SetFilterIP(ip_address) != 0) {
|
||||
@ -1760,17 +1758,17 @@ WebRtc_Word32 ViEChannel::SetSourceFilter(const WebRtc_UWord16 rtp_port,
|
||||
WebRtc_Word32 ViEChannel::GetSourceFilter(WebRtc_UWord16& rtp_port,
|
||||
WebRtc_UWord16& rtcp_port,
|
||||
WebRtc_Word8* ip_address) const {
|
||||
callbackCritsect_.Enter();
|
||||
callback_cs_->Enter();
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
if (external_transport_) {
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.FilterIP(ip_address) != 0) {
|
||||
@ -1794,7 +1792,7 @@ WebRtc_Word32 ViEChannel::SetToS(const WebRtc_Word32 DSCP,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
@ -1821,7 +1819,7 @@ WebRtc_Word32 ViEChannel::GetToS(WebRtc_Word32& DSCP,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
@ -1850,7 +1848,7 @@ WebRtc_Word32 ViEChannel::SetSendGQoS(const bool enable,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
@ -1879,7 +1877,7 @@ WebRtc_Word32 ViEChannel::GetSendGQoS(bool& enabled,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
@ -1946,7 +1944,7 @@ WebRtc_Word32 ViEChannel::SetPacketTimeoutNotification(
|
||||
|
||||
WebRtc_Word32 ViEChannel::RegisterNetworkObserver(
|
||||
ViENetworkObserver* observer) {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (observer) {
|
||||
if (networkObserver_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
@ -1970,7 +1968,7 @@ WebRtc_Word32 ViEChannel::RegisterNetworkObserver(
|
||||
}
|
||||
|
||||
bool ViEChannel::NetworkObserverRegistered() {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
return networkObserver_ != NULL;
|
||||
}
|
||||
|
||||
@ -1979,7 +1977,7 @@ WebRtc_Word32 ViEChannel::SetPeriodicDeadOrAliveStatus(
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (!networkObserver_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: no observer added", __FUNCTION__);
|
||||
@ -2016,7 +2014,7 @@ WebRtc_Word32 ViEChannel::SendUDPPacket(const WebRtc_Word8* data,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
{
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_transport_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: External transport registered", __FUNCTION__);
|
||||
@ -2042,7 +2040,7 @@ WebRtc_Word32 ViEChannel::EnableColorEnhancement(bool enable) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s(enable: %d)", __FUNCTION__, enable);
|
||||
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (enable && color_enhancement_) {
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: Already enabled", __FUNCTION__);
|
||||
@ -2090,7 +2088,7 @@ RtpRtcp* ViEChannel::rtp_rtcp() {
|
||||
|
||||
|
||||
WebRtc_Word32 ViEChannel::FrameToRender(VideoFrame& video_frame) {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
|
||||
if (decoder_reset_) {
|
||||
// Trigger a callback to the user if the incoming codec has changed.
|
||||
@ -2146,7 +2144,7 @@ WebRtc_Word32 ViEChannel::StoreReceivedFrame(
|
||||
|
||||
WebRtc_Word32 ViEChannel::ReceiveStatistics(const WebRtc_UWord32 bit_rate,
|
||||
const WebRtc_UWord32 frame_rate) {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (codec_observer_) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: bitrate %u, framerate %u", __FUNCTION__, bit_rate,
|
||||
@ -2160,7 +2158,7 @@ WebRtc_Word32 ViEChannel::FrameTypeRequest(const FrameType frame_type) {
|
||||
WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s(frame_type: %d)", __FUNCTION__, frame_type);
|
||||
{
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (codec_observer_ && do_key_frame_callbackRequest_) {
|
||||
codec_observer_->RequestNewKeyFrame(channel_id_);
|
||||
}
|
||||
@ -2256,7 +2254,7 @@ WebRtc_Word32 ViEChannel::RegisterExternalEncryption(Encryption* encryption) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (external_encryption_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: external encryption already registered", __FUNCTION__);
|
||||
@ -2278,7 +2276,7 @@ WebRtc_Word32 ViEChannel::DeRegisterExternalEncryption() {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (!external_encryption_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: external encryption is not registered", __FUNCTION__);
|
||||
@ -2314,7 +2312,7 @@ WebRtc_Word32 ViEChannel::VoiceChannel() {
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEChannel::RegisterEffectFilter(ViEEffectFilter* effect_filter) {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (!effect_filter) {
|
||||
if (!effect_filter_) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
@ -2371,7 +2369,7 @@ void ViEChannel::OnApplicationDataReceived(const WebRtc_Word32 id,
|
||||
"%s, incorrect id", __FUNCTION__, id);
|
||||
return;
|
||||
}
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
{
|
||||
if (rtcp_observer_) {
|
||||
rtcp_observer_->OnApplicationDataReceived(
|
||||
@ -2393,9 +2391,9 @@ WebRtc_Word32 ViEChannel::OnInitializeDecoder(
|
||||
payload_type, payload_name);
|
||||
vcm_.ResetDecoder();
|
||||
|
||||
callbackCritsect_.Enter();
|
||||
callback_cs_->Enter();
|
||||
decoder_reset_ = true;
|
||||
callbackCritsect_.Leave();
|
||||
callback_cs_->Leave();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2404,7 +2402,7 @@ void ViEChannel::OnPacketTimeout(const WebRtc_Word32 id) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (networkObserver_) {
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (socket_transport_.Receiving() || external_transport_) {
|
||||
@ -2423,7 +2421,7 @@ void ViEChannel::OnReceivedPacket(const WebRtc_Word32 id,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
__FUNCTION__);
|
||||
if (rtp_packet_timeout_ && packet_type == kPacketRtp) {
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (networkObserver_) {
|
||||
networkObserver_->PacketTimeout(channel_id_, PacketReceived);
|
||||
}
|
||||
@ -2439,7 +2437,7 @@ void ViEChannel::OnPeriodicDeadOrAlive(const WebRtc_Word32 id,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s(id=%d, alive=%d)", __FUNCTION__, id, alive);
|
||||
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (!networkObserver_) {
|
||||
return;
|
||||
}
|
||||
@ -2463,7 +2461,7 @@ void ViEChannel::OnIncomingSSRCChanged(const WebRtc_Word32 id,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: %u", __FUNCTION__, SSRC);
|
||||
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
{
|
||||
if (rtp_observer_) {
|
||||
rtp_observer_->IncomingSSRCChanged(channel_id_, SSRC);
|
||||
@ -2487,7 +2485,7 @@ void ViEChannel::OnIncomingCSRCChanged(const WebRtc_Word32 id,
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||
"%s: %u", __FUNCTION__, CSRC);
|
||||
|
||||
CriticalSectionScoped cs(callbackCritsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
{
|
||||
if (rtp_observer_) {
|
||||
rtp_observer_->IncomingCSRCChanged(channel_id_, CSRC, added);
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||
#include "modules/udp_transport/interface/udp_transport.h"
|
||||
#include "modules/video_coding/main/interface/video_coding_defines.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "system_wrappers/interface/tick_util.h"
|
||||
#include "typedefs.h"
|
||||
#include "video_engine/include/vie_network.h"
|
||||
@ -356,7 +357,7 @@ class ViEChannel
|
||||
WebRtc_UWord8 num_socket_threads_;
|
||||
|
||||
// Used for all registered callbacks except rendering.
|
||||
CriticalSectionWrapper& callbackCritsect_;
|
||||
scoped_ptr<CriticalSectionWrapper> callback_cs_;
|
||||
|
||||
// Owned modules/classes.
|
||||
RtpRtcp& rtp_rtcp_;
|
||||
|
@ -61,8 +61,8 @@ ViEEncoder::ViEEncoder(WebRtc_Word32 engine_id, WebRtc_Word32 channel_id,
|
||||
channel_id))),
|
||||
default_rtp_rtcp_(*RtpRtcp::CreateRtpRtcp(
|
||||
ViEModuleId(engine_id, channel_id), false)),
|
||||
callback_critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
data_critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
callback_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
data_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
paused_(false),
|
||||
channels_dropping_delta_frames_(0),
|
||||
drop_next_frame_(false),
|
||||
@ -155,8 +155,6 @@ ViEEncoder::~ViEEncoder() {
|
||||
delete &vcm_;
|
||||
delete &vpm_;
|
||||
delete &default_rtp_rtcp_;
|
||||
delete &callback_critsect_;
|
||||
delete &data_critsect_;
|
||||
delete qm_callback_;
|
||||
}
|
||||
|
||||
@ -164,7 +162,7 @@ void ViEEncoder::Pause() {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo,
|
||||
ViEId(engine_id_, channel_id_),
|
||||
"%s", __FUNCTION__);
|
||||
CriticalSectionScoped cs(data_critsect_);
|
||||
CriticalSectionScoped cs(data_cs_.get());
|
||||
paused_ = true;
|
||||
}
|
||||
|
||||
@ -172,7 +170,7 @@ void ViEEncoder::Restart() {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo,
|
||||
ViEId(engine_id_, channel_id_),
|
||||
"%s", __FUNCTION__);
|
||||
CriticalSectionScoped cs(data_critsect_);
|
||||
CriticalSectionScoped cs(data_cs_.get());
|
||||
paused_ = false;
|
||||
}
|
||||
|
||||
@ -180,7 +178,7 @@ WebRtc_Word32 ViEEncoder::DropDeltaAfterKey(bool enable) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo,
|
||||
ViEId(engine_id_, channel_id_),
|
||||
"%s(%d)", __FUNCTION__, enable);
|
||||
CriticalSectionScoped cs(data_critsect_);
|
||||
CriticalSectionScoped cs(data_cs_.get());
|
||||
|
||||
if (enable) {
|
||||
channels_dropping_delta_frames_++;
|
||||
@ -308,9 +306,9 @@ WebRtc_Word32 ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
data_critsect_.Enter();
|
||||
data_cs_->Enter();
|
||||
memcpy(&send_codec_, &video_codec, sizeof(send_codec_));
|
||||
data_critsect_.Leave();
|
||||
data_cs_->Leave();
|
||||
|
||||
// Set this module as sending right away, let the slave module in the channel
|
||||
// start and stop sending.
|
||||
@ -390,7 +388,7 @@ void ViEEncoder::DeliverFrame(int id, webrtc::VideoFrame& video_frame,
|
||||
video_frame.TimeStamp());
|
||||
|
||||
{
|
||||
CriticalSectionScoped cs(data_critsect_);
|
||||
CriticalSectionScoped cs(data_cs_.get());
|
||||
if (paused_ || default_rtp_rtcp_.SendingMedia() == false) {
|
||||
// We've paused or we have no channels attached, don't encode.
|
||||
return;
|
||||
@ -411,7 +409,7 @@ void ViEEncoder::DeliverFrame(int id, webrtc::VideoFrame& video_frame,
|
||||
90 * static_cast<WebRtc_UWord32>(video_frame.RenderTimeMs());
|
||||
video_frame.SetTimeStamp(time_stamp);
|
||||
{
|
||||
CriticalSectionScoped cs(callback_critsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (effect_filter_) {
|
||||
effect_filter_->Transform(video_frame.Length(), video_frame.Buffer(),
|
||||
video_frame.TimeStamp(),
|
||||
@ -628,7 +626,7 @@ WebRtc_Word32 ViEEncoder::SendData(
|
||||
const webrtc::RTPFragmentationHeader& fragmentation_header,
|
||||
const RTPVideoHeader* rtp_video_hdr) {
|
||||
{
|
||||
CriticalSectionScoped cs(data_critsect_);
|
||||
CriticalSectionScoped cs(data_cs_.get());
|
||||
if (paused_) {
|
||||
// Paused, don't send this packet.
|
||||
return 0;
|
||||
@ -685,7 +683,7 @@ WebRtc_Word32 ViEEncoder::ProtectionRequest(
|
||||
|
||||
WebRtc_Word32 ViEEncoder::SendStatistics(const WebRtc_UWord32 bit_rate,
|
||||
const WebRtc_UWord32 frame_rate) {
|
||||
CriticalSectionScoped cs(callback_critsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (codec_observer_) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo,
|
||||
ViEId(engine_id_, channel_id_), "%s: bitrate %u, framerate %u",
|
||||
@ -696,7 +694,7 @@ WebRtc_Word32 ViEEncoder::SendStatistics(const WebRtc_UWord32 bit_rate,
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEEncoder::RegisterCodecObserver(ViEEncoderObserver* observer) {
|
||||
CriticalSectionScoped cs(callback_critsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (observer) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo,
|
||||
ViEId(engine_id_, channel_id_), "%s: observer added",
|
||||
@ -770,7 +768,7 @@ void ViEEncoder::OnNetworkChanged(const WebRtc_Word32 id,
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViEEncoder::RegisterEffectFilter(ViEEffectFilter* effect_filter) {
|
||||
CriticalSectionScoped cs(callback_critsect_);
|
||||
CriticalSectionScoped cs(callback_cs_.get());
|
||||
if (effect_filter == NULL) {
|
||||
if (effect_filter_ == NULL) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "vie_defines.h"
|
||||
#include "vie_file_recorder.h"
|
||||
#include "vie_frame_provider_base.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -146,8 +147,8 @@ class ViEEncoder
|
||||
VideoCodingModule& vcm_;
|
||||
VideoProcessingModule& vpm_;
|
||||
RtpRtcp& default_rtp_rtcp_;
|
||||
CriticalSectionWrapper& callback_critsect_;
|
||||
CriticalSectionWrapper& data_critsect_;
|
||||
scoped_ptr<CriticalSectionWrapper> callback_cs_;
|
||||
scoped_ptr<CriticalSectionWrapper> data_cs_;
|
||||
VideoCodec send_codec_;
|
||||
|
||||
bool paused_;
|
||||
|
@ -948,15 +948,12 @@ VideoFrame& video_frame) {
|
||||
}
|
||||
|
||||
ViECaptureSnapshot::ViECaptureSnapshot()
|
||||
: crit_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
: crit_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
condition_varaible_(*ConditionVariableWrapper::CreateConditionVariable()),
|
||||
video_frame_(NULL) {
|
||||
}
|
||||
|
||||
ViECaptureSnapshot::~ViECaptureSnapshot() {
|
||||
crit_.Enter();
|
||||
crit_.Leave();
|
||||
delete &crit_;
|
||||
if (video_frame_) {
|
||||
delete video_frame_;
|
||||
video_frame_ = NULL;
|
||||
@ -964,24 +961,25 @@ ViECaptureSnapshot::~ViECaptureSnapshot() {
|
||||
}
|
||||
|
||||
bool ViECaptureSnapshot::GetSnapshot(VideoFrame& video_frame,
|
||||
unsigned int max_wait_time) {
|
||||
crit_.Enter();
|
||||
unsigned int max_wait_time) {
|
||||
crit_->Enter();
|
||||
video_frame_ = new VideoFrame();
|
||||
if (condition_varaible_.SleepCS(crit_, max_wait_time)) {
|
||||
// Snapshot taken
|
||||
if (condition_varaible_.SleepCS(*(crit_.get()), max_wait_time)) {
|
||||
// Snapshot taken.
|
||||
video_frame.SwapFrame(*video_frame_);
|
||||
delete video_frame_;
|
||||
video_frame_ = NULL;
|
||||
crit_.Leave();
|
||||
crit_->Leave();
|
||||
return true;
|
||||
}
|
||||
crit_->Leave();
|
||||
return false;
|
||||
}
|
||||
|
||||
void ViECaptureSnapshot::DeliverFrame(int id, VideoFrame& video_frame,
|
||||
int num_csrcs,
|
||||
const WebRtc_UWord32 CSRC[kRtpCsrcSize]) {
|
||||
CriticalSectionScoped cs(crit_);
|
||||
CriticalSectionScoped cs(crit_.get());
|
||||
if (!video_frame_) {
|
||||
return;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#ifndef WEBRTC_VIDEO_ENGINE_VIE_FILE_IMPL_H_
|
||||
#define WEBRTC_VIDEO_ENGINE_VIE_FILE_IMPL_H_
|
||||
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "typedefs.h"
|
||||
#include "video_engine/include/vie_file.h"
|
||||
#include "video_engine/vie_defines.h"
|
||||
@ -21,6 +22,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
class ConditionVariableWrapper;
|
||||
class CriticalSectionWrapper;
|
||||
|
||||
class ViECaptureSnapshot : public ViEFrameCallback {
|
||||
public:
|
||||
@ -40,7 +42,7 @@ class ViECaptureSnapshot : public ViEFrameCallback {
|
||||
virtual void ProviderDestroyed(int id) {}
|
||||
|
||||
private:
|
||||
CriticalSectionWrapper& crit_;
|
||||
scoped_ptr<CriticalSectionWrapper> crit_;
|
||||
ConditionVariableWrapper& condition_varaible_;
|
||||
VideoFrame* video_frame_;
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ ViEFrameProviderBase::ViEFrameProviderBase(int Id, int engine_id)
|
||||
: id_(Id),
|
||||
engine_id_(engine_id),
|
||||
frame_callbacks_(),
|
||||
provider_crit_sect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
provider_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
extra_frame_(NULL),
|
||||
frame_delay_(0) {
|
||||
}
|
||||
@ -40,7 +40,6 @@ ViEFrameProviderBase::~ViEFrameProviderBase() {
|
||||
while (frame_callbacks_.Erase(frame_callbacks_.First()) == 0) {
|
||||
}
|
||||
|
||||
delete &provider_crit_sect_;
|
||||
delete extra_frame_;
|
||||
}
|
||||
|
||||
@ -55,7 +54,7 @@ void ViEFrameProviderBase::DeliverFrame(
|
||||
#ifdef DEBUG_
|
||||
const TickTime start_process_time = TickTime::Now();
|
||||
#endif
|
||||
CriticalSectionScoped cs(provider_crit_sect_);
|
||||
CriticalSectionScoped cs(provider_cs_.get());
|
||||
|
||||
// Deliver the frame to all registered callbacks.
|
||||
if (frame_callbacks_.Size() > 0) {
|
||||
@ -96,7 +95,7 @@ void ViEFrameProviderBase::DeliverFrame(
|
||||
}
|
||||
|
||||
void ViEFrameProviderBase::SetFrameDelay(int frame_delay) {
|
||||
CriticalSectionScoped cs(provider_crit_sect_);
|
||||
CriticalSectionScoped cs(provider_cs_.get());
|
||||
frame_delay_ = frame_delay;
|
||||
|
||||
for (MapItem* map_item = frame_callbacks_.First(); map_item != NULL;
|
||||
@ -119,7 +118,7 @@ int ViEFrameProviderBase::GetBestFormat(int& best_width,
|
||||
int largest_height = 0;
|
||||
int highest_frame_rate = 0;
|
||||
|
||||
CriticalSectionScoped cs(provider_crit_sect_);
|
||||
CriticalSectionScoped cs(provider_cs_.get());
|
||||
|
||||
// Check if this one already exists.
|
||||
for (MapItem* map_item = frame_callbacks_.First(); map_item != NULL;
|
||||
@ -164,7 +163,7 @@ int ViEFrameProviderBase::RegisterFrameCallback(
|
||||
__FUNCTION__, callback_object);
|
||||
|
||||
{
|
||||
CriticalSectionScoped cs(provider_crit_sect_);
|
||||
CriticalSectionScoped cs(provider_cs_.get());
|
||||
|
||||
// Check if the callback already exists.
|
||||
for (MapItem* map_item = frame_callbacks_.First();
|
||||
@ -208,7 +207,7 @@ int ViEFrameProviderBase::DeregisterFrameCallback(
|
||||
__FUNCTION__, callback_object);
|
||||
|
||||
{
|
||||
CriticalSectionScoped cs(provider_crit_sect_);
|
||||
CriticalSectionScoped cs(provider_cs_.get());
|
||||
bool item_found = false;
|
||||
|
||||
// Try to find the callback in our list.
|
||||
@ -261,7 +260,7 @@ bool ViEFrameProviderBase::IsFrameCallbackRegistered(
|
||||
}
|
||||
|
||||
int ViEFrameProviderBase::NumberOfRegisteredFrameCallbacks() {
|
||||
CriticalSectionScoped cs(provider_crit_sect_);
|
||||
CriticalSectionScoped cs(provider_cs_.get());
|
||||
return frame_callbacks_.Size();
|
||||
}
|
||||
} // namespac webrtc
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "modules/interface/module_common_types.h"
|
||||
#include "system_wrappers/interface/map_wrapper.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -86,7 +87,7 @@ class ViEFrameProviderBase {
|
||||
|
||||
// Frame callbacks.
|
||||
MapWrapper frame_callbacks_;
|
||||
CriticalSectionWrapper& provider_crit_sect_;
|
||||
scoped_ptr<CriticalSectionWrapper> provider_cs_;
|
||||
|
||||
private:
|
||||
VideoFrame* extra_frame_;
|
||||
|
@ -28,7 +28,7 @@ namespace webrtc {
|
||||
|
||||
ViEInputManager::ViEInputManager(const int engine_id)
|
||||
: engine_id_(engine_id),
|
||||
map_cs_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
map_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
vie_frame_provider_map_(),
|
||||
capture_device_info_(NULL),
|
||||
module_process_thread_(NULL) {
|
||||
@ -57,7 +57,6 @@ ViEInputManager::~ViEInputManager() {
|
||||
delete frame_provider;
|
||||
}
|
||||
|
||||
delete &map_cs_;
|
||||
if (capture_device_info_) {
|
||||
delete capture_device_info_;
|
||||
capture_device_info_ = NULL;
|
||||
@ -171,7 +170,7 @@ int ViEInputManager::CreateCaptureDevice(
|
||||
int& capture_id) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s(device_unique_id: %s)", __FUNCTION__, device_unique_idUTF8);
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
|
||||
// Make sure the device is not already allocated.
|
||||
for (MapItem* item = vie_frame_provider_map_.First(); item != NULL;
|
||||
@ -263,7 +262,7 @@ int ViEInputManager::CreateCaptureDevice(VideoCaptureModule& capture_module,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
int newcapture_id = 0;
|
||||
if (!GetFreeCaptureId(newcapture_id)) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
@ -300,7 +299,7 @@ int ViEInputManager::DestroyCaptureDevice(const int capture_id) {
|
||||
// We need exclusive access to the object to delete it.
|
||||
// Take this write lock first since the read lock is taken before map_cs_.
|
||||
ViEManagerWriteScoped wl(*this);
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
|
||||
vie_capture = ViECapturePtr(capture_id);
|
||||
if (!vie_capture) {
|
||||
@ -332,7 +331,7 @@ int ViEInputManager::CreateExternalCaptureDevice(
|
||||
int& capture_id) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
|
||||
__FUNCTION__);
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
|
||||
int newcapture_id = 0;
|
||||
if (GetFreeCaptureId(newcapture_id) == false) {
|
||||
@ -373,7 +372,7 @@ int ViEInputManager::CreateFilePlayer(const WebRtc_Word8* file_nameUTF8,
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s(device_unique_id: %s)", __FUNCTION__, file_nameUTF8);
|
||||
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
int new_file_id = 0;
|
||||
if (GetFreeFileId(new_file_id) == false) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
@ -419,7 +418,7 @@ int ViEInputManager::DestroyFilePlayer(int file_id) {
|
||||
// Take this write lock first since the read lock is taken before map_cs_.
|
||||
ViEManagerWriteScoped wl(*this);
|
||||
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
vie_file_player = ViEFilePlayerPtr(file_id);
|
||||
if (!vie_file_player) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
@ -463,7 +462,7 @@ bool ViEInputManager::GetFreeCaptureId(int& freecapture_id) {
|
||||
void ViEInputManager::ReturnCaptureId(int capture_id) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s(%d)", __FUNCTION__, capture_id);
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
if (capture_id >= kViECaptureIdBase &&
|
||||
capture_id < kViEMaxCaptureDevices + kViECaptureIdBase) {
|
||||
free_capture_device_id_[capture_id - kViECaptureIdBase] = true;
|
||||
@ -492,7 +491,7 @@ void ViEInputManager::ReturnFileId(int file_id) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s(%d)", __FUNCTION__, file_id);
|
||||
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
if (file_id >= kViEFileIdBase &&
|
||||
file_id < kViEMaxFilePlayers + kViEFileIdBase) {
|
||||
free_file_id_[file_id - kViEFileIdBase] = true;
|
||||
@ -503,7 +502,7 @@ void ViEInputManager::ReturnFileId(int file_id) {
|
||||
ViEFrameProviderBase* ViEInputManager::ViEFrameProvider(
|
||||
const ViEFrameCallback* capture_observer) const {
|
||||
assert(capture_observer);
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
|
||||
for (MapItem* provider_item = vie_frame_provider_map_.First(); provider_item
|
||||
!= NULL; provider_item = vie_frame_provider_map_.Next(provider_item)) {
|
||||
@ -521,7 +520,7 @@ ViEFrameProviderBase* ViEInputManager::ViEFrameProvider(
|
||||
}
|
||||
|
||||
ViEFrameProviderBase* ViEInputManager::ViEFrameProvider(int provider_id) const {
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
MapItem* map_item = vie_frame_provider_map_.Find(provider_id);
|
||||
if (!map_item) {
|
||||
return NULL;
|
||||
@ -536,7 +535,7 @@ ViECapturer* ViEInputManager::ViECapturePtr(int capture_id) const {
|
||||
capture_id <= kViECaptureIdBase + kViEMaxCaptureDevices))
|
||||
return NULL;
|
||||
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
MapItem* map_item = vie_frame_provider_map_.Find(capture_id);
|
||||
if (!map_item) {
|
||||
return NULL;
|
||||
@ -546,7 +545,7 @@ ViECapturer* ViEInputManager::ViECapturePtr(int capture_id) const {
|
||||
}
|
||||
|
||||
void ViEInputManager::GetViECaptures(MapWrapper& vie_capture_map) {
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
|
||||
if (vie_frame_provider_map_.Size() == 0) {
|
||||
return;
|
||||
@ -563,7 +562,7 @@ ViEFilePlayer* ViEInputManager::ViEFilePlayerPtr(int file_id) const {
|
||||
if (file_id < kViEFileIdBase || file_id > kViEFileIdMax) {
|
||||
return NULL;
|
||||
}
|
||||
CriticalSectionScoped cs(map_cs_);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
MapItem* map_item = vie_frame_provider_map_.Find(file_id);
|
||||
if (!map_item) {
|
||||
return NULL;
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "modules/video_capture/main/interface/video_capture.h"
|
||||
#include "system_wrappers/interface/map_wrapper.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "typedefs.h"
|
||||
#include "video_engine/include/vie_capture.h"
|
||||
#include "video_engine/vie_defines.h"
|
||||
@ -112,7 +113,7 @@ class ViEInputManager : private ViEManagerBase {
|
||||
ViEFilePlayer* ViEFilePlayerPtr(int file_id) const;
|
||||
|
||||
int engine_id_;
|
||||
CriticalSectionWrapper& map_cs_;
|
||||
scoped_ptr<CriticalSectionWrapper> map_cs_;
|
||||
MapWrapper vie_frame_provider_map_;
|
||||
|
||||
// Capture devices.
|
||||
|
@ -26,7 +26,7 @@ enum { kVieCpuStartValue = 75 };
|
||||
|
||||
ViEPerformanceMonitor::ViEPerformanceMonitor(int engine_id)
|
||||
: engine_id_(engine_id),
|
||||
pointer_critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
pointer_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
monitor_thread_(NULL),
|
||||
monitor_event_(*EventWrapper::Create()),
|
||||
average_application_cpu_(kVieCpuStartValue),
|
||||
@ -37,7 +37,7 @@ ViEPerformanceMonitor::ViEPerformanceMonitor(int engine_id)
|
||||
|
||||
ViEPerformanceMonitor::~ViEPerformanceMonitor() {
|
||||
Terminate();
|
||||
delete &pointer_critsect_;
|
||||
delete pointer_cs_;
|
||||
delete &monitor_event_;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ int ViEPerformanceMonitor::Init(ViEBaseObserver* vie_base_observer) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s", __FUNCTION__);
|
||||
|
||||
CriticalSectionScoped cs(pointer_critsect_);
|
||||
CriticalSectionScoped cs(pointer_cs_);
|
||||
if (!vie_base_observer || vie_base_observer_) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s: Bad input argument or observer already set",
|
||||
@ -86,9 +86,9 @@ void ViEPerformanceMonitor::Terminate() {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s", __FUNCTION__);
|
||||
|
||||
pointer_critsect_.Enter();
|
||||
pointer_cs_->Enter();
|
||||
if (!vie_base_observer_) {
|
||||
pointer_critsect_.Leave();
|
||||
pointer_cs_->Leave();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -98,20 +98,20 @@ void ViEPerformanceMonitor::Terminate() {
|
||||
ThreadWrapper* tmp_thread = monitor_thread_;
|
||||
monitor_thread_ = NULL;
|
||||
monitor_event_.Set();
|
||||
pointer_critsect_.Leave();
|
||||
pointer_cs_->Leave();
|
||||
if (tmp_thread->Stop()) {
|
||||
pointer_critsect_.Enter();
|
||||
pointer_cs_->Enter();
|
||||
delete tmp_thread;
|
||||
tmp_thread = NULL;
|
||||
delete cpu_;
|
||||
}
|
||||
cpu_ = NULL;
|
||||
}
|
||||
pointer_critsect_.Leave();
|
||||
pointer_cs_->Leave();
|
||||
}
|
||||
|
||||
bool ViEPerformanceMonitor::ViEBaseObserverRegistered() {
|
||||
CriticalSectionScoped cs(pointer_critsect_);
|
||||
CriticalSectionScoped cs(pointer_cs_);
|
||||
return vie_base_observer_ != NULL;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ bool ViEPerformanceMonitor::ViEMonitorProcess() {
|
||||
return false;
|
||||
}
|
||||
|
||||
CriticalSectionScoped cs(pointer_critsect_);
|
||||
CriticalSectionScoped cs(pointer_cs_);
|
||||
if (cpu_) {
|
||||
int cpu_load = cpu_->CpuUsage();
|
||||
if (cpu_load > 75) {
|
||||
|
@ -14,6 +14,7 @@
|
||||
#ifndef WEBRTC_VIDEO_ENGINE_VIE_PERFORMANCE_MONITOR_H_
|
||||
#define WEBRTC_VIDEO_ENGINE_VIE_PERFORMANCE_MONITOR_H_
|
||||
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "typedefs.h"
|
||||
#include "vie_defines.h"
|
||||
|
||||
@ -40,7 +41,8 @@ class ViEPerformanceMonitor {
|
||||
|
||||
private:
|
||||
const int engine_id_;
|
||||
CriticalSectionWrapper& pointer_critsect_;
|
||||
// TODO(mfldoman) Make this one scoped_ptr.
|
||||
CriticalSectionWrapper* pointer_cs_;
|
||||
ThreadWrapper* monitor_thread_;
|
||||
EventWrapper& monitor_event_;
|
||||
int average_application_cpu_;
|
||||
|
@ -21,7 +21,7 @@ namespace webrtc {
|
||||
ViEReceiver::ViEReceiver(int engine_id, int channel_id,
|
||||
RtpRtcp& rtp_rtcp,
|
||||
VideoCodingModule& module_vcm)
|
||||
: receive_critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
: receive_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
engine_id_(engine_id),
|
||||
channel_id_(channel_id),
|
||||
rtp_rtcp_(rtp_rtcp),
|
||||
@ -33,8 +33,6 @@ ViEReceiver::ViEReceiver(int engine_id, int channel_id,
|
||||
}
|
||||
|
||||
ViEReceiver::~ViEReceiver() {
|
||||
delete &receive_critsect_;
|
||||
|
||||
if (decryption_buffer_) {
|
||||
delete[] decryption_buffer_;
|
||||
decryption_buffer_ = NULL;
|
||||
@ -47,7 +45,7 @@ ViEReceiver::~ViEReceiver() {
|
||||
}
|
||||
|
||||
int ViEReceiver::RegisterExternalDecryption(Encryption* decryption) {
|
||||
CriticalSectionScoped cs(receive_critsect_);
|
||||
CriticalSectionScoped cs(receive_cs_.get());
|
||||
if (external_decryption_) {
|
||||
return -1;
|
||||
}
|
||||
@ -60,7 +58,7 @@ int ViEReceiver::RegisterExternalDecryption(Encryption* decryption) {
|
||||
}
|
||||
|
||||
int ViEReceiver::DeregisterExternalDecryption() {
|
||||
CriticalSectionScoped cs(receive_critsect_);
|
||||
CriticalSectionScoped cs(receive_cs_.get());
|
||||
if (external_decryption_ == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -70,7 +68,7 @@ int ViEReceiver::DeregisterExternalDecryption() {
|
||||
|
||||
void ViEReceiver::RegisterSimulcastRtpRtcpModules(
|
||||
const std::list<RtpRtcp*>& rtp_modules) {
|
||||
CriticalSectionScoped cs(receive_critsect_);
|
||||
CriticalSectionScoped cs(receive_cs_.get());
|
||||
rtp_rtcp_simulcast_.clear();
|
||||
|
||||
if (!rtp_modules.empty()) {
|
||||
@ -133,7 +131,7 @@ int ViEReceiver::InsertRTPPacket(const WebRtc_Word8* rtp_packet,
|
||||
int received_packet_length = rtp_packet_length;
|
||||
|
||||
{
|
||||
CriticalSectionScoped cs(receive_critsect_);
|
||||
CriticalSectionScoped cs(receive_cs_.get());
|
||||
|
||||
if (external_decryption_) {
|
||||
int decrypted_length = 0;
|
||||
@ -171,7 +169,7 @@ int ViEReceiver::InsertRTCPPacket(const WebRtc_Word8* rtcp_packet,
|
||||
unsigned char* received_packet = reinterpret_cast<unsigned char*>(tmp_ptr);
|
||||
int received_packet_length = rtcp_packet_length;
|
||||
{
|
||||
CriticalSectionScoped cs(receive_critsect_);
|
||||
CriticalSectionScoped cs(receive_cs_.get());
|
||||
|
||||
if (external_decryption_) {
|
||||
int decrypted_length = 0;
|
||||
@ -202,7 +200,7 @@ int ViEReceiver::InsertRTCPPacket(const WebRtc_Word8* rtcp_packet,
|
||||
}
|
||||
}
|
||||
{
|
||||
CriticalSectionScoped cs(receive_critsect_);
|
||||
CriticalSectionScoped cs(receive_cs_.get());
|
||||
std::list<RtpRtcp*>::iterator it = rtp_rtcp_simulcast_.begin();
|
||||
while (it != rtp_rtcp_simulcast_.end()) {
|
||||
RtpRtcp* rtp_rtcp = *it++;
|
||||
@ -221,7 +219,7 @@ void ViEReceiver::StopReceive() {
|
||||
}
|
||||
|
||||
int ViEReceiver::StartRTPDump(const char file_nameUTF8[1024]) {
|
||||
CriticalSectionScoped cs(receive_critsect_);
|
||||
CriticalSectionScoped cs(receive_cs_.get());
|
||||
if (rtp_dump_) {
|
||||
// Restart it if it already exists and is started
|
||||
rtp_dump_->Stop();
|
||||
@ -246,7 +244,7 @@ int ViEReceiver::StartRTPDump(const char file_nameUTF8[1024]) {
|
||||
}
|
||||
|
||||
int ViEReceiver::StopRTPDump() {
|
||||
CriticalSectionScoped cs(receive_critsect_);
|
||||
CriticalSectionScoped cs(receive_cs_.get());
|
||||
if (rtp_dump_) {
|
||||
if (rtp_dump_->IsActive()) {
|
||||
rtp_dump_->Stop();
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "engine_configurations.h"
|
||||
#include "rtp_rtcp_defines.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "typedefs.h"
|
||||
#include "udp_transport.h"
|
||||
#include "vie_defines.h"
|
||||
@ -68,7 +69,7 @@ class ViEReceiver : public UdpTransportData, public RtpData {
|
||||
int InsertRTPPacket(const WebRtc_Word8* rtp_packet, int rtp_packet_length);
|
||||
int InsertRTCPPacket(const WebRtc_Word8* rtcp_packet, int rtcp_packet_length);
|
||||
|
||||
CriticalSectionWrapper& receive_critsect_;
|
||||
scoped_ptr<CriticalSectionWrapper> receive_cs_;
|
||||
int engine_id_;
|
||||
int channel_id_;
|
||||
RtpRtcp& rtp_rtcp_;
|
||||
|
@ -16,27 +16,26 @@ namespace webrtc {
|
||||
|
||||
ViERefCount::ViERefCount()
|
||||
: count_(0),
|
||||
crit_(*webrtc::CriticalSectionWrapper::CreateCriticalSection()) {
|
||||
crit_(CriticalSectionWrapper::CreateCriticalSection()) {
|
||||
}
|
||||
|
||||
ViERefCount::~ViERefCount() {
|
||||
delete &crit_;
|
||||
}
|
||||
|
||||
ViERefCount& ViERefCount::operator++(int) {
|
||||
CriticalSectionScoped lock(crit_);
|
||||
CriticalSectionScoped lock(crit_.get());
|
||||
count_++;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ViERefCount& ViERefCount::operator--(int) {
|
||||
CriticalSectionScoped lock(crit_);
|
||||
CriticalSectionScoped lock(crit_.get());
|
||||
count_--;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ViERefCount::Reset() {
|
||||
CriticalSectionScoped lock(crit_);
|
||||
CriticalSectionScoped lock(crit_.get());
|
||||
count_ = 0;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
#ifndef WEBRTC_VIDEO_ENGINE_VIE_REF_COUNT_H_
|
||||
#define WEBRTC_VIDEO_ENGINE_VIE_REF_COUNT_H_
|
||||
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class CriticalSectionWrapper;
|
||||
@ -30,7 +32,7 @@ class ViERefCount {
|
||||
|
||||
private:
|
||||
volatile int count_;
|
||||
webrtc::CriticalSectionWrapper& crit_;
|
||||
scoped_ptr<CriticalSectionWrapper> crit_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -32,7 +32,7 @@ ViERenderer* ViERenderManagerScoped::Renderer(WebRtc_Word32 render_id) const {
|
||||
}
|
||||
|
||||
ViERenderManager::ViERenderManager(WebRtc_Word32 engine_id)
|
||||
: list_critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
: list_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
engine_id_(engine_id),
|
||||
use_external_render_module_(false) {
|
||||
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, ViEId(engine_id),
|
||||
@ -52,7 +52,6 @@ ViERenderManager::~ViERenderManager() {
|
||||
item = NULL;
|
||||
RemoveRenderStream(render_id);
|
||||
}
|
||||
delete &list_critsect_;
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViERenderManager::RegisterVideoRenderModule(
|
||||
@ -112,7 +111,7 @@ ViERenderer* ViERenderManager::AddRenderStream(const WebRtc_Word32 render_id,
|
||||
const float top,
|
||||
const float right,
|
||||
const float bottom) {
|
||||
CriticalSectionScoped cs(list_critsect_);
|
||||
CriticalSectionScoped cs(list_cs_.get());
|
||||
|
||||
if (stream_to_vie_renderer_.Find(render_id) != NULL) {
|
||||
// This stream is already added to a renderer, not allowed!
|
||||
@ -157,7 +156,7 @@ WebRtc_Word32 ViERenderManager::RemoveRenderStream(
|
||||
// stream.
|
||||
ViEManagerWriteScoped(*this);
|
||||
|
||||
CriticalSectionScoped cs(list_critsect_);
|
||||
CriticalSectionScoped cs(list_cs_.get());
|
||||
MapItem* map_item = stream_to_vie_renderer_.Find(render_id);
|
||||
if (!map_item) {
|
||||
// No such stream
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "system_wrappers/interface/list_wrapper.h"
|
||||
#include "system_wrappers/interface/map_wrapper.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "typedefs.h"
|
||||
#include "video_engine/vie_manager_base.h"
|
||||
|
||||
@ -51,7 +52,7 @@ class ViERenderManager : private ViEManagerBase {
|
||||
// Methods used by ViERenderScoped.
|
||||
ViERenderer* ViERenderPtr(WebRtc_Word32 render_id) const;
|
||||
|
||||
CriticalSectionWrapper& list_critsect_;
|
||||
scoped_ptr<CriticalSectionWrapper> list_cs_;
|
||||
WebRtc_Word32 engine_id_;
|
||||
MapWrapper stream_to_vie_renderer_; // Protected by ViEManagerBase.
|
||||
ListWrapper render_list_;
|
||||
|
@ -20,7 +20,7 @@ namespace webrtc {
|
||||
ViESender::ViESender(int engine_id, int channel_id)
|
||||
: engine_id_(engine_id),
|
||||
channel_id_(channel_id),
|
||||
critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
critsect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
external_encryption_(NULL),
|
||||
encryption_buffer_(NULL),
|
||||
transport_(NULL),
|
||||
@ -28,8 +28,6 @@ ViESender::ViESender(int engine_id, int channel_id)
|
||||
}
|
||||
|
||||
ViESender::~ViESender() {
|
||||
delete &critsect_;
|
||||
|
||||
if (encryption_buffer_) {
|
||||
delete[] encryption_buffer_;
|
||||
encryption_buffer_ = NULL;
|
||||
@ -43,7 +41,7 @@ ViESender::~ViESender() {
|
||||
}
|
||||
|
||||
int ViESender::RegisterExternalEncryption(Encryption* encryption) {
|
||||
CriticalSectionScoped cs(critsect_);
|
||||
CriticalSectionScoped cs(critsect_.get());
|
||||
if (external_encryption_) {
|
||||
return -1;
|
||||
}
|
||||
@ -56,7 +54,7 @@ int ViESender::RegisterExternalEncryption(Encryption* encryption) {
|
||||
}
|
||||
|
||||
int ViESender::DeregisterExternalEncryption() {
|
||||
CriticalSectionScoped cs(critsect_);
|
||||
CriticalSectionScoped cs(critsect_.get());
|
||||
if (external_encryption_ == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -69,7 +67,7 @@ int ViESender::DeregisterExternalEncryption() {
|
||||
}
|
||||
|
||||
int ViESender::RegisterSendTransport(Transport* transport) {
|
||||
CriticalSectionScoped cs(critsect_);
|
||||
CriticalSectionScoped cs(critsect_.get());
|
||||
if (transport_) {
|
||||
return -1;
|
||||
}
|
||||
@ -78,7 +76,7 @@ int ViESender::RegisterSendTransport(Transport* transport) {
|
||||
}
|
||||
|
||||
int ViESender::DeregisterSendTransport() {
|
||||
CriticalSectionScoped cs(critsect_);
|
||||
CriticalSectionScoped cs(critsect_.get());
|
||||
if (transport_ == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -87,7 +85,7 @@ int ViESender::DeregisterSendTransport() {
|
||||
}
|
||||
|
||||
int ViESender::StartRTPDump(const char file_nameUTF8[1024]) {
|
||||
CriticalSectionScoped cs(critsect_);
|
||||
CriticalSectionScoped cs(critsect_.get());
|
||||
if (rtp_dump_) {
|
||||
// Packet dump is already started, restart it.
|
||||
rtp_dump_->Stop();
|
||||
@ -112,7 +110,7 @@ int ViESender::StartRTPDump(const char file_nameUTF8[1024]) {
|
||||
}
|
||||
|
||||
int ViESender::StopRTPDump() {
|
||||
CriticalSectionScoped cs(critsect_);
|
||||
CriticalSectionScoped cs(critsect_.get());
|
||||
if (rtp_dump_) {
|
||||
if (rtp_dump_->IsActive()) {
|
||||
rtp_dump_->Stop();
|
||||
@ -133,7 +131,7 @@ int ViESender::StopRTPDump() {
|
||||
}
|
||||
|
||||
int ViESender::SendPacket(int vie_id, const void* data, int len) {
|
||||
CriticalSectionScoped cs(critsect_);
|
||||
CriticalSectionScoped cs(critsect_.get());
|
||||
if (!transport_) {
|
||||
// No transport
|
||||
return -1;
|
||||
@ -168,7 +166,7 @@ int ViESender::SendPacket(int vie_id, const void* data, int len) {
|
||||
}
|
||||
|
||||
int ViESender::SendRTCPPacket(int vie_id, const void* data, int len) {
|
||||
CriticalSectionScoped cs(critsect_);
|
||||
CriticalSectionScoped cs(critsect_.get());
|
||||
|
||||
if (!transport_) {
|
||||
return -1;
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "common_types.h"
|
||||
#include "engine_configurations.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "typedefs.h"
|
||||
#include "vie_defines.h"
|
||||
|
||||
@ -51,7 +52,7 @@ class ViESender: public Transport {
|
||||
int engine_id_;
|
||||
int channel_id_;
|
||||
|
||||
CriticalSectionWrapper& critsect_;
|
||||
scoped_ptr<CriticalSectionWrapper> critsect_;
|
||||
|
||||
Encryption* external_encryption_;
|
||||
WebRtc_UWord8* encryption_buffer_;
|
||||
|
@ -8,10 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
// ViESharedData.cpp
|
||||
|
||||
#include "cpu_info.h"
|
||||
#include "critical_section_wrapper.h"
|
||||
#include "process_thread.h"
|
||||
#include "trace.h"
|
||||
#include "vie_channel_manager.h"
|
||||
@ -27,7 +24,6 @@ int ViESharedData::instance_counter_ = 0;
|
||||
|
||||
ViESharedData::ViESharedData()
|
||||
: instance_id_(++instance_counter_),
|
||||
api_critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
initialized_(false),
|
||||
number_cores_(CpuInfo::DetectNumberOfCores()),
|
||||
vie_performance_monitor_(ViEPerformanceMonitor(instance_id_)),
|
||||
@ -50,7 +46,6 @@ ViESharedData::~ViESharedData() {
|
||||
|
||||
module_process_thread_->Stop();
|
||||
ProcessThread::DestroyProcessThread(module_process_thread_);
|
||||
delete &api_critsect_;
|
||||
Trace::ReturnTrace();
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class CriticalSectionWrapper;
|
||||
class ProcessThread;
|
||||
class ViEChannelManager;
|
||||
class ViEInputManager;
|
||||
@ -40,7 +39,6 @@ class ViESharedData {
|
||||
|
||||
static int instance_counter_;
|
||||
const int instance_id_;
|
||||
CriticalSectionWrapper& api_critsect_;
|
||||
bool initialized_;
|
||||
const int number_cores_;
|
||||
|
||||
|
@ -25,7 +25,7 @@ enum { kMaxDelay = 1500 };
|
||||
|
||||
ViESyncModule::ViESyncModule(int id, VideoCodingModule& vcm,
|
||||
RtpRtcp& rtcp_module)
|
||||
: data_critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
: data_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
id_(id),
|
||||
vcm_(vcm),
|
||||
rtcp_module_(rtcp_module),
|
||||
@ -35,12 +35,11 @@ ViESyncModule::ViESyncModule(int id, VideoCodingModule& vcm,
|
||||
}
|
||||
|
||||
ViESyncModule::~ViESyncModule() {
|
||||
delete &data_critsect_;
|
||||
}
|
||||
|
||||
int ViESyncModule::SetVoiceChannel(int voe_channel_id,
|
||||
VoEVideoSync* voe_sync_interface) {
|
||||
CriticalSectionScoped cs(data_critsect_);
|
||||
CriticalSectionScoped cs(data_cs_.get());
|
||||
voe_channel_id_ = voe_channel_id;
|
||||
voe_sync_interface_ = voe_sync_interface;
|
||||
rtcp_module_.DeRegisterSyncModule();
|
||||
@ -97,7 +96,7 @@ WebRtc_Word32 ViESyncModule::TimeUntilNextProcess() {
|
||||
}
|
||||
|
||||
WebRtc_Word32 ViESyncModule::Process() {
|
||||
CriticalSectionScoped cs(data_critsect_);
|
||||
CriticalSectionScoped cs(data_cs_.get());
|
||||
last_sync_time_ = TickTime::Now();
|
||||
|
||||
int total_video_delay_target_ms = vcm_.Delay();
|
||||
|
@ -15,6 +15,7 @@
|
||||
#define WEBRTC_VIDEO_ENGINE_VIE_SYNC_MODULE_H_
|
||||
|
||||
#include "module.h"
|
||||
#include "system_wrappers/interface/scoped_ptr.h"
|
||||
#include "tick_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -45,7 +46,7 @@ class ViESyncModule : public Module {
|
||||
virtual WebRtc_Word32 Process();
|
||||
|
||||
private:
|
||||
CriticalSectionWrapper& data_critsect_;
|
||||
scoped_ptr<CriticalSectionWrapper> data_cs_;
|
||||
int id_;
|
||||
VideoCodingModule& vcm_;
|
||||
RtpRtcp& rtcp_module_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user