Ref-counted rewrite of ChannelManager.

The complexity of the last ChannelManager and potentially usage of it as well caused race conditions and deadlocks in loopback voe_auto_test. This ref-counted solution takes no long-term locks, uses less locks overall and is significantly easier to understand.

ScopedChannel has been split up into a ChannelOwner with a reference to a channel and an Iterator over ChannelManager. Previous code was really used for both things. ChannelOwner is used as a shared pointer to a channel object, while an Iterator should work as expected.

BUG=2081
R=tommi@webrtc.org, xians@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1802004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4502 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2013-08-07 17:57:36 +00:00
parent 825e9b0a9b
commit 676ff1ed89
28 changed files with 581 additions and 1072 deletions

View File

@ -20,7 +20,6 @@ LOCAL_SRC_FILES := \
audio_frame_operations.cc \
channel.cc \
channel_manager.cc \
channel_manager_base.cc \
dtmf_inband.cc \
dtmf_inband_queue.cc \
level_indicator.cc \

View File

@ -8,154 +8,117 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/voice_engine/channel.h"
#include "webrtc/voice_engine/channel_manager.h"
namespace webrtc
{
#include "webrtc/voice_engine/channel.h"
namespace voe
{
namespace webrtc {
namespace voe {
ChannelManager::ChannelManager(uint32_t instanceId) :
ChannelManagerBase(),
_instanceId(instanceId)
{
ChannelOwner::ChannelOwner(class Channel* channel)
: channel_ref_(new ChannelRef(channel)) {}
ChannelOwner::ChannelOwner(const ChannelOwner& channel_owner)
: channel_ref_(channel_owner.channel_ref_) {
++channel_ref_->ref_count;
}
ChannelManager::~ChannelManager()
{
ChannelManagerBase::DestroyAllItems();
ChannelOwner::~ChannelOwner() {
if (--channel_ref_->ref_count == 0)
delete channel_ref_;
}
bool ChannelManager::CreateChannel(int32_t& channelId)
{
return ChannelManagerBase::CreateItem(channelId);
ChannelOwner& ChannelOwner::operator=(const ChannelOwner& other) {
if (other.channel_ref_ == channel_ref_)
return *this;
if (--channel_ref_->ref_count == 0)
delete channel_ref_;
channel_ref_ = other.channel_ref_;
++channel_ref_->ref_count;
return *this;
}
int32_t ChannelManager::DestroyChannel(int32_t channelId)
{
Channel* deleteChannel =
static_cast<Channel*> (ChannelManagerBase::RemoveItem(channelId));
if (!deleteChannel)
{
return -1;
ChannelOwner::ChannelRef::ChannelRef(class Channel* channel)
: channel(channel), ref_count(1) {}
ChannelManager::ChannelManager(uint32_t instance_id)
: instance_id_(instance_id),
last_channel_id_(-1),
lock_(CriticalSectionWrapper::CreateCriticalSection()) {}
ChannelOwner ChannelManager::CreateChannel() {
Channel* channel;
Channel::CreateChannel(channel, ++last_channel_id_, instance_id_);
ChannelOwner channel_owner(channel);
CriticalSectionScoped crit(lock_.get());
channels_.push_back(channel_owner);
return channel_owner;
}
ChannelOwner ChannelManager::GetChannel(int32_t channel_id) {
CriticalSectionScoped crit(lock_.get());
for (size_t i = 0; i < channels_.size(); ++i) {
if (channels_[i].channel()->ChannelId() == channel_id)
return channels_[i];
}
return ChannelOwner(NULL);
}
void ChannelManager::GetAllChannels(std::vector<ChannelOwner>* channels) {
CriticalSectionScoped crit(lock_.get());
*channels = channels_;
}
void ChannelManager::DestroyChannel(int32_t channel_id) {
CriticalSectionScoped crit(lock_.get());
assert(channel_id >= 0);
for (std::vector<ChannelOwner>::iterator it = channels_.begin();
it != channels_.end();
++it) {
if (it->channel()->ChannelId() == channel_id) {
channels_.erase(it);
break;
}
delete deleteChannel;
return 0;
}
}
int32_t ChannelManager::NumOfChannels() const
{
return ChannelManagerBase::NumOfItems();
void ChannelManager::DestroyAllChannels() {
CriticalSectionScoped crit(lock_.get());
channels_.clear();
}
int32_t ChannelManager::MaxNumOfChannels() const
{
return ChannelManagerBase::MaxNumOfItems();
size_t ChannelManager::NumOfChannels() const {
CriticalSectionScoped crit(lock_.get());
return channels_.size();
}
void* ChannelManager::NewItem(int32_t itemID)
{
Channel* channel;
if (Channel::CreateChannel(channel, itemID, _instanceId) == -1)
{
return NULL;
}
return static_cast<void*> (channel);
ChannelManager::Iterator::Iterator(ChannelManager* channel_manager)
: iterator_pos_(0) {
channel_manager->GetAllChannels(&channels_);
}
void ChannelManager::DeleteItem(void* item)
{
Channel* deleteItem = static_cast<Channel*> (item);
delete deleteItem;
Channel* ChannelManager::Iterator::GetChannel() {
if (iterator_pos_ < channels_.size())
return channels_[iterator_pos_].channel();
return NULL;
}
Channel* ChannelManager::GetChannel(int32_t channelId) const
{
return static_cast<Channel*> (ChannelManagerBase::GetItem(channelId));
bool ChannelManager::Iterator::IsValid() {
return iterator_pos_ < channels_.size();
}
void ChannelManager::ReleaseChannel()
{
ChannelManagerBase::ReleaseItem();
}
void ChannelManager::GetChannelIds(int32_t* channelsArray,
int32_t& numOfChannels) const
{
ChannelManagerBase::GetItemIds(channelsArray, numOfChannels);
}
void ChannelManager::GetChannels(MapWrapper& channels) const
{
ChannelManagerBase::GetChannels(channels);
}
ScopedChannel::ScopedChannel(ChannelManager& chManager) :
_chManager(chManager),
_channelPtr(NULL)
{
// Copy all existing channels to the local map.
// It is not possible to utilize the ChannelPtr() API after
// this constructor. The intention is that this constructor
// is used in combination with the scoped iterator.
_chManager.GetChannels(_channels);
}
ScopedChannel::ScopedChannel(ChannelManager& chManager,
int32_t channelId) :
_chManager(chManager),
_channelPtr(NULL)
{
_channelPtr = _chManager.GetChannel(channelId);
}
ScopedChannel::~ScopedChannel()
{
if (_channelPtr != NULL || _channels.Size() != 0)
{
_chManager.ReleaseChannel();
}
// Delete the map
while (_channels.Erase(_channels.First()) == 0)
;
}
Channel* ScopedChannel::ChannelPtr()
{
return _channelPtr;
}
Channel* ScopedChannel::GetFirstChannel(void*& iterator) const
{
MapItem* it = _channels.First();
iterator = (void*) it;
if (!it)
{
return NULL;
}
return static_cast<Channel*> (it->GetItem());
}
Channel* ScopedChannel::GetNextChannel(void*& iterator) const
{
MapItem* it = (MapItem*) iterator;
if (!it)
{
iterator = NULL;
return NULL;
}
it = _channels.Next(it);
iterator = (void*) it;
if (!it)
{
return NULL;
}
return static_cast<Channel*> (it->GetItem());
void ChannelManager::Iterator::Increment() {
++iterator_pos_;
}
} // namespace voe
} // namespace webrtc

View File

@ -11,79 +11,108 @@
#ifndef WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H
#define WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H
#include <vector>
#include "webrtc/system_wrappers/interface/atomic32.h"
#include "webrtc/system_wrappers/interface/constructor_magic.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/typedefs.h"
#include "webrtc/voice_engine/channel_manager_base.h"
namespace webrtc
{
namespace webrtc {
namespace voe {
namespace voe
{
class ScopedChannel;
class Channel;
class ChannelManager: private ChannelManagerBase
{
friend class ScopedChannel;
// Shared-pointer implementation for keeping track of Channels. The underlying
// shared instance will be dropped when no more ChannelOwners point to it.
//
// One common source of ChannelOwner instances are
// ChannelManager::CreateChannel() and ChannelManager::GetChannel(...).
// It has a similar use case to shared_ptr in C++11. Should this move to C++11
// in the future, this class should be replaced by exactly that.
//
// To access the underlying Channel, use .channel().
// IsValid() implements a convenience method as an alternative for checking
// whether the underlying pointer is NULL or not.
//
// Channel channel_owner = channel_manager.GetChannel(channel_id);
// if (channel_owner.IsValid())
// channel_owner.channel()->...;
//
class ChannelOwner {
public:
explicit ChannelOwner(Channel* channel);
ChannelOwner(const ChannelOwner& channel_owner);
public:
bool CreateChannel(int32_t& channelId);
~ChannelOwner();
int32_t DestroyChannel(int32_t channelId);
ChannelOwner& operator=(const ChannelOwner& other);
int32_t MaxNumOfChannels() const;
Channel* channel() { return channel_ref_->channel.get(); }
bool IsValid() { return channel_ref_->channel.get() != NULL; }
private:
// Shared instance of a Channel. Copying ChannelOwners increase the reference
// count and destroying ChannelOwners decrease references. Channels are
// deleted when no references to them are held.
struct ChannelRef {
ChannelRef(Channel* channel);
const scoped_ptr<Channel> channel;
Atomic32 ref_count;
};
int32_t NumOfChannels() const;
void GetChannelIds(int32_t* channelsArray,
int32_t& numOfChannels) const;
ChannelManager(uint32_t instanceId);
~ChannelManager();
private:
ChannelManager(const ChannelManager&);
ChannelManager& operator=(const ChannelManager&);
Channel* GetChannel(int32_t channelId) const;
void GetChannels(MapWrapper& channels) const;
void ReleaseChannel();
virtual void* NewItem(int32_t itemID);
virtual void DeleteItem(void* item);
uint32_t _instanceId;
ChannelRef* channel_ref_;
};
class ScopedChannel
{
public:
// Can only be created by the channel manager
ScopedChannel(ChannelManager& chManager);
class ChannelManager {
public:
ChannelManager(uint32_t instance_id);
ScopedChannel(ChannelManager& chManager, int32_t channelId);
// Upon construction of an Iterator it will grab a copy of the channel list of
// the ChannelManager. The iteration will then occur over this state, not the
// current one of the ChannelManager. As the Iterator holds its own references
// to the Channels, they will remain valid even if they are removed from the
// ChannelManager.
class Iterator {
public:
explicit Iterator(ChannelManager* channel_manager);
Channel* ChannelPtr();
Channel* GetChannel();
bool IsValid();
Channel* GetFirstChannel(void*& iterator) const;
void Increment();
Channel* GetNextChannel(void*& iterator) const;
private:
size_t iterator_pos_;
std::vector<ChannelOwner> channels_;
~ScopedChannel();
private:
ChannelManager& _chManager;
Channel* _channelPtr;
MapWrapper _channels;
DISALLOW_COPY_AND_ASSIGN(Iterator);
};
// CreateChannel will always return a valid ChannelOwner instance.
ChannelOwner CreateChannel();
// ChannelOwner.channel() will be NULL if channel_id is invalid or no longer
// exists. This should be checked with ChannelOwner::IsValid().
ChannelOwner GetChannel(int32_t channel_id);
void GetAllChannels(std::vector<ChannelOwner>* channels);
void DestroyChannel(int32_t channel_id);
void DestroyAllChannels();
size_t NumOfChannels() const;
private:
uint32_t instance_id_;
Atomic32 last_channel_id_;
scoped_ptr<CriticalSectionWrapper> lock_;
std::vector<ChannelOwner> channels_;
DISALLOW_COPY_AND_ASSIGN(ChannelManager);
};
} // namespace voe
} // namespace webrtc
#endif // WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H

View File

@ -1,228 +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 "webrtc/voice_engine/channel_manager_base.h"
#include <assert.h>
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
namespace webrtc
{
namespace voe
{
ChannelManagerBase::ChannelManagerBase() :
_itemsCritSectPtr(CriticalSectionWrapper::CreateCriticalSection()),
_itemsRWLockPtr(RWLockWrapper::CreateRWLock())
{
for (int i = 0; i < kVoiceEngineMaxNumChannels; i++)
{
_freeItemIds[i] = true;
}
}
ChannelManagerBase::~ChannelManagerBase()
{
if (_itemsRWLockPtr)
{
delete _itemsRWLockPtr;
_itemsRWLockPtr = NULL;
}
if (_itemsCritSectPtr)
{
delete _itemsCritSectPtr;
_itemsCritSectPtr = NULL;
}
}
bool ChannelManagerBase::GetFreeItemId(int32_t& itemId)
{
CriticalSectionScoped cs(_itemsCritSectPtr);
int32_t i(0);
while (i < kVoiceEngineMaxNumChannels)
{
if (_freeItemIds[i])
{
itemId = i;
_freeItemIds[i] = false;
return true;
}
i++;
}
return false;
}
void ChannelManagerBase::AddFreeItemId(int32_t itemId)
{
assert(itemId < kVoiceEngineMaxNumChannels);
_freeItemIds[itemId] = true;
}
void ChannelManagerBase::RemoveFreeItemIds()
{
for (int i = 0; i < kVoiceEngineMaxNumChannels; i++)
{
_freeItemIds[i] = false;
}
}
bool ChannelManagerBase::CreateItem(int32_t& itemId)
{
_itemsCritSectPtr->Enter();
void* itemPtr;
itemId = -1;
const bool success = GetFreeItemId(itemId);
if (!success)
{
_itemsCritSectPtr->Leave();
return false;
}
itemPtr = NewItem(itemId);
if (!itemPtr)
{
_itemsCritSectPtr->Leave();
return false;
}
_itemsCritSectPtr->Leave();
InsertItem(itemId, itemPtr);
return true;
}
void ChannelManagerBase::InsertItem(int32_t itemId, void* item)
{
CriticalSectionScoped cs(_itemsCritSectPtr);
assert(!_items.Find(itemId));
_items.Insert(itemId, item);
}
void*
ChannelManagerBase::RemoveItem(int32_t itemId)
{
CriticalSectionScoped cs(_itemsCritSectPtr);
WriteLockScoped wlock(*_itemsRWLockPtr);
MapItem* it = _items.Find(itemId);
if (!it)
{
return 0;
}
void* returnItem = it->GetItem();
_items.Erase(it);
AddFreeItemId(itemId);
return returnItem;
}
void ChannelManagerBase::DestroyAllItems()
{
CriticalSectionScoped cs(_itemsCritSectPtr);
MapItem* it = _items.First();
while (it)
{
DeleteItem(it->GetItem());
_items.Erase(it);
it = _items.First();
}
RemoveFreeItemIds();
}
int32_t ChannelManagerBase::NumOfItems() const
{
return _items.Size();
}
int32_t ChannelManagerBase::MaxNumOfItems() const
{
return static_cast<int32_t> (kVoiceEngineMaxNumChannels);
}
void*
ChannelManagerBase::GetItem(int32_t itemId) const
{
CriticalSectionScoped cs(_itemsCritSectPtr);
MapItem* it = _items.Find(itemId);
if (!it)
{
return 0;
}
_itemsRWLockPtr->AcquireLockShared();
return it->GetItem();
}
void*
ChannelManagerBase::GetFirstItem(void*& iterator) const
{
CriticalSectionScoped cs(_itemsCritSectPtr);
MapItem* it = _items.First();
iterator = (void*) it;
if (!it)
{
return 0;
}
return it->GetItem();
}
void*
ChannelManagerBase::GetNextItem(void*& iterator) const
{
CriticalSectionScoped cs(_itemsCritSectPtr);
MapItem* it = (MapItem*) iterator;
if (!it)
{
iterator = 0;
return 0;
}
it = _items.Next(it);
iterator = (void*) it;
if (!it)
{
return 0;
}
return it->GetItem();
}
void ChannelManagerBase::ReleaseItem()
{
_itemsRWLockPtr->ReleaseLockShared();
}
void ChannelManagerBase::GetItemIds(int32_t* channelsArray,
int32_t& numOfChannels) const
{
MapItem* it = _items.First();
numOfChannels = (numOfChannels <= _items.Size()) ?
numOfChannels : _items.Size();
for (int i = 0; i < numOfChannels && it != NULL; i++)
{
channelsArray[i] = it->GetId();
it = _items.Next(it);
}
}
void ChannelManagerBase::GetChannels(MapWrapper& channels) const
{
CriticalSectionScoped cs(_itemsCritSectPtr);
if (_items.Size() == 0)
{
return;
}
_itemsRWLockPtr->AcquireLockShared();
for (MapItem* it = _items.First(); it != NULL; it = _items.Next(it))
{
channels.Insert(it->GetId(), it->GetItem());
}
}
} // namespace voe
} // namespace webrtc

View File

@ -1,87 +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_CHANNEL_MANAGER_BASE_H
#define WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_BASE_H
#include "webrtc/system_wrappers/interface/map_wrapper.h"
#include "webrtc/typedefs.h"
#include "webrtc/voice_engine/voice_engine_defines.h"
namespace webrtc
{
class CriticalSectionWrapper;
class RWLockWrapper;
namespace voe
{
class ScopedChannel;
class Channel;
class ChannelManagerBase
{
protected:
bool CreateItem(int32_t& itemId);
void InsertItem(int32_t itemId, void* item);
void* RemoveItem(int32_t itemId);
void* GetItem(int32_t itemId) const;
void* GetFirstItem(void*& iterator) const ;
void* GetNextItem(void*& iterator) const;
void ReleaseItem();
void AddFreeItemId(int32_t itemId);
bool GetFreeItemId(int32_t& itemId);
void RemoveFreeItemIds();
void DestroyAllItems();
int32_t NumOfItems() const;
int32_t MaxNumOfItems() const;
void GetItemIds(int32_t* channelsArray,
int32_t& numOfChannels) const;
void GetChannels(MapWrapper& channels) const;
virtual void* NewItem(int32_t itemId) = 0;
virtual void DeleteItem(void* item) = 0;
ChannelManagerBase();
virtual ~ChannelManagerBase();
private:
// Protects _items and _freeItemIds
CriticalSectionWrapper* _itemsCritSectPtr;
MapWrapper _items;
bool _freeItemIds[kVoiceEngineMaxNumChannels];
// Protects channels from being destroyed while being used
RWLockWrapper* _itemsRWLockPtr;
};
} // namespace voe
} // namespace webrtc
#endif // WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_BASE_H

View File

@ -130,9 +130,6 @@ public:
// Terminates all VoiceEngine functions and releses allocated resources.
virtual int Terminate() = 0;
// Retrieves the maximum number of channels that can be created.
virtual int MaxNumOfChannels() = 0;
// Creates a new channel and allocates the required resources for it.
virtual int CreateChannel() = 0;

View File

@ -76,32 +76,17 @@ void SharedData::set_audio_processing(AudioProcessing* audioproc) {
_outputMixerPtr->SetAudioProcessingModule(audioproc);
}
uint16_t SharedData::NumOfSendingChannels()
{
int32_t numOfChannels = _channelManager.NumOfChannels();
if (numOfChannels <= 0)
{
return 0;
}
uint16_t SharedData::NumOfSendingChannels() {
ChannelManager::Iterator it(&_channelManager);
uint16_t sending_channels = 0;
uint16_t nChannelsSending(0);
int32_t* channelsArray = new int32_t[numOfChannels];
for (ChannelManager::Iterator it(&_channelManager); it.IsValid();
it.Increment()) {
if (it.GetChannel()->Sending())
++sending_channels;
}
_channelManager.GetChannelIds(channelsArray, numOfChannels);
for (int i = 0; i < numOfChannels; i++)
{
voe::ScopedChannel sc(_channelManager, channelsArray[i]);
Channel* chPtr = sc.ChannelPtr();
if (chPtr)
{
if (chPtr->Sending())
{
nChannelsSending++;
}
}
}
delete [] channelsArray;
return nChannelsSending;
return sending_channels;
}
void SharedData::SetLastError(int32_t error) const {

View File

@ -8,63 +8,38 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/system_wrappers/interface/atomic32.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/event_wrapper.h"
#include "webrtc/test/testsupport/fileutils.h"
#include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h"
#include "webrtc/voice_engine/test/auto_test/voe_standard_test.h"
class TestRtpObserver : public webrtc::VoERTPObserver {
public:
TestRtpObserver();
virtual ~TestRtpObserver();
TestRtpObserver()
: crit_(voetest::CriticalSectionWrapper::CreateCriticalSection()),
changed_ssrc_event_(voetest::EventWrapper::Create()) {}
virtual ~TestRtpObserver() {}
virtual void OnIncomingCSRCChanged(int channel,
unsigned int CSRC,
bool added);
bool added) {}
virtual void OnIncomingSSRCChanged(int channel,
unsigned int SSRC);
void Reset();
public:
unsigned int ssrc_[2];
unsigned int csrc_[2][2]; // Stores 2 CSRCs for each channel.
bool added_[2][2];
int size_[2];
};
TestRtpObserver::TestRtpObserver() {
Reset();
}
TestRtpObserver::~TestRtpObserver() {
}
void TestRtpObserver::Reset() {
for (int i = 0; i < 2; i++) {
ssrc_[i] = 0;
csrc_[i][0] = 0;
csrc_[i][1] = 0;
added_[i][0] = false;
added_[i][1] = false;
size_[i] = 0;
void WaitForChangedSsrc() {
// 10 seconds should be enough.
EXPECT_EQ(voetest::kEventSignaled, changed_ssrc_event_->Wait(10*1000));
changed_ssrc_event_->Reset();
}
}
void TestRtpObserver::OnIncomingCSRCChanged(int channel,
unsigned int CSRC,
bool added) {
char msg[128];
sprintf(msg, "=> OnIncomingCSRCChanged(channel=%d, CSRC=%u, added=%d)\n",
channel, CSRC, added);
TEST_LOG("%s", msg);
if (channel > 1)
return; // Not enough memory.
csrc_[channel][size_[channel]] = CSRC;
added_[channel][size_[channel]] = added;
size_[channel]++;
if (size_[channel] == 2)
size_[channel] = 0;
}
void SetIncomingSsrc(unsigned int ssrc) {
voetest::CriticalSectionScoped lock(crit_.get());
incoming_ssrc_ = ssrc;
}
public:
voetest::scoped_ptr<voetest::CriticalSectionWrapper> crit_;
unsigned int incoming_ssrc_;
voetest::scoped_ptr<voetest::EventWrapper> changed_ssrc_event_;
};
void TestRtpObserver::OnIncomingSSRCChanged(int channel,
unsigned int SSRC) {
@ -73,7 +48,11 @@ void TestRtpObserver::OnIncomingSSRCChanged(int channel,
SSRC);
TEST_LOG("%s", msg);
ssrc_[channel] = SSRC;
{
voetest::CriticalSectionScoped lock(crit_.get());
if (incoming_ssrc_ == SSRC)
changed_ssrc_event_->Set();
}
}
class RtcpAppHandler : public webrtc::VoERTCPObserver {
@ -277,27 +256,23 @@ TEST_F(RtpRtcpTest, ObserverGetsNotifiedOnSsrcChange) {
TestRtpObserver rtcp_observer;
EXPECT_EQ(0, voe_rtp_rtcp_->RegisterRTPObserver(
channel_, rtcp_observer));
rtcp_observer.Reset();
unsigned int new_ssrc = 7777;
EXPECT_EQ(0, voe_base_->StopSend(channel_));
rtcp_observer.SetIncomingSsrc(new_ssrc);
EXPECT_EQ(0, voe_rtp_rtcp_->SetLocalSSRC(channel_, new_ssrc));
EXPECT_EQ(0, voe_base_->StartSend(channel_));
Sleep(500);
// Verify we got the new SSRC.
EXPECT_EQ(new_ssrc, rtcp_observer.ssrc_[0]);
rtcp_observer.WaitForChangedSsrc();
// Now try another SSRC.
unsigned int newer_ssrc = 1717;
EXPECT_EQ(0, voe_base_->StopSend(channel_));
rtcp_observer.SetIncomingSsrc(newer_ssrc);
EXPECT_EQ(0, voe_rtp_rtcp_->SetLocalSSRC(channel_, newer_ssrc));
EXPECT_EQ(0, voe_base_->StartSend(channel_));
Sleep(500);
EXPECT_EQ(newer_ssrc, rtcp_observer.ssrc_[0]);
rtcp_observer.WaitForChangedSsrc();
EXPECT_EQ(0, voe_rtp_rtcp_->DeRegisterRTPObserver(channel_));
}

View File

@ -17,10 +17,6 @@ class VoeBaseMiscTest : public BeforeInitializationFixture {
using namespace testing;
TEST_F(VoeBaseMiscTest, MaxNumChannelsIs100) {
EXPECT_EQ(100, voe_base_->MaxNumOfChannels());
}
TEST_F(VoeBaseMiscTest, GetVersionPrintsSomeUsefulInformation) {
char char_buffer[1024];
memset(char_buffer, 0, sizeof(char_buffer));

View File

@ -45,6 +45,8 @@ extern void* globalJavaVM;
extern void* globalContext;
#endif
static const int kTestMaxNumChannels = 100;
// ----------------------------------------------------------------------------
// External AudioDeviceModule implementation
// ----------------------------------------------------------------------------
@ -464,24 +466,13 @@ int VoEExtendedTest::TestBase() {
// >> end of Init(AudioDeviceModule)
// ------------------------------------------------------------------------
///////////////////////////
// MaxNumOfChannels
TEST(MaxNumOfChannels);
ANL();
TEST_MUSTPASS(voe_base_->MaxNumOfChannels() < 0);
MARK();
ANL();
AOK();
ANL();
ANL();
////////////////////////
// CreateChannel
// DeleteChannel
int i;
int channel;
int nChannels(voe_base_->MaxNumOfChannels());
static const int kTestMaxNumChannels = 100;
TEST(CreateChannel);
ANL();
@ -511,7 +502,7 @@ int VoEExtendedTest::TestBase() {
MARK();
}
// create max number of channels
for (i = 0; i < nChannels; i++) {
for (i = 0; i < kTestMaxNumChannels; i++) {
channel = voe_base_->CreateChannel();
MARK();
TEST_MUSTPASS(channel != i);
@ -520,7 +511,8 @@ int VoEExtendedTest::TestBase() {
MARK(); // should fail since no more channels can now be created
TEST_MUSTPASS(channel != -1);
int aChannel = (((nChannels - 17) > 0) ? (nChannels - 17) : 0);
int aChannel =
(((kTestMaxNumChannels - 17) > 0) ? (kTestMaxNumChannels - 17) : 0);
TEST_MUSTPASS(voe_base_->DeleteChannel(aChannel));
MARK();
channel = voe_base_->CreateChannel();
@ -528,7 +520,7 @@ int VoEExtendedTest::TestBase() {
TEST_MUSTPASS(channel != aChannel);
// delete all created channels
for (i = 0; i < nChannels; i++) {
for (i = 0; i < kTestMaxNumChannels; i++) {
TEST_MUSTPASS(voe_base_->DeleteChannel(i));
MARK();
}
@ -608,15 +600,15 @@ int VoEExtendedTest::TestBase() {
// Multi-channel tests
for (i = 0; i < voe_base_->MaxNumOfChannels(); i++) {
for (i = 0; i < kTestMaxNumChannels; i++) {
ch = voe_base_->CreateChannel();
MARK();
}
for (i = 0; i < voe_base_->MaxNumOfChannels(); i++) {
for (i = 0; i < kTestMaxNumChannels; i++) {
voe_base_->DeleteChannel(i);
MARK();
}
for (i = 0; i < voe_base_->MaxNumOfChannels(); i++) {
for (i = 0; i < kTestMaxNumChannels; i++) {
ch = voe_base_->CreateChannel();
ExtendedTestTransport* ptrTransport =
new ExtendedTestTransport(voe_network);
@ -669,17 +661,17 @@ int VoEExtendedTest::TestBase() {
voe_base_->DeleteChannel(ch);
// Multi-channel tests
for (i = 0; i < kVoiceEngineMaxNumChannels; i++) {
for (i = 0; i < kTestMaxNumChannels; i++) {
ch = voe_base_->CreateChannel();
TEST_MUSTPASS(voe_base_->StartPlayout(ch));
MARK();
}
for (i = 0; i < kVoiceEngineMaxNumChannels; i++) {
for (i = 0; i < kTestMaxNumChannels; i++) {
TEST_MUSTPASS(voe_base_->StopPlayout(i));
MARK();
voe_base_->DeleteChannel(i);
}
for (i = 0; i < kVoiceEngineMaxNumChannels; i++) {
for (i = 0; i < kTestMaxNumChannels; i++) {
ch = voe_base_->CreateChannel();
TEST_MUSTPASS(voe_base_->StartPlayout(ch));
MARK();
@ -791,7 +783,7 @@ int VoEExtendedTest::TestBase() {
voe_base_->DeleteChannel(ch);
// verify Set/Get for all supported modes and max number of channels
for (i = 0; i < voe_base_->MaxNumOfChannels(); i++) {
for (i = 0; i < kTestMaxNumChannels; i++) {
ch = voe_base_->CreateChannel();
// verify Set/Get for all supported modes
@ -813,7 +805,7 @@ int VoEExtendedTest::TestBase() {
SleepMs(50);
}
for (i = 0; i < voe_base_->MaxNumOfChannels(); i++) {
for (i = 0; i < kTestMaxNumChannels; i++) {
voe_base_->DeleteChannel(i);
}
@ -1306,10 +1298,9 @@ int VoEExtendedTest::TestCodec() {
CodecInst defaultCodec;
// check the channel parameter
int nMaxChannels(voe_base_->MaxNumOfChannels());
TEST_MUSTPASS(-1 != codec->GetSendCodec(nMaxChannels-1, cinst));
TEST_MUSTPASS(-1 != codec->GetSendCodec(kTestMaxNumChannels-1, cinst));
MARK(); // not created
TEST_MUSTPASS(-1 != codec->GetSendCodec(nMaxChannels, cinst));
TEST_MUSTPASS(-1 != codec->GetSendCodec(kTestMaxNumChannels, cinst));
MARK(); // out of range
TEST_MUSTPASS(-1 != codec->GetSendCodec(-1, cinst));
MARK(); // out of range
@ -3500,7 +3491,7 @@ int VoEExtendedTest::TestFile() {
TEST_LOG("StartRecordingCall, record both mic and file in specific"
" channels \n");
TEST_LOG("Create maxnumofchannels \n");
for (int i = 1; i < voe_base_->MaxNumOfChannels(); i++) {
for (int i = 1; i < kTestMaxNumChannels; i++) {
int ch = voe_base_->CreateChannel();
TEST_MUSTPASS(ch == -1);
TEST_MUSTPASS(voe_base_->StopPlayout(ch));
@ -3573,7 +3564,7 @@ int VoEExtendedTest::TestFile() {
kFileFormatCompressedFile));
SleepMs(2500);
TEST_MUSTPASS(file->StopPlayingFileLocally(0));
for (int i = 1; i < voe_base_->MaxNumOfChannels(); i++) {
for (int i = 1; i < kTestMaxNumChannels; i++) {
TEST_MUSTPASS(voe_base_->DeleteChannel(i));
}

View File

@ -226,7 +226,7 @@ int VoEStressTest::CreateDeleteChannelsTest() {
// Make sure audio is OK after test has finished.
// Set up, start with maxChannels/2 channels
const int maxChannels = base->MaxNumOfChannels();
const int maxChannels = 100;
VALIDATE_STRESS(maxChannels < 1); // Should always have at least one channel
bool* channelState = new bool[maxChannels];
memset(channelState, 0, maxChannels * sizeof(bool));

View File

@ -305,13 +305,11 @@ TransmitMixer::SetAudioProcessingModule(AudioProcessing* audioProcessingModule)
}
void TransmitMixer::GetSendCodecInfo(int* max_sample_rate, int* max_channels) {
ScopedChannel sc(*_channelManagerPtr);
void* iterator = NULL;
Channel* channel = sc.GetFirstChannel(iterator);
*max_sample_rate = 8000;
*max_channels = 1;
while (channel != NULL) {
for (ChannelManager::Iterator it(_channelManagerPtr); it.IsValid();
it.Increment()) {
Channel* channel = it.GetChannel();
if (channel->Sending()) {
CodecInst codec;
channel->GetSendCodec(codec);
@ -321,7 +319,6 @@ void TransmitMixer::GetSendCodecInfo(int* max_sample_rate, int* max_channels) {
std::max(*max_sample_rate, codec.plfreq));
*max_channels = std::max(*max_channels, codec.channels);
}
channel = sc.GetNextChannel(iterator);
}
}
@ -424,11 +421,10 @@ TransmitMixer::DemuxAndMix()
WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1),
"TransmitMixer::DemuxAndMix()");
ScopedChannel sc(*_channelManagerPtr);
void* iterator(NULL);
Channel* channelPtr = sc.GetFirstChannel(iterator);
while (channelPtr != NULL)
for (ChannelManager::Iterator it(_channelManagerPtr); it.IsValid();
it.Increment())
{
Channel* channelPtr = it.GetChannel();
if (channelPtr->InputIsOnHold())
{
channelPtr->UpdateLocalTimeStamp();
@ -438,7 +434,6 @@ TransmitMixer::DemuxAndMix()
channelPtr->Demultiplex(_audioFrame);
channelPtr->PrepareEncodeAndSend(_audioFrame.sample_rate_hz_);
}
channelPtr = sc.GetNextChannel(iterator);
}
return 0;
}
@ -446,8 +441,8 @@ TransmitMixer::DemuxAndMix()
void TransmitMixer::DemuxAndMix(const int voe_channels[],
int number_of_voe_channels) {
for (int i = 0; i < number_of_voe_channels; ++i) {
voe::ScopedChannel sc(*_channelManagerPtr, voe_channels[i]);
voe::Channel* channel_ptr = sc.ChannelPtr();
voe::ChannelOwner ch = _channelManagerPtr->GetChannel(voe_channels[i]);
voe::Channel* channel_ptr = ch.channel();
if (channel_ptr) {
if (channel_ptr->InputIsOnHold()) {
channel_ptr->UpdateLocalTimeStamp();
@ -466,16 +461,14 @@ TransmitMixer::EncodeAndSend()
WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1),
"TransmitMixer::EncodeAndSend()");
ScopedChannel sc(*_channelManagerPtr);
void* iterator(NULL);
Channel* channelPtr = sc.GetFirstChannel(iterator);
while (channelPtr != NULL)
for (ChannelManager::Iterator it(_channelManagerPtr); it.IsValid();
it.Increment())
{
Channel* channelPtr = it.GetChannel();
if (channelPtr->Sending() && !channelPtr->InputIsOnHold())
{
channelPtr->EncodeAndSend();
}
channelPtr = sc.GetNextChannel(iterator);
}
return 0;
}
@ -483,8 +476,8 @@ TransmitMixer::EncodeAndSend()
void TransmitMixer::EncodeAndSend(const int voe_channels[],
int number_of_voe_channels) {
for (int i = 0; i < number_of_voe_channels; ++i) {
voe::ScopedChannel sc(*_channelManagerPtr, voe_channels[i]);
voe::Channel* channel_ptr = sc.ChannelPtr();
voe::ChannelOwner ch = _channelManagerPtr->GetChannel(voe_channels[i]);
voe::Channel* channel_ptr = ch.channel();
if (channel_ptr && channel_ptr->Sending() && !channel_ptr->InputIsOnHold())
channel_ptr->EncodeAndSend();
}

View File

@ -342,8 +342,8 @@ int VoEAudioProcessingImpl::SetRxNsStatus(int channel,
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"SetRxNsStatus() failed to locate channel");
@ -368,8 +368,8 @@ int VoEAudioProcessingImpl::GetRxNsStatus(int channel,
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetRxNsStatus() failed to locate channel");
@ -395,8 +395,8 @@ int VoEAudioProcessingImpl::SetRxAgcStatus(int channel,
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"SetRxAgcStatus() failed to locate channel");
@ -421,8 +421,8 @@ int VoEAudioProcessingImpl::GetRxAgcStatus(int channel,
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetRxAgcStatus() failed to locate channel");
@ -446,8 +446,8 @@ int VoEAudioProcessingImpl::SetRxAgcConfig(int channel,
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"SetRxAgcConfig() failed to locate channel");
@ -470,8 +470,8 @@ int VoEAudioProcessingImpl::GetRxAgcConfig(int channel, AgcConfig& config) {
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetRxAgcConfig() failed to locate channel");
@ -771,8 +771,8 @@ int VoEAudioProcessingImpl::RegisterRxVadObserver(
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"RegisterRxVadObserver() failed to locate channel");
@ -788,8 +788,8 @@ int VoEAudioProcessingImpl::DeRegisterRxVadObserver(int channel) {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"DeRegisterRxVadObserver() failed to locate channel");
@ -807,8 +807,8 @@ int VoEAudioProcessingImpl::VoiceActivityIndicator(int channel) {
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"DeRegisterRxVadObserver() failed to locate channel");

View File

@ -223,8 +223,9 @@ int VoEBaseImpl::OnDataAvailable(const int voe_channels[],
// No need to go through the APM, demultiplex the data to each VoE channel,
// encode and send to the network.
for (int i = 0; i < number_of_voe_channels; ++i) {
voe::ScopedChannel sc(_shared->channel_manager(), voe_channels[i]);
voe::Channel* channel_ptr = sc.ChannelPtr();
voe::ChannelOwner ch =
_shared->channel_manager().GetChannel(voe_channels[i]);
voe::Channel* channel_ptr = ch.channel();
if (!channel_ptr)
continue;
@ -255,14 +256,12 @@ int VoEBaseImpl::RegisterVoiceEngineObserver(VoiceEngineObserver& observer)
}
// Register the observer in all active channels
voe::ScopedChannel sc(_shared->channel_manager());
void* iterator(NULL);
voe::Channel* channelPtr = sc.GetFirstChannel(iterator);
while (channelPtr != NULL)
{
channelPtr->RegisterVoiceEngineObserver(observer);
channelPtr = sc.GetNextChannel(iterator);
for (voe::ChannelManager::Iterator it(&_shared->channel_manager());
it.IsValid();
it.Increment()) {
it.GetChannel()->RegisterVoiceEngineObserver(observer);
}
_shared->transmit_mixer()->RegisterVoiceEngineObserver(observer);
_voiceEngineObserverPtr = &observer;
@ -287,13 +286,10 @@ int VoEBaseImpl::DeRegisterVoiceEngineObserver()
_voiceEngineObserverPtr = NULL;
// Deregister the observer in all active channels
voe::ScopedChannel sc(_shared->channel_manager());
void* iterator(NULL);
voe::Channel* channelPtr = sc.GetFirstChannel(iterator);
while (channelPtr != NULL)
{
channelPtr->DeRegisterVoiceEngineObserver();
channelPtr = sc.GetNextChannel(iterator);
for (voe::ChannelManager::Iterator it(&_shared->channel_manager());
it.IsValid();
it.Increment()) {
it.GetChannel()->DeRegisterVoiceEngineObserver();
}
return 0;
@ -538,18 +534,6 @@ int VoEBaseImpl::Terminate()
return TerminateInternal();
}
int VoEBaseImpl::MaxNumOfChannels()
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"MaxNumOfChannels()");
int32_t maxNumOfChannels =
_shared->channel_manager().MaxNumOfChannels();
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
VoEId(_shared->instance_id(), -1),
"MaxNumOfChannels() => %d", maxNumOfChannels);
return (maxNumOfChannels);
}
int VoEBaseImpl::CreateChannel()
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
@ -562,55 +546,40 @@ int VoEBaseImpl::CreateChannel()
return -1;
}
int32_t channelId = -1;
voe::ChannelOwner channel_owner =
_shared->channel_manager().CreateChannel();
if (!_shared->channel_manager().CreateChannel(channelId))
{
_shared->SetLastError(VE_CHANNEL_NOT_CREATED, kTraceError,
"CreateChannel() failed to allocate memory for channel");
return -1;
if (channel_owner.channel()->SetEngineInformation(
_shared->statistics(),
*_shared->output_mixer(),
*_shared->transmit_mixer(),
*_shared->process_thread(),
*_shared->audio_device(),
_voiceEngineObserverPtr,
&_callbackCritSect) != 0) {
_shared->SetLastError(
VE_CHANNEL_NOT_CREATED,
kTraceError,
"CreateChannel() failed to associate engine and channel."
" Destroying channel.");
_shared->channel_manager()
.DestroyChannel(channel_owner.channel()->ChannelId());
return -1;
} else if (channel_owner.channel()->Init() != 0) {
_shared->SetLastError(
VE_CHANNEL_NOT_CREATED,
kTraceError,
"CreateChannel() failed to initialize channel. Destroying"
" channel.");
_shared->channel_manager()
.DestroyChannel(channel_owner.channel()->ChannelId());
return -1;
}
bool destroyChannel(false);
{
voe::ScopedChannel sc(_shared->channel_manager(), channelId);
voe::Channel* channelPtr = sc.ChannelPtr();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_CREATED, kTraceError,
"CreateChannel() failed to allocate memory for channel");
return -1;
}
else if (channelPtr->SetEngineInformation(_shared->statistics(),
*_shared->output_mixer(),
*_shared->transmit_mixer(),
*_shared->process_thread(),
*_shared->audio_device(),
_voiceEngineObserverPtr,
&_callbackCritSect) != 0)
{
destroyChannel = true;
_shared->SetLastError(VE_CHANNEL_NOT_CREATED, kTraceError,
"CreateChannel() failed to associate engine and channel."
" Destroying channel.");
}
else if (channelPtr->Init() != 0)
{
destroyChannel = true;
_shared->SetLastError(VE_CHANNEL_NOT_CREATED, kTraceError,
"CreateChannel() failed to initialize channel. Destroying"
" channel.");
}
}
if (destroyChannel)
{
_shared->channel_manager().DestroyChannel(channelId);
return -1;
}
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
VoEId(_shared->instance_id(), -1),
"CreateChannel() => %d", channelId);
return channelId;
"CreateChannel() => %d", channel_owner.channel()->ChannelId());
return channel_owner.channel()->ChannelId();
}
int VoEBaseImpl::DeleteChannel(int channel)
@ -626,8 +595,8 @@ int VoEBaseImpl::DeleteChannel(int channel)
}
{
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -636,12 +605,7 @@ int VoEBaseImpl::DeleteChannel(int channel)
}
}
if (_shared->channel_manager().DestroyChannel(channel) != 0)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"DeleteChannel() failed to destroy channel");
return -1;
}
_shared->channel_manager().DestroyChannel(channel);
if (StopSend() != 0)
{
@ -666,8 +630,8 @@ int VoEBaseImpl::StartReceive(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -687,8 +651,8 @@ int VoEBaseImpl::StopReceive(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -708,8 +672,8 @@ int VoEBaseImpl::StartPlayout(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -739,8 +703,8 @@ int VoEBaseImpl::StopPlayout(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -766,8 +730,8 @@ int VoEBaseImpl::StartSend(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -797,8 +761,8 @@ int VoEBaseImpl::StopSend(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -943,8 +907,8 @@ int VoEBaseImpl::SetNetEQPlayoutMode(int channel, NetEqModes mode)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -963,8 +927,8 @@ int VoEBaseImpl::GetNetEQPlayoutMode(int channel, NetEqModes& mode)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -984,8 +948,8 @@ int VoEBaseImpl::SetOnHoldStatus(int channel, bool enable, OnHoldModes mode)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -1004,8 +968,8 @@ int VoEBaseImpl::GetOnHoldStatus(int channel, bool& enabled, OnHoldModes& mode)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -1043,47 +1007,21 @@ int32_t VoEBaseImpl::StartPlayout()
return 0;
}
int32_t VoEBaseImpl::StopPlayout()
{
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
"VoEBaseImpl::StopPlayout()");
int32_t numOfChannels = _shared->channel_manager().NumOfChannels();
if (numOfChannels <= 0)
{
return 0;
int32_t VoEBaseImpl::StopPlayout() {
WEBRTC_TRACE(kTraceInfo,
kTraceVoice,
VoEId(_shared->instance_id(), -1),
"VoEBaseImpl::StopPlayout()");
// Stop audio-device playing if no channel is playing out
if (_shared->NumOfSendingChannels() == 0) {
if (_shared->audio_device()->StopPlayout() != 0) {
_shared->SetLastError(VE_CANNOT_STOP_PLAYOUT,
kTraceError,
"StopPlayout() failed to stop playout");
return -1;
}
uint16_t nChannelsPlaying(0);
int32_t* channelsArray = new int32_t[numOfChannels];
// Get number of playing channels
_shared->channel_manager().GetChannelIds(channelsArray, numOfChannels);
for (int i = 0; i < numOfChannels; i++)
{
voe::ScopedChannel sc(_shared->channel_manager(), channelsArray[i]);
voe::Channel* chPtr = sc.ChannelPtr();
if (chPtr)
{
if (chPtr->Playing())
{
nChannelsPlaying++;
}
}
}
delete[] channelsArray;
// Stop audio-device playing if no channel is playing out
if (nChannelsPlaying == 0)
{
if (_shared->audio_device()->StopPlayout() != 0)
{
_shared->SetLastError(VE_CANNOT_STOP_PLAYOUT, kTraceError,
"StopPlayout() failed to stop playout");
return -1;
}
}
return 0;
}
return 0;
}
int32_t VoEBaseImpl::StartSend()
@ -1142,17 +1080,7 @@ int32_t VoEBaseImpl::TerminateInternal()
"VoEBaseImpl::TerminateInternal()");
// Delete any remaining channel objects
int32_t numOfChannels = _shared->channel_manager().NumOfChannels();
if (numOfChannels > 0)
{
int32_t* channelsArray = new int32_t[numOfChannels];
_shared->channel_manager().GetChannelIds(channelsArray, numOfChannels);
for (int i = 0; i < numOfChannels; i++)
{
DeleteChannel(channelsArray[i]);
}
delete[] channelsArray;
}
_shared->channel_manager().DestroyAllChannels();
if (_shared->process_thread())
{

View File

@ -38,8 +38,6 @@ public:
virtual int Terminate();
virtual int MaxNumOfChannels();
virtual int CreateChannel();
virtual int DeleteChannel(int channel);

View File

@ -64,6 +64,7 @@ int VoECallReportImpl::ResetCallReportStatistics(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
assert(_shared->audio_processing() != NULL);
bool echoMode =
@ -87,8 +88,8 @@ int VoECallReportImpl::ResetCallReportStatistics(int channel)
// Reset channel dependent statistics
if (channel != -1)
{
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -97,28 +98,13 @@ int VoECallReportImpl::ResetCallReportStatistics(int channel)
}
channelPtr->ResetDeadOrAliveCounters();
channelPtr->ResetRTCPStatistics();
}
else
{
int32_t numOfChannels =
_shared->channel_manager().NumOfChannels();
if (numOfChannels <= 0)
{
return 0;
}
int32_t* channelsArray = new int32_t[numOfChannels];
_shared->channel_manager().GetChannelIds(channelsArray, numOfChannels);
for (int i = 0; i < numOfChannels; i++)
{
voe::ScopedChannel sc(_shared->channel_manager(), channelsArray[i]);
voe::Channel* channelPtr = sc.ChannelPtr();
if (channelPtr)
{
channelPtr->ResetDeadOrAliveCounters();
channelPtr->ResetRTCPStatistics();
}
}
delete[] channelsArray;
} else {
for (voe::ChannelManager::Iterator it(&_shared->channel_manager());
it.IsValid();
it.Increment()) {
it.GetChannel()->ResetDeadOrAliveCounters();
it.GetChannel()->ResetRTCPStatistics();
}
}
return 0;
@ -237,8 +223,8 @@ int VoECallReportImpl::GetRoundTripTimeSummary(int channel, StatVal& delaysMs)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -280,8 +266,8 @@ int VoECallReportImpl::GetDeadOrAliveSummaryInternal(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -333,48 +319,34 @@ int VoECallReportImpl::WriteReportToFile(const char* fileNameUTF8)
_file.WriteText("\nNetwork Packet Round Trip Time (RTT)\n");
_file.WriteText("------------------------------------\n\n");
int32_t numOfChannels = _shared->channel_manager().NumOfChannels();
if (numOfChannels <= 0)
{
return 0;
}
int32_t* channelsArray = new int32_t[numOfChannels];
_shared->channel_manager().GetChannelIds(channelsArray, numOfChannels);
for (int ch = 0; ch < numOfChannels; ch++)
{
voe::ScopedChannel sc(_shared->channel_manager(), channelsArray[ch]);
voe::Channel* channelPtr = sc.ChannelPtr();
if (channelPtr)
{
StatVal delaysMs;
_file.WriteText("channel %d:\n", ch);
channelPtr->GetRoundTripTimeSummary(delaysMs);
_file.WriteText(" min:%5d [ms]\n", delaysMs.min);
_file.WriteText(" max:%5d [ms]\n", delaysMs.max);
_file.WriteText(" avg:%5d [ms]\n", delaysMs.average);
}
if (_shared->channel_manager().NumOfChannels() == 0)
return 0;
for (voe::ChannelManager::Iterator it(&_shared->channel_manager());
it.IsValid();
it.Increment()) {
StatVal delaysMs;
_file.WriteText("channel %d:\n", it.GetChannel()->ChannelId());
it.GetChannel()->GetRoundTripTimeSummary(delaysMs);
_file.WriteText(" min:%5d [ms]\n", delaysMs.min);
_file.WriteText(" max:%5d [ms]\n", delaysMs.max);
_file.WriteText(" avg:%5d [ms]\n", delaysMs.average);
}
_file.WriteText("\nDead-or-Alive Connection Detections\n");
_file.WriteText("------------------------------------\n\n");
for (int ch = 0; ch < numOfChannels; ch++)
{
voe::ScopedChannel sc(_shared->channel_manager(), channelsArray[ch]);
voe::Channel* channelPtr = sc.ChannelPtr();
if (channelPtr)
{
int nDead(0);
int nAlive(0);
_file.WriteText("channel %d:\n", ch);
GetDeadOrAliveSummary(ch, nDead, nAlive);
_file.WriteText(" #dead :%6d\n", nDead);
_file.WriteText(" #alive:%6d\n", nAlive);
}
for (voe::ChannelManager::Iterator it(&_shared->channel_manager());
it.IsValid();
it.Increment()) {
int dead = 0;
int alive = 0;
_file.WriteText("channel %d:\n", it.GetChannel()->ChannelId());
GetDeadOrAliveSummary(it.GetChannel()->ChannelId(), dead, alive);
_file.WriteText(" #dead :%6d\n", dead);
_file.WriteText(" #alive:%6d\n", alive);
}
delete[] channelsArray;
EchoStatistics echo;
GetEchoMetricSummary(echo);

View File

@ -122,8 +122,8 @@ int VoECodecImpl::SetSendCodec(int channel, const CodecInst& codec)
"SetSendCodec() invalid number of channels");
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -156,8 +156,8 @@ int VoECodecImpl::GetSendCodec(int channel, CodecInst& codec)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -189,8 +189,8 @@ int VoECodecImpl::GetRecCodec(int channel, CodecInst& codec)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -223,8 +223,8 @@ int VoECodecImpl::SetAMREncFormat(int channel, AmrMode mode)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -249,8 +249,8 @@ int VoECodecImpl::SetAMRDecFormat(int channel, AmrMode mode)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -277,8 +277,8 @@ int VoECodecImpl::SetAMRWbEncFormat(int channel, AmrMode mode)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -305,8 +305,8 @@ int VoECodecImpl::SetAMRWbDecFormat(int channel, AmrMode mode)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -334,8 +334,8 @@ int VoECodecImpl::SetRecPayloadType(int channel, const CodecInst& codec)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -354,8 +354,8 @@ int VoECodecImpl::GetRecPayloadType(int channel, CodecInst& codec)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -392,8 +392,8 @@ int VoECodecImpl::SetSendCNPayloadType(int channel, int type,
"SetSendCNPayloadType() invalid payload frequency");
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -417,8 +417,8 @@ int VoECodecImpl::SetISACInitTargetRate(int channel, int rateBps,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -445,8 +445,8 @@ int VoECodecImpl::SetISACMaxRate(int channel, int rateBps)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -474,8 +474,8 @@ int VoECodecImpl::SetISACMaxPayloadSize(int channel, int sizeBytes)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -503,8 +503,8 @@ int VoECodecImpl::SetVADStatus(int channel, bool enable, VadModes mode,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -542,8 +542,8 @@ int VoECodecImpl::GetVADStatus(int channel, bool& enabled, VadModes& mode,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -696,8 +696,8 @@ int VoECodecImpl::SetSecondarySendCodec(int channel, const CodecInst& codec,
"SetSecondarySendCodec() invalid number of channels");
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"SetSecondarySendCodec() failed to locate channel");
@ -724,8 +724,8 @@ int VoECodecImpl::GetSecondarySendCodec(int channel, CodecInst& codec) {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetSecondarySendCodec() failed to locate channel");
@ -750,8 +750,8 @@ int VoECodecImpl::GetSecondarySendCodec(int channel, CodecInst& codec) {
int VoECodecImpl::RemoveSecondarySendCodec(int channel) {
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"RemoveSecondarySendCodec(channel=%d)", channel);
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"RemoveSecondarySendCodec() failed to locate "

View File

@ -67,8 +67,8 @@ int VoEDtmfImpl::SendTelephoneEvent(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -161,8 +161,8 @@ int VoEDtmfImpl::SetSendTelephoneEventPayloadType(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -182,8 +182,8 @@ int VoEDtmfImpl::GetSendTelephoneEventPayloadType(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -314,8 +314,8 @@ int VoEDtmfImpl::SetDtmfPlayoutStatus(int channel, bool enable)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -335,8 +335,8 @@ int VoEDtmfImpl::GetDtmfPlayoutStatus(int channel, bool& enabled)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,

View File

@ -59,8 +59,8 @@ int VoEEncryptionImpl::RegisterExternalEncryption(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -79,8 +79,8 @@ int VoEEncryptionImpl::DeRegisterExternalEncryption(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,

View File

@ -72,8 +72,9 @@ int VoEExternalMediaImpl::RegisterExternalMediaProcessing(
case kPlaybackPerChannel:
case kRecordingPerChannel:
{
voe::ScopedChannel sc(shared_->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch =
shared_->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -115,8 +116,9 @@ int VoEExternalMediaImpl::DeRegisterExternalMediaProcessing(
case kPlaybackPerChannel:
case kRecordingPerChannel:
{
voe::ScopedChannel sc(shared_->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch =
shared_->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -349,8 +351,8 @@ int VoEExternalMediaImpl::GetAudioFrame(int channel, int desired_sample_rate_hz,
shared_->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(shared_->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = shared_->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -387,8 +389,8 @@ int VoEExternalMediaImpl::SetExternalMixing(int channel, bool enable) {
shared_->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(shared_->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = shared_->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,

View File

@ -71,8 +71,8 @@ int VoEFileImpl::StartPlayingFileLocally(
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -107,8 +107,8 @@ int VoEFileImpl::StartPlayingFileLocally(int channel,
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -133,8 +133,8 @@ int VoEFileImpl::StopPlayingFileLocally(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -153,8 +153,8 @@ int VoEFileImpl::IsPlayingFileLocally(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -174,8 +174,8 @@ int VoEFileImpl::ScaleLocalFilePlayout(int channel, float scale)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -234,8 +234,8 @@ int VoEFileImpl::StartPlayingFileAsMicrophone(int channel,
else
{
// Add file after demultiplexing <=> affects one channel only
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -311,8 +311,8 @@ int VoEFileImpl::StartPlayingFileAsMicrophone(int channel,
else
{
// Add file after demultiplexing <=> affects one channel only
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -355,8 +355,8 @@ int VoEFileImpl::StopPlayingFileAsMicrophone(int channel)
else
{
// Stop adding file after demultiplexing <=> affects one channel only
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -383,8 +383,8 @@ int VoEFileImpl::IsPlayingFileAsMicrophone(int channel)
else
{
// Stop adding file after demultiplexing <=> affects one channel only
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -413,8 +413,8 @@ int VoEFileImpl::ScaleFileAsMicrophonePlayout(int channel, float scale)
else
{
// Stop adding file after demultiplexing <=> affects one channel only
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -448,8 +448,8 @@ int VoEFileImpl::StartRecordingPlayout(
else
{
// Add file after demultiplexing <=> affects one channel only
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -478,8 +478,8 @@ int VoEFileImpl::StartRecordingPlayout(
}
else
{
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -505,8 +505,8 @@ int VoEFileImpl::StopRecordingPlayout(int channel)
}
else
{
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -1342,8 +1342,8 @@ int VoEFileImpl::GetPlaybackPosition(int channel, int& positionMs)
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"GetPlaybackPosition(channel=%d)", channel);
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,

View File

@ -61,8 +61,8 @@ int VoENetEqStatsImpl::GetNetworkStatistics(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,

View File

@ -54,8 +54,8 @@ int VoENetworkImpl::RegisterExternalTransport(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -74,8 +74,8 @@ int VoENetworkImpl::DeRegisterExternalTransport(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -109,8 +109,8 @@ int VoENetworkImpl::ReceivedRTPPacket(int channel,
"ReceivedRTPPacket() invalid data vector");
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -149,8 +149,8 @@ int VoENetworkImpl::ReceivedRTCPPacket(int channel, const void* data,
"ReceivedRTCPPacket() invalid data vector");
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -187,8 +187,8 @@ int VoENetworkImpl::SetPacketTimeoutNotification(int channel,
"SetPacketTimeoutNotification() invalid timeout size");
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -210,8 +210,8 @@ int VoENetworkImpl::GetPacketTimeoutNotification(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -233,8 +233,8 @@ int VoENetworkImpl::RegisterDeadOrAliveObserver(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -253,8 +253,8 @@ int VoENetworkImpl::DeRegisterDeadOrAliveObserver(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -284,8 +284,8 @@ int VoENetworkImpl::SetPeriodicDeadOrAliveStatus(int channel, bool enable,
"SetPeriodicDeadOrAliveStatus() invalid sample time");
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -307,8 +307,8 @@ int VoENetworkImpl::GetPeriodicDeadOrAliveStatus(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,

View File

@ -59,8 +59,8 @@ int VoERTP_RTCPImpl::RegisterRTPObserver(int channel, VoERTPObserver& observer)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -79,8 +79,8 @@ int VoERTP_RTCPImpl::DeRegisterRTPObserver(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -100,8 +100,8 @@ int VoERTP_RTCPImpl::RegisterRTCPObserver(int channel, VoERTCPObserver& observer
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -120,8 +120,8 @@ int VoERTP_RTCPImpl::DeRegisterRTCPObserver(int channel)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -140,8 +140,8 @@ int VoERTP_RTCPImpl::SetLocalSSRC(int channel, unsigned int ssrc)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -160,8 +160,8 @@ int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -180,8 +180,8 @@ int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -200,8 +200,8 @@ int VoERTP_RTCPImpl::GetRemoteCSRCs(int channel, unsigned int arrCSRC[15])
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -235,8 +235,8 @@ int VoERTP_RTCPImpl::SetRTPAudioLevelIndicationStatus(int channel,
}
// Set state and ID for the specified channel.
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -258,8 +258,8 @@ int VoERTP_RTCPImpl::GetRTPAudioLevelIndicationStatus(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -278,8 +278,8 @@ int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -298,8 +298,8 @@ int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -318,8 +318,8 @@ int VoERTP_RTCPImpl::SetRTCP_CNAME(int channel, const char cName[256])
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -338,8 +338,8 @@ int VoERTP_RTCPImpl::GetRTCP_CNAME(int channel, char cName[256])
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -358,8 +358,8 @@ int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256])
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -385,8 +385,8 @@ int VoERTP_RTCPImpl::GetRemoteRTCPData(
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -417,8 +417,8 @@ int VoERTP_RTCPImpl::SendApplicationDefinedRTCPPacket(
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -443,8 +443,8 @@ int VoERTP_RTCPImpl::GetRTPStatistics(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -465,8 +465,8 @@ int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -484,8 +484,8 @@ int VoERTP_RTCPImpl::GetRemoteRTCPSenderInfo(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channel_ptr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channel_ptr = ch.channel();
if (channel_ptr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetRemoteRTCPSenderInfo() failed to locate channel");
@ -502,8 +502,8 @@ int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks(
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channel_ptr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channel_ptr = ch.channel();
if (channel_ptr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetRemoteRTCPReportBlocks() failed to locate channel");
@ -523,8 +523,8 @@ int VoERTP_RTCPImpl::SetFECStatus(int channel, bool enable, int redPayloadtype)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -552,8 +552,8 @@ int VoERTP_RTCPImpl::GetFECStatus(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -577,8 +577,8 @@ int VoERTP_RTCPImpl::SetNACKStatus(int channel,
"SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)",
channel, enable, maxNoPackets);
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -603,8 +603,8 @@ int VoERTP_RTCPImpl::StartRTPDump(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -623,8 +623,8 @@ int VoERTP_RTCPImpl::StopRTPDump(int channel, RTPDirections direction)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -644,8 +644,8 @@ int VoERTP_RTCPImpl::RTPDumpIsActive(int channel, RTPDirections direction)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -665,17 +665,18 @@ int VoERTP_RTCPImpl::InsertExtraRTPPacket(int channel,
"InsertExtraRTPPacket(channel=%d, payloadType=%u,"
" markerBit=%u, payloadSize=%u)",
channel, payloadType, markerBit, payloadSize);
if (!_shared->statistics().Initialized())
{
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"StopRTPDump() failed to locate channel");
"InsertExtraRTPPacket() failed to locate channel");
return -1;
}
return channelPtr->InsertExtraRTPPacket(payloadType,
@ -693,8 +694,8 @@ int VoERTP_RTCPImpl::GetLastRemoteTimeStamp(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,

View File

@ -58,15 +58,15 @@ int VoEVideoSyncImpl::GetPlayoutTimestamp(int channel, unsigned int& timestamp)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
if (channelPtr == NULL)
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channel_ptr = ch.channel();
if (channel_ptr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetPlayoutTimestamp() failed to locate channel");
return -1;
}
return channelPtr->GetPlayoutTimestamp(timestamp);
return channel_ptr->GetPlayoutTimestamp(timestamp);
}
int VoEVideoSyncImpl::SetInitTimestamp(int channel,
@ -82,8 +82,8 @@ int VoEVideoSyncImpl::SetInitTimestamp(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -106,8 +106,8 @@ int VoEVideoSyncImpl::SetInitSequenceNumber(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -129,8 +129,8 @@ int VoEVideoSyncImpl::SetMinimumPlayoutDelay(int channel,int delayMs)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -153,15 +153,15 @@ int VoEVideoSyncImpl::SetInitialPlayoutDelay(int channel, int delay_ms)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channel_ptr = sc.ChannelPtr();
if (channel_ptr == NULL)
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"SetInitialPlayoutDelay() failed to locate channel");
return -1;
}
return channel_ptr->SetInitialPlayoutDelay(delay_ms);
return channelPtr->SetInitialPlayoutDelay(delay_ms);
}
int VoEVideoSyncImpl::GetDelayEstimate(int channel,
@ -175,8 +175,8 @@ int VoEVideoSyncImpl::GetDelayEstimate(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetDelayEstimate() failed to locate channel");
@ -226,8 +226,8 @@ int VoEVideoSyncImpl::GetRtpRtcp(int channel, RtpRtcp* &rtpRtcpModule)
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -246,8 +246,8 @@ int VoEVideoSyncImpl::GetLeastRequiredDelayMs(int channel) const {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channel_ptr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channel_ptr = ch.channel();
if (channel_ptr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetLeastRequiredDelayMs() failed to locate channel");

View File

@ -297,8 +297,8 @@ int VoEVolumeControlImpl::SetInputMute(int channel, bool enable)
else
{
// Mute after demultiplexing <=> affects one channel only
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -326,8 +326,8 @@ int VoEVolumeControlImpl::GetInputMute(int channel, bool& enabled)
}
else
{
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -422,8 +422,8 @@ int VoEVolumeControlImpl::GetSpeechOutputLevel(int channel,
}
else
{
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -472,8 +472,8 @@ int VoEVolumeControlImpl::GetSpeechOutputLevelFullRange(int channel,
}
else
{
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -503,8 +503,8 @@ int VoEVolumeControlImpl::SetChannelOutputVolumeScaling(int channel,
"SetChannelOutputVolumeScaling() invalid parameter");
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -524,8 +524,8 @@ int VoEVolumeControlImpl::GetChannelOutputVolumeScaling(int channel,
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -577,8 +577,8 @@ int VoEVolumeControlImpl::SetOutputVolumePan(int channel,
else
{
// Per-channel balance (affects the signal before output mixing)
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
@ -620,8 +620,8 @@ int VoEVolumeControlImpl::GetOutputVolumePan(int channel,
}
else
{
voe::ScopedChannel sc(_shared->channel_manager(), channel);
voe::Channel* channelPtr = sc.ChannelPtr();
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,

View File

@ -57,8 +57,6 @@
'channel.h',
'channel_manager.cc',
'channel_manager.h',
'channel_manager_base.cc',
'channel_manager_base.h',
'dtmf_inband.cc',
'dtmf_inband.h',
'dtmf_inband_queue.cc',

View File

@ -27,9 +27,6 @@
namespace webrtc {
// TODO(ajm): There's not really a reason for this limitation. Remove it.
enum { kVoiceEngineMaxNumChannels = 100 };
// VolumeControl
enum { kMinVolumeLevel = 0 };
enum { kMaxVolumeLevel = 255 };