summaryrefslogtreecommitdiff
path: root/voice_engine/voe_audio_processing_impl.cc
diff options
context:
space:
mode:
authorpbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-08-07 17:57:36 +0000
committerpbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-08-07 17:57:36 +0000
commitb3ada1540827c60a63058570a94a57dfd260ad11 (patch)
tree4111b0516651b8faa696542ec02b30fad770c879 /voice_engine/voe_audio_processing_impl.cc
parentd7b06eca993d068de0d579a83511640d74ab9f77 (diff)
downloadwebrtc-b3ada1540827c60a63058570a94a57dfd260ad11.tar.gz
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/webrtc@4502 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine/voe_audio_processing_impl.cc')
-rw-r--r--voice_engine/voe_audio_processing_impl.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/voice_engine/voe_audio_processing_impl.cc b/voice_engine/voe_audio_processing_impl.cc
index 430f86dc..a57ede93 100644
--- a/voice_engine/voe_audio_processing_impl.cc
+++ b/voice_engine/voe_audio_processing_impl.cc
@@ -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");