* Change the reference counting implementation for VoE to be per object and
not per interface. This simplifies things a bit, reduces code and makes it possible to implement reference counting (if we ever want) without the static Delete() method. (Reference counted objects are traditionally implicitly deleted via the last Release()) * Since the reference counting code is now simpler, there's no need for the RefCount class so I'm removing it. * Also removing the optional |ignoreRefCounters| variable from the VoiceEngine::Delete method. The justification is that it's no longer used and the reason it was there in the first place was to avoid bugs in third party code, so it's an indication that something is wrong elsewhere. * Fix a crash in voe_network_impl and voe_extended_test that would happen on machines with IPv6 support. * Fix an assert (handle the case) in the extended audio tests when SetCNAME is called with a NULL pointer. * As a side effect of this change, hopefully the footprint of VoE will be slightly smaller :) BUG=10445 (Coverity) Review URL: https://webrtc-codereview.appspot.com/521003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2127 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
497fb4fda9
commit
a990e122c4
@ -360,7 +360,9 @@ WebRtc_Word32 RTCPSender::CNAME(char cName[RTCP_CNAME_SIZE]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 RTCPSender::SetCNAME(const char cName[RTCP_CNAME_SIZE]) {
|
WebRtc_Word32 RTCPSender::SetCNAME(const char cName[RTCP_CNAME_SIZE]) {
|
||||||
assert(cName);
|
if (!cName)
|
||||||
|
return -1;
|
||||||
|
|
||||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||||
_CNAME[RTCP_CNAME_SIZE - 1] = 0;
|
_CNAME[RTCP_CNAME_SIZE - 1] = 0;
|
||||||
strncpy(_CNAME, cName, RTCP_CNAME_SIZE - 1);
|
strncpy(_CNAME, cName, RTCP_CNAME_SIZE - 1);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Use of this source code is governed by a BSD-style license
|
||||||
* that can be found in the LICENSE file in the root of the source
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@ -65,12 +65,10 @@ public:
|
|||||||
static VoiceEngine* Create();
|
static VoiceEngine* Create();
|
||||||
|
|
||||||
// Deletes a created VoiceEngine object and releases the utilized resources.
|
// Deletes a created VoiceEngine object and releases the utilized resources.
|
||||||
// If |ignoreRefCounters| is set to false, all reference counters must be
|
// Note that if there are outstanding references held via other interfaces,
|
||||||
// zero to enable a valid release of the allocated resources. When set to
|
// the voice engine instance will not actually be deleted until those
|
||||||
// true, a release of all resources allocated by the VoE is performed
|
// references have been released.
|
||||||
// without checking the reference counter state.
|
static bool Delete(VoiceEngine*& voiceEngine);
|
||||||
static bool Delete(VoiceEngine*& voiceEngine,
|
|
||||||
bool ignoreRefCounters = false);
|
|
||||||
|
|
||||||
// Specifies the amount and type of trace information which will be
|
// Specifies the amount and type of trace information which will be
|
||||||
// created by the VoiceEngine.
|
// created by the VoiceEngine.
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license
|
|
||||||
* that can be found in the LICENSE file in the root of the source
|
|
||||||
* tree. An additional intellectual property rights grant can be found
|
|
||||||
* in the file PATENTS. All contributing project authors may
|
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "critical_section_wrapper.h"
|
|
||||||
#include "ref_count.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
namespace voe {
|
|
||||||
|
|
||||||
RefCount::RefCount() :
|
|
||||||
_count(0),
|
|
||||||
_crit(*CriticalSectionWrapper::CreateCriticalSection())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RefCount::~RefCount()
|
|
||||||
{
|
|
||||||
delete &_crit;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefCount&
|
|
||||||
RefCount::operator++(int)
|
|
||||||
{
|
|
||||||
CriticalSectionScoped lock(&_crit);
|
|
||||||
_count++;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefCount&
|
|
||||||
RefCount::operator--(int)
|
|
||||||
{
|
|
||||||
CriticalSectionScoped lock(&_crit);
|
|
||||||
_count--;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
RefCount::Reset()
|
|
||||||
{
|
|
||||||
CriticalSectionScoped lock(&_crit);
|
|
||||||
_count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
RefCount::GetCount() const
|
|
||||||
{
|
|
||||||
return _count;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace voe
|
|
||||||
|
|
||||||
} // namespace webrtc
|
|
@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license
|
|
||||||
* that can be found in the LICENSE file in the root of the source
|
|
||||||
* tree. An additional intellectual property rights grant can be found
|
|
||||||
* in the file PATENTS. All contributing project authors may
|
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WEBRTC_VOICE_ENGINE_REF_COUNT_H
|
|
||||||
#define WEBRTC_VOICE_ENGINE_REF_COUNT_H
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
class CriticalSectionWrapper;
|
|
||||||
|
|
||||||
namespace voe {
|
|
||||||
|
|
||||||
class RefCount
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RefCount();
|
|
||||||
~RefCount();
|
|
||||||
RefCount& operator++(int);
|
|
||||||
RefCount& operator--(int);
|
|
||||||
void Reset();
|
|
||||||
int GetCount() const;
|
|
||||||
private:
|
|
||||||
volatile int _count;
|
|
||||||
CriticalSectionWrapper& _crit;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace voe
|
|
||||||
|
|
||||||
} // namespace webrtc
|
|
||||||
#endif // #ifndef WEBRTC_VOICE_ENGINE_REF_COUNT_H
|
|
@ -41,9 +41,8 @@ VoEAudioProcessing* VoEAudioProcessing::GetInterface(VoiceEngine* voiceEngine) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
VoEAudioProcessingImpl* d = s;
|
s->AddRef();
|
||||||
(*d)++;
|
return s;
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,21 +58,6 @@ VoEAudioProcessingImpl::~VoEAudioProcessingImpl() {
|
|||||||
"VoEAudioProcessingImpl::~VoEAudioProcessingImpl() - dtor");
|
"VoEAudioProcessingImpl::~VoEAudioProcessingImpl() - dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoEAudioProcessingImpl::Release() {
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEAudioProcessing::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0) {
|
|
||||||
Reset(); // reset reference counter to zero => OK to delete VE
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEAudioProcessing reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoEAudioProcessingImpl::SetNsStatus(bool enable, NsModes mode) {
|
int VoEAudioProcessingImpl::SetNsStatus(bool enable, NsModes mode) {
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
"SetNsStatus(enable=%d, mode=%d)", enable, mode);
|
"SetNsStatus(enable=%d, mode=%d)", enable, mode);
|
||||||
|
@ -13,17 +13,12 @@
|
|||||||
|
|
||||||
#include "voe_audio_processing.h"
|
#include "voe_audio_processing.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class VoEAudioProcessingImpl
|
class VoEAudioProcessingImpl : public VoEAudioProcessing {
|
||||||
: public VoEAudioProcessing,
|
|
||||||
public voe::RefCount {
|
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
virtual int SetNsStatus(bool enable, NsModes mode = kNsUnchanged);
|
virtual int SetNsStatus(bool enable, NsModes mode = kNsUnchanged);
|
||||||
|
|
||||||
virtual int GetNsStatus(bool& enabled, NsModes& mode);
|
virtual int GetNsStatus(bool& enabled, NsModes& mode);
|
||||||
|
@ -40,10 +40,9 @@ VoEBase* VoEBase::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
VoEBaseImpl* d = s;
|
s->AddRef();
|
||||||
(*d)++;
|
return s;
|
||||||
return (d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VoEBaseImpl::VoEBaseImpl(voe::SharedData* shared) :
|
VoEBaseImpl::VoEBaseImpl(voe::SharedData* shared) :
|
||||||
@ -66,24 +65,6 @@ VoEBaseImpl::~VoEBaseImpl()
|
|||||||
delete &_callbackCritSect;
|
delete &_callbackCritSect;
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoEBaseImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEBaseImpl::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEBaseImpl reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VoEBaseImpl::OnErrorIsReported(const ErrorCode error)
|
void VoEBaseImpl::OnErrorIsReported(const ErrorCode error)
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(&_callbackCritSect);
|
CriticalSectionScoped cs(&_callbackCritSect);
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include "voe_base.h"
|
#include "voe_base.h"
|
||||||
|
|
||||||
#include "module_common_types.h"
|
#include "module_common_types.h"
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
@ -23,13 +22,10 @@ namespace webrtc
|
|||||||
class ProcessThread;
|
class ProcessThread;
|
||||||
|
|
||||||
class VoEBaseImpl: public VoEBase,
|
class VoEBaseImpl: public VoEBase,
|
||||||
public voe::RefCount,
|
|
||||||
public AudioTransport,
|
public AudioTransport,
|
||||||
public AudioDeviceObserver
|
public AudioDeviceObserver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
virtual int RegisterVoiceEngineObserver(VoiceEngineObserver& observer);
|
virtual int RegisterVoiceEngineObserver(VoiceEngineObserver& observer);
|
||||||
|
|
||||||
virtual int DeRegisterVoiceEngineObserver();
|
virtual int DeRegisterVoiceEngineObserver();
|
||||||
|
@ -30,11 +30,9 @@ VoECallReport* VoECallReport::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s =
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
s->AddRef();
|
||||||
VoECallReportImpl* d = s;
|
return s;
|
||||||
(*d)++;
|
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,24 +52,6 @@ VoECallReportImpl::~VoECallReportImpl()
|
|||||||
delete &_file;
|
delete &_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoECallReportImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoECallReportImpl::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoECallReportImpl reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoECallReportImpl::ResetCallReportStatistics(int channel)
|
int VoECallReportImpl::ResetCallReportStatistics(int channel)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include "voe_call_report.h"
|
#include "voe_call_report.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
|
|
||||||
@ -21,12 +20,9 @@ namespace webrtc
|
|||||||
{
|
{
|
||||||
class FileWrapper;
|
class FileWrapper;
|
||||||
|
|
||||||
class VoECallReportImpl: public VoECallReport,
|
class VoECallReportImpl: public VoECallReport
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
virtual int ResetCallReportStatistics(int channel);
|
virtual int ResetCallReportStatistics(int channel);
|
||||||
|
|
||||||
virtual int GetEchoMetricSummary(EchoStatistics& stats);
|
virtual int GetEchoMetricSummary(EchoStatistics& stats);
|
||||||
|
@ -29,11 +29,9 @@ VoECodec* VoECodec::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s =
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
s->AddRef();
|
||||||
VoECodecImpl* d = s;
|
return s;
|
||||||
(*d)++;
|
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,24 +49,6 @@ VoECodecImpl::~VoECodecImpl()
|
|||||||
"~VoECodecImpl() - dtor");
|
"~VoECodecImpl() - dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoECodecImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoECodecImpl::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoECodecImpl reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoECodecImpl::NumOfCodecs()
|
int VoECodecImpl::NumOfCodecs()
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
@ -13,18 +13,14 @@
|
|||||||
|
|
||||||
#include "voe_codec.h"
|
#include "voe_codec.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
|
|
||||||
class VoECodecImpl: public VoECodec,
|
class VoECodecImpl: public VoECodec
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
virtual int NumOfCodecs();
|
virtual int NumOfCodecs();
|
||||||
|
|
||||||
virtual int GetCodec(int index, CodecInst& codec);
|
virtual int GetCodec(int index, CodecInst& codec);
|
||||||
|
@ -29,11 +29,9 @@ VoEDtmf* VoEDtmf::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s =
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
s->AddRef();
|
||||||
VoEDtmfImpl* d = s;
|
return s;
|
||||||
( *d)++;
|
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,24 +52,6 @@ VoEDtmfImpl::~VoEDtmfImpl()
|
|||||||
"VoEDtmfImpl::~VoEDtmfImpl() - dtor");
|
"VoEDtmfImpl::~VoEDtmfImpl() - dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoEDtmfImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEDtmf::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset(); // reset reference counter to zero => OK to delete VE
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEDtmf reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoEDtmfImpl::SendTelephoneEvent(int channel,
|
int VoEDtmfImpl::SendTelephoneEvent(int channel,
|
||||||
int eventCode,
|
int eventCode,
|
||||||
bool outOfBand,
|
bool outOfBand,
|
||||||
|
@ -13,18 +13,14 @@
|
|||||||
|
|
||||||
#include "voe_dtmf.h"
|
#include "voe_dtmf.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
|
|
||||||
class VoEDtmfImpl : public VoEDtmf,
|
class VoEDtmfImpl : public VoEDtmf
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
virtual int SendTelephoneEvent(
|
virtual int SendTelephoneEvent(
|
||||||
int channel,
|
int channel,
|
||||||
int eventCode,
|
int eventCode,
|
||||||
|
@ -28,11 +28,9 @@ VoEEncryption* VoEEncryption::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s =
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
s->AddRef();
|
||||||
VoEEncryptionImpl* d = s;
|
return s;
|
||||||
(*d)++;
|
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,25 +48,6 @@ VoEEncryptionImpl::~VoEEncryptionImpl()
|
|||||||
"VoEEncryptionImpl::~VoEEncryptionImpl() - dtor");
|
"VoEEncryptionImpl::~VoEEncryptionImpl() - dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoEEncryptionImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEEncryption::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
// reset reference counter to zero => OK to delete VE
|
|
||||||
Reset();
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEEncryption reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoEEncryptionImpl::EnableSRTPSend(
|
int VoEEncryptionImpl::EnableSRTPSend(
|
||||||
int channel,
|
int channel,
|
||||||
CipherTypes cipherType,
|
CipherTypes cipherType,
|
||||||
|
@ -13,18 +13,13 @@
|
|||||||
|
|
||||||
#include "voe_encryption.h"
|
#include "voe_encryption.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class VoEEncryptionImpl : public VoEEncryption,
|
class VoEEncryptionImpl : public VoEEncryption
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
// SRTP
|
// SRTP
|
||||||
virtual int EnableSRTPSend(
|
virtual int EnableSRTPSend(
|
||||||
int channel,
|
int channel,
|
||||||
|
@ -29,10 +29,9 @@ VoEExternalMedia* VoEExternalMedia::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
VoEExternalMediaImpl* d = s;
|
s->AddRef();
|
||||||
(*d)++;
|
return s;
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,24 +50,6 @@ VoEExternalMediaImpl::~VoEExternalMediaImpl()
|
|||||||
"~VoEExternalMediaImpl() - dtor");
|
"~VoEExternalMediaImpl() - dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoEExternalMediaImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(shared_->instance_id(), -1),
|
|
||||||
"VoEExternalMedia::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
shared_->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(shared_->instance_id(), -1),
|
|
||||||
"VoEExternalMedia reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoEExternalMediaImpl::RegisterExternalMediaProcessing(
|
int VoEExternalMediaImpl::RegisterExternalMediaProcessing(
|
||||||
int channel,
|
int channel,
|
||||||
ProcessingTypes type,
|
ProcessingTypes type,
|
||||||
|
@ -13,17 +13,13 @@
|
|||||||
|
|
||||||
#include "voe_external_media.h"
|
#include "voe_external_media.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class VoEExternalMediaImpl : public VoEExternalMedia,
|
class VoEExternalMediaImpl : public VoEExternalMedia
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
virtual int RegisterExternalMediaProcessing(
|
virtual int RegisterExternalMediaProcessing(
|
||||||
int channel,
|
int channel,
|
||||||
ProcessingTypes type,
|
ProcessingTypes type,
|
||||||
|
@ -31,11 +31,9 @@ VoEFile* VoEFile::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s =
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
s->AddRef();
|
||||||
VoEFileImpl* d = s;
|
return s;
|
||||||
(*d)++;
|
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,24 +51,6 @@ VoEFileImpl::~VoEFileImpl()
|
|||||||
"VoEFileImpl::~VoEFileImpl() - dtor");
|
"VoEFileImpl::~VoEFileImpl() - dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoEFileImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEFile::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEFile reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoEFileImpl::StartPlayingFileLocally(
|
int VoEFileImpl::StartPlayingFileLocally(
|
||||||
int channel,
|
int channel,
|
||||||
const char fileNameUTF8[1024],
|
const char fileNameUTF8[1024],
|
||||||
|
@ -13,16 +13,12 @@
|
|||||||
|
|
||||||
#include "voe_file.h"
|
#include "voe_file.h"
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
#include "ref_count.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class VoEFileImpl : public VoEFile,
|
class VoEFileImpl : public VoEFile
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
// Playout file locally
|
// Playout file locally
|
||||||
|
|
||||||
virtual int StartPlayingFileLocally(
|
virtual int StartPlayingFileLocally(
|
||||||
|
@ -30,11 +30,9 @@ VoEHardware* VoEHardware::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s =
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
s->AddRef();
|
||||||
VoEHardwareImpl* d = s;
|
return s;
|
||||||
(*d)++;
|
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,24 +63,6 @@ VoEHardwareImpl::~VoEHardwareImpl()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoEHardwareImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEHardwareImpl::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEHardwareImpl reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoEHardwareImpl::SetAudioDeviceLayer(AudioLayers audioLayer)
|
int VoEHardwareImpl::SetAudioDeviceLayer(AudioLayers audioLayer)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
@ -13,19 +13,15 @@
|
|||||||
|
|
||||||
#include "voe_hardware.h"
|
#include "voe_hardware.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
class CpuWrapper;
|
class CpuWrapper;
|
||||||
|
|
||||||
class VoEHardwareImpl: public VoEHardware,
|
class VoEHardwareImpl: public VoEHardware
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
virtual int GetNumOfRecordingDevices(int& devices);
|
virtual int GetNumOfRecordingDevices(int& devices);
|
||||||
|
|
||||||
virtual int GetNumOfPlayoutDevices(int& devices);
|
virtual int GetNumOfPlayoutDevices(int& devices);
|
||||||
|
@ -29,11 +29,9 @@ VoENetEqStats* VoENetEqStats::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s =
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
s->AddRef();
|
||||||
VoENetEqStatsImpl* d = s;
|
return s;
|
||||||
(*d)++;
|
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,24 +49,6 @@ VoENetEqStatsImpl::~VoENetEqStatsImpl()
|
|||||||
"VoENetEqStatsImpl::~VoENetEqStatsImpl() - dtor");
|
"VoENetEqStatsImpl::~VoENetEqStatsImpl() - dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoENetEqStatsImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoENetEqStats::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset(); // reset reference counter to zero => OK to delete VE
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoENetEqStats reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoENetEqStatsImpl::GetNetworkStatistics(int channel,
|
int VoENetEqStatsImpl::GetNetworkStatistics(int channel,
|
||||||
NetworkStatistics& stats)
|
NetworkStatistics& stats)
|
||||||
{
|
{
|
||||||
|
@ -13,17 +13,13 @@
|
|||||||
|
|
||||||
#include "voe_neteq_stats.h"
|
#include "voe_neteq_stats.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class VoENetEqStatsImpl : public VoENetEqStats,
|
class VoENetEqStatsImpl : public VoENetEqStats
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
virtual int GetNetworkStatistics(int channel,
|
virtual int GetNetworkStatistics(int channel,
|
||||||
NetworkStatistics& stats);
|
NetworkStatistics& stats);
|
||||||
|
|
||||||
|
@ -28,11 +28,9 @@ VoENetwork* VoENetwork::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s =
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
s->AddRef();
|
||||||
VoENetworkImpl* d = s;
|
return s;
|
||||||
(*d)++;
|
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,24 +48,6 @@ VoENetworkImpl::~VoENetworkImpl()
|
|||||||
"~VoENetworkImpl() - dtor");
|
"~VoENetworkImpl() - dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoENetworkImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoENetworkImpl::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoENetworkImpl reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoENetworkImpl::RegisterExternalTransport(int channel,
|
int VoENetworkImpl::RegisterExternalTransport(int channel,
|
||||||
Transport& transport)
|
Transport& transport)
|
||||||
{
|
{
|
||||||
@ -264,7 +244,8 @@ int VoENetworkImpl::GetLocalIP(char ipAddr[64], bool ipv6)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char localIPAddr[64];
|
// Use a buffer big enough for IPv6 addresses and initialize it with zeros.
|
||||||
|
char localIPAddr[256] = {0};
|
||||||
|
|
||||||
if (ipv6)
|
if (ipv6)
|
||||||
{
|
{
|
||||||
|
@ -13,19 +13,15 @@
|
|||||||
|
|
||||||
#include "voe_network.h"
|
#include "voe_network.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
|
|
||||||
class VoENetworkImpl: public VoENetwork,
|
class VoENetworkImpl: public VoENetwork
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
virtual int RegisterExternalTransport(int channel, Transport& transport);
|
virtual int RegisterExternalTransport(int channel, Transport& transport);
|
||||||
|
|
||||||
virtual int DeRegisterExternalTransport(int channel);
|
virtual int DeRegisterExternalTransport(int channel);
|
||||||
|
@ -29,10 +29,9 @@ VoERTP_RTCP* VoERTP_RTCP::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
VoERTP_RTCPImpl* d = s;
|
s->AddRef();
|
||||||
(*d)++;
|
return s;
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,24 +49,6 @@ VoERTP_RTCPImpl::~VoERTP_RTCPImpl()
|
|||||||
"VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor");
|
"VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoERTP_RTCPImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoERTP_RTCP::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset(); // reset reference counter to zero => OK to delete VE
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoERTP_RTCP reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoERTP_RTCPImpl::RegisterRTPObserver(int channel, VoERTPObserver& observer)
|
int VoERTP_RTCPImpl::RegisterRTPObserver(int channel, VoERTPObserver& observer)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
@ -13,17 +13,13 @@
|
|||||||
|
|
||||||
#include "voe_rtp_rtcp.h"
|
#include "voe_rtp_rtcp.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class VoERTP_RTCPImpl : public VoERTP_RTCP,
|
class VoERTP_RTCPImpl : public VoERTP_RTCP
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual int Release();
|
|
||||||
// Registration of observers for RTP and RTCP callbacks
|
// Registration of observers for RTP and RTCP callbacks
|
||||||
virtual int RegisterRTPObserver(int channel, VoERTPObserver& observer);
|
virtual int RegisterRTPObserver(int channel, VoERTPObserver& observer);
|
||||||
|
|
||||||
|
@ -27,11 +27,9 @@ VoEVideoSync* VoEVideoSync::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s =
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
s->AddRef();
|
||||||
VoEVideoSyncImpl* d = s;
|
return s;
|
||||||
(*d)++;
|
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,24 +47,6 @@ VoEVideoSyncImpl::~VoEVideoSyncImpl()
|
|||||||
"VoEVideoSyncImpl::~VoEVideoSyncImpl() - dtor");
|
"VoEVideoSyncImpl::~VoEVideoSyncImpl() - dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoEVideoSyncImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEVideoSync::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset(); // reset reference counter to zero => OK to delete VE
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEVideoSync reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoEVideoSyncImpl::GetPlayoutTimestamp(int channel, unsigned int& timestamp)
|
int VoEVideoSyncImpl::GetPlayoutTimestamp(int channel, unsigned int& timestamp)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
@ -13,17 +13,13 @@
|
|||||||
|
|
||||||
#include "voe_video_sync.h"
|
#include "voe_video_sync.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class VoEVideoSyncImpl : public VoEVideoSync,
|
class VoEVideoSyncImpl : public VoEVideoSync
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
virtual int GetPlayoutBufferSize(int& bufferMs);
|
virtual int GetPlayoutBufferSize(int& bufferMs);
|
||||||
|
|
||||||
virtual int SetMinimumPlayoutDelay(int channel, int delayMs);
|
virtual int SetMinimumPlayoutDelay(int channel, int delayMs);
|
||||||
|
@ -29,11 +29,9 @@ VoEVolumeControl* VoEVolumeControl::GetInterface(VoiceEngine* voiceEngine)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
VoiceEngineImpl* s =
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
s->AddRef();
|
||||||
VoEVolumeControlImpl* d = s;
|
return s;
|
||||||
(*d)++;
|
|
||||||
return (d);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,24 +50,6 @@ VoEVolumeControlImpl::~VoEVolumeControlImpl()
|
|||||||
"VoEVolumeControlImpl::~VoEVolumeControlImpl() - dtor");
|
"VoEVolumeControlImpl::~VoEVolumeControlImpl() - dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoEVolumeControlImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEVolumeControl::Release()");
|
|
||||||
(*this)--;
|
|
||||||
int refCount = GetCount();
|
|
||||||
if (refCount < 0)
|
|
||||||
{
|
|
||||||
Reset(); // reset reference counter to zero => OK to delete VE
|
|
||||||
_shared->SetLastError(VE_INTERFACE_NOT_FOUND, kTraceWarning);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
|
||||||
VoEId(_shared->instance_id(), -1),
|
|
||||||
"VoEVolumeControl reference counter = %d", refCount);
|
|
||||||
return (refCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
int VoEVolumeControlImpl::SetSpeakerVolume(unsigned int volume)
|
int VoEVolumeControlImpl::SetSpeakerVolume(unsigned int volume)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||||
|
@ -13,17 +13,13 @@
|
|||||||
|
|
||||||
#include "voe_volume_control.h"
|
#include "voe_volume_control.h"
|
||||||
|
|
||||||
#include "ref_count.h"
|
|
||||||
#include "shared_data.h"
|
#include "shared_data.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class VoEVolumeControlImpl : public VoEVolumeControl,
|
class VoEVolumeControlImpl : public VoEVolumeControl
|
||||||
public voe::RefCount
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Release();
|
|
||||||
|
|
||||||
virtual int SetSpeakerVolume(unsigned int volume);
|
virtual int SetSpeakerVolume(unsigned int volume);
|
||||||
|
|
||||||
virtual int GetSpeakerVolume(unsigned int& volume);
|
virtual int GetSpeakerVolume(unsigned int& volume);
|
||||||
|
@ -72,8 +72,6 @@
|
|||||||
'monitor_module.h',
|
'monitor_module.h',
|
||||||
'output_mixer.cc',
|
'output_mixer.cc',
|
||||||
'output_mixer.h',
|
'output_mixer.h',
|
||||||
'ref_count.cc',
|
|
||||||
'ref_count.h',
|
|
||||||
'shared_data.cc',
|
'shared_data.cc',
|
||||||
'shared_data.h',
|
'shared_data.h',
|
||||||
'statistics.cc',
|
'statistics.cc',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Use of this source code is governed by a BSD-style license
|
||||||
* that can be found in the LICENSE file in the root of the source
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@ -35,15 +35,35 @@ WEBRTC_DLLEXPORT VoiceEngine* GetVoiceEngine();
|
|||||||
VoiceEngine* GetVoiceEngine()
|
VoiceEngine* GetVoiceEngine()
|
||||||
{
|
{
|
||||||
VoiceEngineImpl* self = new VoiceEngineImpl();
|
VoiceEngineImpl* self = new VoiceEngineImpl();
|
||||||
VoiceEngine* ve = reinterpret_cast<VoiceEngine*> (self);
|
VoiceEngine* ve = reinterpret_cast<VoiceEngine*>(self);
|
||||||
if (ve != NULL)
|
if (ve != NULL)
|
||||||
{
|
{
|
||||||
|
self->AddRef(); // First reference. Released in VoiceEngine::Delete.
|
||||||
gVoiceEngineInstanceCounter++;
|
gVoiceEngineInstanceCounter++;
|
||||||
}
|
}
|
||||||
return ve;
|
return ve;
|
||||||
}
|
}
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
|
int VoiceEngineImpl::AddRef() {
|
||||||
|
return ++_ref_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This implements the Release() method for all the inherited interfaces.
|
||||||
|
int VoiceEngineImpl::Release() {
|
||||||
|
int new_ref = --_ref_count;
|
||||||
|
assert(new_ref >= 0);
|
||||||
|
if (new_ref == 0) {
|
||||||
|
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, -1,
|
||||||
|
"VoiceEngineImpl self deleting (voiceEngine=0x%p)",
|
||||||
|
this);
|
||||||
|
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new_ref;
|
||||||
|
}
|
||||||
|
|
||||||
VoiceEngine* VoiceEngine::Create()
|
VoiceEngine* VoiceEngine::Create()
|
||||||
{
|
{
|
||||||
#if (defined _WIN32)
|
#if (defined _WIN32)
|
||||||
@ -107,199 +127,22 @@ int VoiceEngine::SetTraceCallback(TraceCallback* callback)
|
|||||||
return (Trace::SetTraceCallback(callback));
|
return (Trace::SetTraceCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VoiceEngine::Delete(VoiceEngine*& voiceEngine, bool ignoreRefCounters)
|
bool VoiceEngine::Delete(VoiceEngine*& voiceEngine)
|
||||||
{
|
{
|
||||||
if (voiceEngine == NULL)
|
if (voiceEngine == NULL)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*> (voiceEngine);
|
VoiceEngineImpl* s = reinterpret_cast<VoiceEngineImpl*>(voiceEngine);
|
||||||
VoEBaseImpl* base = s;
|
// Release the reference that was added in GetVoiceEngine.
|
||||||
|
int ref = s->Release();
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, -1,
|
|
||||||
"VoiceEngine::Delete(voiceEngine=0x%p, ignoreRefCounters=%d)",
|
|
||||||
voiceEngine, ignoreRefCounters);
|
|
||||||
|
|
||||||
if (!ignoreRefCounters)
|
|
||||||
{
|
|
||||||
if (base->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoEBase reference counter is %d => memory will not "
|
|
||||||
"be released properly!", base->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
|
|
||||||
VoECodecImpl* codec = s;
|
|
||||||
if (codec->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoECodec reference counter is %d => memory will not "
|
|
||||||
"be released properly!", codec->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
|
|
||||||
VoEDtmfImpl* dtmf = s;
|
|
||||||
if (dtmf->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoEDtmf reference counter is %d =>"
|
|
||||||
"memory will not be released properly!",
|
|
||||||
dtmf->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_ENCRYPTION_API
|
|
||||||
VoEEncryptionImpl* encrypt = s;
|
|
||||||
if (encrypt->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoEEncryption reference counter is %d => "
|
|
||||||
"memory will not be released properly!",
|
|
||||||
encrypt->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
|
|
||||||
VoEExternalMediaImpl* extmedia = s;
|
|
||||||
if (extmedia->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoEExternalMedia reference counter is %d => "
|
|
||||||
"memory will not be released properly!",
|
|
||||||
extmedia->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_CALL_REPORT_API
|
|
||||||
VoECallReportImpl* report = s;
|
|
||||||
if (report->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoECallReport reference counter is %d => memory "
|
|
||||||
"will not be released properly!",
|
|
||||||
report->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_FILE_API
|
|
||||||
VoEFileImpl* file = s;
|
|
||||||
if (file->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(
|
|
||||||
kTraceCritical,
|
|
||||||
kTraceVoice,
|
|
||||||
-1,
|
|
||||||
"VoEFile reference counter is %d => memory will not "
|
|
||||||
"be released properly!",
|
|
||||||
file->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
|
|
||||||
VoEHardwareImpl* hware = s;
|
|
||||||
if (hware->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoEHardware reference counter is %d => memory will "
|
|
||||||
"not be released properly!", hware->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
|
|
||||||
VoENetEqStatsImpl* neteqst = s;
|
|
||||||
if (neteqst->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoENetEqStats reference counter is %d => "
|
|
||||||
"memory will not be released properly!",
|
|
||||||
neteqst->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_NETWORK_API
|
|
||||||
VoENetworkImpl* netw = s;
|
|
||||||
if (netw->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoENetworkImpl reference counter is %d => memory "
|
|
||||||
"will not be released properly!", netw->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
|
|
||||||
VoERTP_RTCPImpl* rtcp = s;
|
|
||||||
if (rtcp->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoERTP_RTCP reference counter is %d =>"
|
|
||||||
"memory will not be released properly!",
|
|
||||||
rtcp->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
|
|
||||||
VoEVideoSyncImpl* vsync = s;
|
|
||||||
if (vsync->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoEVideoSync reference counter is %d => "
|
|
||||||
"memory will not be released properly!",
|
|
||||||
vsync->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
|
|
||||||
VoEVolumeControlImpl* volume = s;
|
|
||||||
if (volume->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoEVolumeControl reference counter is %d =>"
|
|
||||||
"memory will not be released properly!",
|
|
||||||
volume->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
|
|
||||||
VoEAudioProcessingImpl* apm = s;
|
|
||||||
if (apm->GetCount() != 0)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceCritical, kTraceVoice, -1,
|
|
||||||
"VoEAudioProcessing reference counter is %d => "
|
|
||||||
"memory will not be released properly!",
|
|
||||||
apm->GetCount());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, -1,
|
|
||||||
"all reference counters are zero => deleting the "
|
|
||||||
"VoiceEngine instance...");
|
|
||||||
|
|
||||||
} // if (!ignoreRefCounters)
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, -1,
|
|
||||||
"reference counters are ignored => deleting the "
|
|
||||||
"VoiceEngine instance...");
|
|
||||||
}
|
|
||||||
|
|
||||||
delete s;
|
|
||||||
voiceEngine = NULL;
|
voiceEngine = NULL;
|
||||||
|
|
||||||
|
if (ref != 0) {
|
||||||
|
WEBRTC_TRACE(kTraceWarning, kTraceVoice, -1,
|
||||||
|
"VoiceEngine::Delete did not release the very last reference. "
|
||||||
|
"%d references remain.", ref);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#ifndef WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
|
#ifndef WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
|
||||||
#define WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
|
#define WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
|
||||||
|
|
||||||
|
#include "atomic32.h"
|
||||||
#include "engine_configurations.h"
|
#include "engine_configurations.h"
|
||||||
#include "voe_base_impl.h"
|
#include "voe_base_impl.h"
|
||||||
|
|
||||||
@ -140,12 +141,22 @@ public:
|
|||||||
#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
|
#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
|
||||||
VoEVolumeControlImpl(this),
|
VoEVolumeControlImpl(this),
|
||||||
#endif
|
#endif
|
||||||
VoEBaseImpl(this)
|
VoEBaseImpl(this),
|
||||||
|
_ref_count(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~VoiceEngineImpl()
|
virtual ~VoiceEngineImpl()
|
||||||
{
|
{
|
||||||
|
assert(_ref_count.Value() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AddRef();
|
||||||
|
|
||||||
|
// This implements the Release() method for all the inherited interfaces.
|
||||||
|
virtual int Release();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Atomic32 _ref_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Use of this source code is governed by a BSD-style license
|
||||||
* that can be found in the LICENSE file in the root of the source
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@ -33,20 +33,20 @@ BeforeInitializationFixture::BeforeInitializationFixture()
|
|||||||
}
|
}
|
||||||
|
|
||||||
BeforeInitializationFixture::~BeforeInitializationFixture() {
|
BeforeInitializationFixture::~BeforeInitializationFixture() {
|
||||||
EXPECT_EQ(0, voe_base_->Release());
|
voe_base_->Release();
|
||||||
EXPECT_EQ(0, voe_codec_->Release());
|
voe_codec_->Release();
|
||||||
EXPECT_EQ(0, voe_volume_control_->Release());
|
voe_volume_control_->Release();
|
||||||
EXPECT_EQ(0, voe_dtmf_->Release());
|
voe_dtmf_->Release();
|
||||||
EXPECT_EQ(0, voe_rtp_rtcp_->Release());
|
voe_rtp_rtcp_->Release();
|
||||||
EXPECT_EQ(0, voe_apm_->Release());
|
voe_apm_->Release();
|
||||||
EXPECT_EQ(0, voe_network_->Release());
|
voe_network_->Release();
|
||||||
EXPECT_EQ(0, voe_file_->Release());
|
voe_file_->Release();
|
||||||
EXPECT_EQ(0, voe_vsync_->Release());
|
voe_vsync_->Release();
|
||||||
EXPECT_EQ(0, voe_encrypt_->Release());
|
voe_encrypt_->Release();
|
||||||
EXPECT_EQ(0, voe_hardware_->Release());
|
voe_hardware_->Release();
|
||||||
EXPECT_EQ(0, voe_xmedia_->Release());
|
voe_xmedia_->Release();
|
||||||
EXPECT_EQ(0, voe_call_report_->Release());
|
voe_call_report_->Release();
|
||||||
EXPECT_EQ(0, voe_neteq_stats_->Release());
|
voe_neteq_stats_->Release();
|
||||||
|
|
||||||
EXPECT_TRUE(webrtc::VoiceEngine::Delete(voice_engine_));
|
EXPECT_TRUE(webrtc::VoiceEngine::Delete(voice_engine_));
|
||||||
}
|
}
|
||||||
|
@ -1531,7 +1531,7 @@ int VoEExtendedTest::TestBase() {
|
|||||||
for (int instNum = 0; instNum < 7; instNum++) {
|
for (int instNum = 0; instNum < 7; instNum++) {
|
||||||
TEST_MUSTPASS(baseVE[instNum]->DeleteChannel(0));
|
TEST_MUSTPASS(baseVE[instNum]->DeleteChannel(0));
|
||||||
TEST_MUSTPASS(baseVE[instNum]->Terminate());
|
TEST_MUSTPASS(baseVE[instNum]->Terminate());
|
||||||
TEST_MUSTPASS(baseVE[instNum]->Release());
|
baseVE[instNum]->Release();
|
||||||
VoiceEngine::Delete(instVE[instNum]);
|
VoiceEngine::Delete(instVE[instNum]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5307,7 +5307,8 @@ int VoEExtendedTest::TestNetwork() {
|
|||||||
const char* localIP = "192.168.1.4";
|
const char* localIP = "192.168.1.4";
|
||||||
|
|
||||||
#else
|
#else
|
||||||
char localIP[64];
|
// Must be big enough so that we can print an IPv6 address.
|
||||||
|
char localIP[256] = {0};
|
||||||
|
|
||||||
// invalid parameter
|
// invalid parameter
|
||||||
TEST_MUSTPASS(!netw->GetLocalIP(NULL));
|
TEST_MUSTPASS(!netw->GetLocalIP(NULL));
|
||||||
|
@ -618,186 +618,70 @@ void VoETestManager::GetInterfaces() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int VoETestManager::ReleaseInterfaces() {
|
int VoETestManager::ReleaseInterfaces() {
|
||||||
int err(0), remInt(1), j(0);
|
|
||||||
bool releaseOK(true);
|
bool releaseOK(true);
|
||||||
|
|
||||||
if (voe_base_) {
|
if (voe_base_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_base_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_base_->Release()));
|
voe_base_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d base interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
// try to release one addition time (should fail)
|
|
||||||
TEST_MUSTPASS(-1 != voe_base_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
// it is considered safe to delete even if Release has been called
|
|
||||||
// too many times
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
if (voe_codec_) {
|
if (voe_codec_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_codec_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_codec_->Release()));
|
voe_codec_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d codec interfaces"
|
|
||||||
" (should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_codec_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
if (voe_volume_control_) {
|
if (voe_volume_control_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_volume_control_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_volume_control_->Release()));
|
voe_volume_control_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d volume interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_volume_control_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
if (voe_dtmf_) {
|
if (voe_dtmf_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_dtmf_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_dtmf_->Release()));
|
voe_dtmf_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d dtmf interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_dtmf_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
if (voe_rtp_rtcp_) {
|
if (voe_rtp_rtcp_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_rtp_rtcp_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_rtp_rtcp_->Release()));
|
voe_rtp_rtcp_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d rtp/rtcp interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_rtp_rtcp_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
if (voe_apm_) {
|
if (voe_apm_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_apm_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_apm_->Release()));
|
voe_apm_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d apm interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_apm_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
if (voe_network_) {
|
if (voe_network_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_network_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_network_->Release()));
|
voe_network_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d network interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_network_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
if (voe_file_) {
|
if (voe_file_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_file_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_file_->Release()));
|
voe_file_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d file interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_file_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
#ifdef _TEST_VIDEO_SYNC_
|
#ifdef _TEST_VIDEO_SYNC_
|
||||||
if (voe_vsync_) {
|
if (voe_vsync_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_vsync_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_vsync_->Release()));
|
voe_vsync_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d video sync interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_vsync_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (voe_encrypt_) {
|
if (voe_encrypt_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_encrypt_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_encrypt_->Release()));
|
voe_encrypt_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d encryption interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_encrypt_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
if (voe_hardware_) {
|
if (voe_hardware_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_hardware_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_hardware_->Release()));
|
voe_hardware_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d hardware interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_hardware_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
#ifdef _TEST_XMEDIA_
|
#ifdef _TEST_XMEDIA_
|
||||||
if (voe_xmedia_) {
|
if (voe_xmedia_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_xmedia_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_xmedia_->Release()));
|
voe_xmedia_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d external media interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_xmedia_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef _TEST_CALL_REPORT_
|
#ifdef _TEST_CALL_REPORT_
|
||||||
if (voe_call_report_) {
|
if (voe_call_report_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_call_report_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_call_report_->Release()));
|
voe_call_report_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d call report interfaces"
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_call_report_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef _TEST_NETEQ_STATS_
|
#ifdef _TEST_NETEQ_STATS_
|
||||||
if (voe_neteq_stats_) {
|
if (voe_neteq_stats_) {
|
||||||
for (remInt = 1, j = 0; remInt > 0; j++)
|
voe_neteq_stats_->Release();
|
||||||
TEST_MUSTPASS(-1 == (remInt = voe_neteq_stats_->Release()));
|
voe_neteq_stats_ = NULL;
|
||||||
if (j > 1) {
|
|
||||||
TEST_LOG("\n\n*** Error: released %d neteq stat interfaces "
|
|
||||||
"(should only be 1) \n", j);
|
|
||||||
releaseOK = false;
|
|
||||||
}
|
|
||||||
TEST_MUSTPASS(-1 != voe_neteq_stats_->Release());
|
|
||||||
err = voe_base_->LastError();
|
|
||||||
TEST_MUSTPASS(err != VE_INTERFACE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (false == VoiceEngine::Delete(voice_engine_)) {
|
if (false == VoiceEngine::Delete(voice_engine_)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user