Remove (in practice) the voice engine channel limit.

There's really no reason for this limit. I've bumped it to a
practically unreachable ceiling, with a TODO for removing it
entirely.

TBR=henrika
BUG=b/8122300

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3459 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2013-02-01 23:42:44 +00:00
parent dbe97d2550
commit 4a6f62d4dc
4 changed files with 13 additions and 73 deletions

View File

@ -24,7 +24,7 @@ ChannelManagerBase::ChannelManagerBase() :
_itemsCritSectPtr(CriticalSectionWrapper::CreateCriticalSection()), _itemsCritSectPtr(CriticalSectionWrapper::CreateCriticalSection()),
_itemsRWLockPtr(RWLockWrapper::CreateRWLock()) _itemsRWLockPtr(RWLockWrapper::CreateRWLock())
{ {
for (int i = 0; i < KMaxNumberOfItems; i++) for (int i = 0; i < kVoiceEngineMaxNumChannels; i++)
{ {
_freeItemIds[i] = true; _freeItemIds[i] = true;
} }
@ -48,7 +48,7 @@ bool ChannelManagerBase::GetFreeItemId(WebRtc_Word32& itemId)
{ {
CriticalSectionScoped cs(_itemsCritSectPtr); CriticalSectionScoped cs(_itemsCritSectPtr);
WebRtc_Word32 i(0); WebRtc_Word32 i(0);
while (i < KMaxNumberOfItems) while (i < kVoiceEngineMaxNumChannels)
{ {
if (_freeItemIds[i]) if (_freeItemIds[i])
{ {
@ -63,13 +63,13 @@ bool ChannelManagerBase::GetFreeItemId(WebRtc_Word32& itemId)
void ChannelManagerBase::AddFreeItemId(WebRtc_Word32 itemId) void ChannelManagerBase::AddFreeItemId(WebRtc_Word32 itemId)
{ {
assert(itemId < KMaxNumberOfItems); assert(itemId < kVoiceEngineMaxNumChannels);
_freeItemIds[itemId] = true; _freeItemIds[itemId] = true;
} }
void ChannelManagerBase::RemoveFreeItemIds() void ChannelManagerBase::RemoveFreeItemIds()
{ {
for (int i = 0; i < KMaxNumberOfItems; i++) for (int i = 0; i < kVoiceEngineMaxNumChannels; i++)
{ {
_freeItemIds[i] = false; _freeItemIds[i] = false;
} }
@ -142,7 +142,7 @@ WebRtc_Word32 ChannelManagerBase::NumOfItems() const
WebRtc_Word32 ChannelManagerBase::MaxNumOfItems() const WebRtc_Word32 ChannelManagerBase::MaxNumOfItems() const
{ {
return static_cast<WebRtc_Word32> (KMaxNumberOfItems); return static_cast<WebRtc_Word32> (kVoiceEngineMaxNumChannels);
} }
void* void*

View File

@ -28,9 +28,6 @@ class Channel;
class ChannelManagerBase class ChannelManagerBase
{ {
public:
enum {KMaxNumberOfItems = kVoiceEngineMaxNumOfChannels};
protected: protected:
bool CreateItem(WebRtc_Word32& itemId); bool CreateItem(WebRtc_Word32& itemId);
@ -77,7 +74,7 @@ private:
MapWrapper _items; MapWrapper _items;
bool _freeItemIds[KMaxNumberOfItems]; bool _freeItemIds[kVoiceEngineMaxNumChannels];
// Protects channels from being destroyed while being used // Protects channels from being destroyed while being used
RWLockWrapper* _itemsRWLockPtr; RWLockWrapper* _itemsRWLockPtr;

View File

@ -981,19 +981,17 @@ int VoEExtendedTest::TestBase() {
voe_base_->DeleteChannel(ch); voe_base_->DeleteChannel(ch);
// Multi-channel tests // Multi-channel tests
const int MaxNumberOfPlayingChannels(kVoiceEngineMaxNumOfActiveChannels); for (i = 0; i < kVoiceEngineMaxNumChannels; i++) {
for (i = 0; i < MaxNumberOfPlayingChannels; i++) {
ch = voe_base_->CreateChannel(); ch = voe_base_->CreateChannel();
TEST_MUSTPASS(voe_base_->StartPlayout(ch)); TEST_MUSTPASS(voe_base_->StartPlayout(ch));
MARK(); MARK();
} }
for (i = 0; i < MaxNumberOfPlayingChannels; i++) { for (i = 0; i < kVoiceEngineMaxNumChannels; i++) {
TEST_MUSTPASS(voe_base_->StopPlayout(i)); TEST_MUSTPASS(voe_base_->StopPlayout(i));
MARK(); MARK();
voe_base_->DeleteChannel(i); voe_base_->DeleteChannel(i);
} }
for (i = 0; i < MaxNumberOfPlayingChannels; i++) { for (i = 0; i < kVoiceEngineMaxNumChannels; i++) {
ch = voe_base_->CreateChannel(); ch = voe_base_->CreateChannel();
TEST_MUSTPASS(voe_base_->StartPlayout(ch)); TEST_MUSTPASS(voe_base_->StartPlayout(ch));
MARK(); MARK();

View File

@ -23,8 +23,10 @@
// Enumerators // Enumerators
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
namespace webrtc namespace webrtc {
{
// TODO(ajm): There's not really a reason for this limitation. Remove it.
enum { kVoiceEngineMaxNumChannels = 100 };
// VolumeControl // VolumeControl
enum { kMinVolumeLevel = 0 }; enum { kMinVolumeLevel = 0 };
@ -254,18 +256,6 @@ inline int VoEChannelId(const int moduleId)
#pragma comment( lib, "ws2_32.lib" ) #pragma comment( lib, "ws2_32.lib" )
#endif #endif
// ----------------------------------------------------------------------------
// Enumerators
// ----------------------------------------------------------------------------
namespace webrtc
{
// Max number of supported channels
enum { kVoiceEngineMaxNumOfChannels = 32 };
// Max number of channels which can be played out simultaneously
enum { kVoiceEngineMaxNumOfActiveChannels = 16 };
} // namespace webrtc
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Defines // Defines
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -340,18 +330,6 @@ enum { kVoiceEngineMaxNumOfActiveChannels = 16 };
#ifdef ANDROID #ifdef ANDROID
// ----------------------------------------------------------------------------
// Enumerators
// ----------------------------------------------------------------------------
namespace webrtc
{
// Max number of supported channels
enum { kVoiceEngineMaxNumOfChannels = 32 };
// Max number of channels which can be played out simultaneously
enum { kVoiceEngineMaxNumOfActiveChannels = 16 };
} // namespace webrtc
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Defines // Defines
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -384,17 +362,6 @@ namespace webrtc
return -1; return -1;
#else // LINUX PC #else // LINUX PC
// ----------------------------------------------------------------------------
// Enumerators
// ----------------------------------------------------------------------------
namespace webrtc
{
// Max number of supported channels
enum { kVoiceEngineMaxNumOfChannels = 32 };
// Max number of channels which can be played out simultaneously
enum { kVoiceEngineMaxNumOfActiveChannels = 16 };
} // namespace webrtc
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Defines // Defines
@ -466,18 +433,6 @@ namespace webrtc
// iPhone specific // iPhone specific
#if defined(WEBRTC_IOS) #if defined(WEBRTC_IOS)
// ----------------------------------------------------------------------------
// Enumerators
// ----------------------------------------------------------------------------
namespace webrtc
{
// Max number of supported channels
enum { kVoiceEngineMaxNumOfChannels = 2 };
// Max number of channels which can be played out simultaneously
enum { kVoiceEngineMaxNumOfActiveChannels = 2 };
} // namespace webrtc
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Defines // Defines
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -511,14 +466,6 @@ namespace webrtc
// Enumerators // Enumerators
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
namespace webrtc
{
// Max number of supported channels
enum { kVoiceEngineMaxNumOfChannels = 32 };
// Max number of channels which can be played out simultaneously
enum { kVoiceEngineMaxNumOfActiveChannels = 16 };
} // namespace webrtc
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Defines // Defines
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -530,6 +477,4 @@ namespace webrtc
#define IPHONE_NOT_SUPPORTED(stat) #define IPHONE_NOT_SUPPORTED(stat)
#endif // #ifdef WEBRTC_MAC #endif // #ifdef WEBRTC_MAC
#endif // WEBRTC_VOICE_ENGINE_VOICE_ENGINE_DEFINES_H #endif // WEBRTC_VOICE_ENGINE_VOICE_ENGINE_DEFINES_H